Jakub Klinkovský pushed to branch main at Arch Linux / Packaging / Packages / 
prometheus-nut-exporter


Commits:
1a43ca5d by Jakub Klinkovský at 2024-05-21T22:06:55+02:00
upgpkg: 3.1.1-1: update to the latest release and adapt to current packaging 
guidelines

- use SPDX license identifier
- use git tag as source and let pacman verify the checksum
- add flags for a debug package
- remove unnecessary PATH override from check

- - - - -


2 changed files:

- .SRCINFO
- PKGBUILD


Changes:

=====================================
.SRCINFO
=====================================
@@ -1,19 +1,19 @@
 pkgbase = prometheus-nut-exporter
        pkgdesc = Prometheus exporter for Network UPS Tools metrics
-       pkgver = 2.4.2
+       pkgver = 3.1.1
        pkgrel = 1
        url = https://github.com/DRuggeri/nut_exporter
        arch = x86_64
-       license = Apache
+       license = Apache-2.0
        makedepends = go
        makedepends = git
        depends = glibc
        optdepends = nut: for monitoring a local NUT server
        options = !lto
-       source = 
prometheus-nut-exporter::git+https://github.com/DRuggeri/nut_exporter.git#commit=c6a69c072e5c452a06dd72c19134a8903886a83c
+       source = 
prometheus-nut-exporter::git+https://github.com/DRuggeri/nut_exporter.git#tag=v3.1.1
        source = systemd.service
        source = sysusers.conf
-       b2sums = SKIP
+       b2sums = 
c8d36de2ba155904c5022b6360d2135747c5ca1901bf1fee4a64aaf2b4c43a900cc2a43842ced6eaf2b19d747710f8300de8d1625db507ffe8495eaaf122ae74
        b2sums = 
c37fea15866ccc283ca0aca7ac47edf746b3281bbdc9bb92edde41d110b459d55272aff30b963cda5d3165c9ea27f2cc82b48b0f340900531cc125dd0d719c97
        b2sums = 
f14c79da6b3efeb0843853e5772bcc021bd6041b76a39952ad45638ce27f143b41f6a491d528992250db9b2d9fd133b76ad8f6f6da9df4c6fb0865766d49d991
 


=====================================
PKGBUILD
=====================================
@@ -1,32 +1,28 @@
 # Maintainer: George Rawlinson <geo...@rawlinson.net.nz>
+# Maintainer: Jakub Klinkovský <lahwaacz at archlinux dot org>
 
 pkgname=prometheus-nut-exporter
 _pkgname=nut_exporter
-pkgver=2.4.2
+pkgver=3.1.1
 pkgrel=1
 pkgdesc='Prometheus exporter for Network UPS Tools metrics'
-arch=('x86_64')
+arch=(x86_64)
 url='https://github.com/DRuggeri/nut_exporter'
-license=('Apache')
-depends=('glibc')
-makedepends=('go' 'git')
+license=(Apache-2.0)
+depends=(glibc)
+makedepends=(go git)
 optdepends=('nut: for monitoring a local NUT server')
+# we cannot use LTO as otherwise we do not get reproducible package with full 
RELRO
 options=('!lto')
-_commit='c6a69c072e5c452a06dd72c19134a8903886a83c'
 source=(
-  "$pkgname::git+$url.git#commit=$_commit"
-  'systemd.service'
-  'sysusers.conf'
+  "$pkgname::git+$url.git#tag=v$pkgver"
+  systemd.service
+  sysusers.conf
 )
-b2sums=('SKIP'
+b2sums=('c8d36de2ba155904c5022b6360d2135747c5ca1901bf1fee4a64aaf2b4c43a900cc2a43842ced6eaf2b19d747710f8300de8d1625db507ffe8495eaaf122ae74'
         
'c37fea15866ccc283ca0aca7ac47edf746b3281bbdc9bb92edde41d110b459d55272aff30b963cda5d3165c9ea27f2cc82b48b0f340900531cc125dd0d719c97'
         
'f14c79da6b3efeb0843853e5772bcc021bd6041b76a39952ad45638ce27f143b41f6a491d528992250db9b2d9fd133b76ad8f6f6da9df4c6fb0865766d49d991')
 
-pkgver() {
-  cd "$pkgname"
-  git describe --tags | sed 's/^[vV]//;s/-/+/g'
-}
-
 prepare() {
   cd "$pkgname"
 
@@ -39,12 +35,18 @@ prepare() {
 
 build() {
   cd "$pkgname"
+
+  # set GOPATH so makepkg puts source files into the debug package
+  export GOPATH="$srcdir"
+
+  # get commit id for build
+  local _commit=$(git rev-parse v$pkgver)
+
   go build -v \
     -buildmode=pie \
-    -trimpath \
     -mod=readonly \
     -modcacherw \
-    -ldflags "-linkmode external -extldflags ${LDFLAGS} \
+    -ldflags "-compressdwarf=false -linkmode external -extldflags \"$LDFLAGS\" 
\
     -X main.Version=$pkgver \
     -X main.Commit=$_commit" \
     -o build .
@@ -52,8 +54,7 @@ build() {
 
 check() {
   cd "$pkgname"
-  # ensure tests have access to built binary
-  PATH="$(pwd)/build:$PATH" go test ./...
+  go test -v ./...
 }
 
 package() {



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/prometheus-nut-exporter/-/commit/1a43ca5df7291eccbbc4c51c3eba6c9c9b2684a1

-- 
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/prometheus-nut-exporter/-/commit/1a43ca5df7291eccbbc4c51c3eba6c9c9b2684a1
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to