[arch-commits] Commit in loki/trunk (PKGBUILD)

Daurnimator daurnimator at archlinux.org
Wed Jul 8 08:31:24 UTC 2020


    Date: Wednesday, July 8, 2020 @ 08:31:24
  Author: daurnimator
Revision: 660541

upgpkg: loki 1.5.0-2: split out promtail and logcli

Modified:
  loki/trunk/PKGBUILD

----------+
 PKGBUILD |   75 +++++++++++++++++++++++++++++++++----------------------------
 1 file changed, 41 insertions(+), 34 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-07-08 08:04:01 UTC (rev 660540)
+++ PKGBUILD	2020-07-08 08:31:24 UTC (rev 660541)
@@ -1,8 +1,9 @@
+# Maintainer: Daurnimator <daurnimator at archlinux.org>
 # Maintainer: Jelle van der Waa <jelle at archlinux.org>
 
-pkgname=loki
+pkgname=('loki' 'promtail' 'logcli')
 pkgver=1.5.0
-pkgrel=1
+pkgrel=2
 pkgdesc='like Prometheus, but for logs'
 url='https://github.com/grafana/loki'
 arch=('x86_64')
@@ -9,7 +10,6 @@
 license=('Apache')
 depends=('glibc')
 makedepends=('go' 'systemd')
-backup=('etc/loki/loki.yaml' 'etc/loki/promtail.yaml')
 source=($pkgname-$pkgver.tar.gz::https://github.com/grafana/loki/archive/v$pkgver.tar.gz
         promtail.sysusers promtail.service promtail.tmpfiles
         loki.sysusers loki.service loki.tmpfiles)
@@ -24,29 +24,18 @@
 build() {
   cd loki-$pkgver
 
-  go build \
-    -trimpath \
-    -buildmode=pie \
-    -mod=readonly \
-    -modcacherw \
-    -ldflags "-extldflags ${LDFLAGS}" \
-    ./cmd/loki
-
-  go build \
-    -trimpath \
-    -buildmode=pie \
-    -mod=readonly \
-    -modcacherw \
-    -ldflags "-extldflags ${LDFLAGS}" \
-    ./cmd/promtail
-
-  go build \
-    -trimpath \
-    -buildmode=pie \
-    -mod=readonly \
-    -modcacherw \
-    -ldflags "-extldflags ${LDFLAGS}" \
-    ./cmd/logcli
+  for cmd in loki promtail logcli; do
+    go build \
+      -trimpath \
+      -buildmode=pie \
+      -mod=readonly \
+      -modcacherw \
+      -ldflags " \
+         -X github.com/grafana/loki/pkg/build.Version=$pkgver
+         -X github.com/grafana/loki/pkg/build.BuildDate=$(date -u +'%Y-%m-%dT%H:%M:%SZ' --date=@${SOURCE_DATE_EPOCH})
+         -extldflags ${LDFLAGS}" \
+      ./cmd/"$cmd"
+  done
 }
 
 check() {
@@ -55,21 +44,39 @@
   go test -v $(go list  ./... | grep -v "distributor")
 }
 
-package() {
+package_loki() {
+  backup=('etc/loki/loki.yaml')
+
   cd loki-$pkgver
 
-  install -Dm755 -t "$pkgdir"/usr/bin loki promtail logcli
+  install -Dm755 -t "$pkgdir"/usr/bin loki
 
-  install -Dm644 cmd/promtail/promtail-local-config.yaml $pkgdir/etc/loki/promtail.yaml
   install -Dm644 cmd/loki/loki-local-config.yaml $pkgdir/etc/loki/loki.yaml
 
-  # Promtail
+  install -Dm644 ${srcdir}/loki.sysusers "$pkgdir/usr/lib/sysusers.d/loki.conf"
+  install -Dm644 ${srcdir}/loki.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/loki.conf"
+  install -Dm644 ${srcdir}/loki.service "$pkgdir/usr/lib/systemd/system/loki.service"
+}
+
+package_promtail() {
+  pkgdesc="An agent which ships the contents of local logs to a private Loki instance or Grafana Cloud"
+  backup=('etc/loki/promtail.yaml')
+
+  cd loki-$pkgver
+
+  install -Dm755 -t "$pkgdir"/usr/bin promtail
+
+  install -Dm644 cmd/promtail/promtail-local-config.yaml $pkgdir/etc/loki/promtail.yaml
+
   install -Dm644 ${srcdir}/promtail.sysusers "$pkgdir/usr/lib/sysusers.d/promtail.conf"
   install -Dm644 ${srcdir}/promtail.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/promtail.conf"
   install -Dm644 ${srcdir}/promtail.service "$pkgdir/usr/lib/systemd/system/promtail.service"
+}
 
-  # Loki
-  install -Dm644 ${srcdir}/loki.sysusers "$pkgdir/usr/lib/sysusers.d/loki.conf"
-  install -Dm644 ${srcdir}/loki.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/loki.conf"
-  install -Dm644 ${srcdir}/loki.service "$pkgdir/usr/lib/systemd/system/loki.service"
+package_logcli() {
+  pkgdesc="A command-line for loki"
+
+  cd loki-$pkgver
+
+  install -Dm755 -t "$pkgdir"/usr/bin logcli
 }


More information about the arch-commits mailing list