Package: witr
Version: 0.3.1+ds-1
Severity: minor
Tags: patch

Dear Maintainer,

witr --version doesn't show the package version:

  $ witr --version
  witr v (commit unknown, built v2026-04-23)

debian/rules passes $(DEB_UPSTREAM_VERSION) via -ldflags, but
/usr/share/dpkg/pkg-info.mk defines DEB_VERSION_UPSTREAM, so make expands
it to an empty string. The build date also gets a stray "v" prefix.

With the fix below (also proposed as a merge request on Salsa) it prints:

  witr v0.3.1+ds (commit unknown, built 2026-04-23)

--- a/debian/rules
+++ b/debian/rules
@@ -9,8 +9,8 @@ export DH_GOLANG_INSTALL_EXTRA := internal/version/VERSION

 BUILD_DATE := $(shell date --utc --date="@$(SOURCE_DATE_EPOCH)" "+%Y-%m-%d")
 LD_FLAGS := \
-    -X 
'github.com/pranshuparmar/witr/internal/version.Version=v$(DEB_UPSTREAM_VERSION)'
\
-    -X 
'github.com/pranshuparmar/witr/internal/version.BuildDate=v$(BUILD_DATE)'
+    -X 
'github.com/pranshuparmar/witr/internal/version.Version=v$(DEB_VERSION_UPSTREAM)'
\
+    -X 'github.com/pranshuparmar/witr/internal/version.BuildDate=$(BUILD_DATE)'

 %:
     dh $@ --builddirectory=debian/build --buildsystem=golang

If you'd rather show the upstream version without the +ds repack suffix,
$(subst +ds,,$(DEB_VERSION_UPSTREAM)) gives "v0.3.1".

The fix was prepared with the help of an AI assistant (Claude Code),
which also built the package in sid and checked the output above.

Reply via email to