[arch-commits] Commit in prometheus-postgresql-exporter/trunk (2 files)

Jelle van der Waa jelle at archlinux.org
Wed Jul 15 20:28:43 UTC 2020


    Date: Wednesday, July 15, 2020 @ 20:28:43
  Author: jelle
Revision: 391950

Updates to use go build directly

Modified:
  prometheus-postgresql-exporter/trunk/PKGBUILD
  prometheus-postgresql-exporter/trunk/prometheus-postgresql-exporter.service

----------------------------------------+
 PKGBUILD                               |   38 +++++++++++++++++--------------
 prometheus-postgresql-exporter.service |    2 -
 2 files changed, 23 insertions(+), 17 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-07-15 20:19:32 UTC (rev 391949)
+++ PKGBUILD	2020-07-15 20:28:43 UTC (rev 391950)
@@ -9,34 +9,40 @@
 url="https://github.com/wrouesnel/postgres_exporter"
 license=('Apache')
 makedepends=('git' 'go')
-source=("https://github.com/wrouesnel/postgres_exporter/archive/v${pkgver}.tar.gz"
-        "prometheus-postgresql-exporter.service")
+source=(${pkgname}-${pkgver}.tar.gz::https://github.com/wrouesnel/postgres_exporter/archive/v${pkgver}.tar.gz
+        "prometheus-postgresql-exporter.service"
+        "prometheus-postgresql-exporter.conf")
 sha256sums=('27877c9b3aa751c7c1265f39986218f6a2c2b66a126cf348c6cc2f20f5201b02'
-            'cda225c236df0e2a6d71c17a5390a92ed5cc7f71b8ca5843590c59fa02cdb135')
+            '9e0ddb12da5f82014322c865fd21e8efb59c256eac5ea8b7a60becd968e517ef'
+            'd132e8140c147f3a26fdff648c4e4e59b80225a7ee10195b9e460e224316e556')
 
 prepare() {
-    cd "${srcdir}/postgres_exporter-${pkgver}"
+  cd "${srcdir}/postgres_exporter-${pkgver}"
 
-    export GOPATH="${srcdir}/gopath"
-    mkdir -p "${GOPATH}/src/github.com/wrouesnel"
-    ln -snf "${srcdir}/postgres_exporter-${pkgver}" "${GOPATH}/src/github.com/wrouesnel/postgres_exporter"
+  export GOPATH="${srcdir}/gopath"
+  mkdir -p "${GOPATH}/src/github.com/wrouesnel"
+  ln -snf "${srcdir}/postgres_exporter-${pkgver}" "${GOPATH}/src/github.com/wrouesnel/postgres_exporter"
 }
 
 build() {
-    export GOPATH="${srcdir}/gopath"
-    cd "${GOPATH}/src/github.com/wrouesnel/postgres_exporter"
-    go run mage.go binary
+  export GOPATH="${srcdir}/gopath"
+  cd "${GOPATH}/src/github.com/wrouesnel/postgres_exporter"
+  go build \
+    -trimpath \
+    -buildmode=pie \
+    -ldflags "-extldflags \"${LDFLAGS}\"" \
+  ./cmd/postgres_exporter
 }
 
 check() {
-    export GOPATH="${srcdir}/gopath"
-    cd "${GOPATH}/src/github.com/wrouesnel/postgres_exporter"
-    go run mage.go test
+  export GOPATH="${srcdir}/gopath"
+  cd "${GOPATH}/src/github.com/wrouesnel/postgres_exporter"
+  go test ./...
 }
 
 package() {
-    install -Dm755 prometheus-postgresql-exporter.service "${pkgdir}/usr/lib/systemd/system/prometheus-postgresql-exporter.service"
-    install -Dm755 prometheus-postgresql-exporter.conf "${pkgdir}/etc/conf.d/prometheus-postgresql-exporter"
+  install -Dm755 ${srcdir}/prometheus-postgresql-exporter.service "${pkgdir}/usr/lib/systemd/system/prometheus-postgresql-exporter.service"
+  install -Dm600 ${srcdir}/prometheus-postgresql-exporter.conf "${pkgdir}/etc/conf.d/prometheus-postgresql-exporter"
 
-    install -Dm755 "postgres_exporter-${pkgver}/postgres_exporter" "${pkgdir}/usr/bin/prometheus-postgresql-exporter"
+  install -Dm755 "postgres_exporter-${pkgver}/postgres_exporter" "${pkgdir}/usr/bin/prometheus-postgresql-exporter"
 }

Modified: prometheus-postgresql-exporter.service
===================================================================
--- prometheus-postgresql-exporter.service	2020-07-15 20:19:32 UTC (rev 391949)
+++ prometheus-postgresql-exporter.service	2020-07-15 20:28:43 UTC (rev 391950)
@@ -7,7 +7,7 @@
 ExecStart=/usr/bin/prometheus-postgresql-exporter $POSTGRESQL_EXPORTER_ARGS
 Restart=on-failure
 
-
+DyanmicUser=true
 PrivateDevices=true
 
 [Install]



More information about the arch-commits mailing list