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

George Rawlinson grawlinson at gemini.archlinux.org
Mon Aug 1 08:36:15 UTC 2022


    Date: Monday, August 1, 2022 @ 08:36:14
  Author: grawlinson
Revision: 1259636

upgpkg: gum 0.2.0-4

* Add missing strings to binary (version/commit/date).
* Ensure man page is reproducible.

Modified:
  gum/trunk/PKGBUILD

----------+
 PKGBUILD |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-08-01 08:36:14 UTC (rev 1259635)
+++ PKGBUILD	2022-08-01 08:36:14 UTC (rev 1259636)
@@ -2,7 +2,7 @@
 
 pkgname=gum
 pkgver=0.2.0
-pkgrel=3
+pkgrel=4
 pkgdesc='A tool for glamorous shell scripts'
 arch=('x86_64')
 url='https://github.com/charmbracelet/gum'
@@ -38,17 +38,31 @@
   export CGO_CFLAGS="${CFLAGS}"
   export CGO_CXXFLAGS="${CXXFLAGS}"
 
+  # commit date for binary & man page
+  local _commit_date=$(git show --no-patch --format=%cd --date=format:%Y-%m-%d)
+
   go build -v \
     -trimpath \
     -buildmode=pie \
     -mod=readonly \
     -modcacherw \
-    -ldflags "-linkmode external -extldflags ${LDFLAGS}" \
+    -ldflags "-linkmode external -extldflags ${LDFLAGS} \
+    -X main.Version=$pkgver \
+    -X main.CommitSHA=$_commit \
+    -X main.CommitDate=$_commit_date" \
     -o build \
     .
 
+  # man page
   ./build/gum man > build/gum.1
 
+  # i'm not 100% sure where the man sub-command gets the date from, i assume
+  # it uses $TODAYS_DATE, so this should make the man page reproducible
+  sed \
+    -i build/gum.1 \
+    -e "s/\"[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\"/\"$_commit_date\"/"
+
+  # completions
   for shell in bash fish zsh; do
     ./build/gum completion "$shell" > "build/$shell-completion"
   done



More information about the arch-commits mailing list