diff --git a/distro/debian/dms-git/debian/rules b/distro/debian/dms-git/debian/rules index 05037d45..ecfa6fde 100755 --- a/distro/debian/dms-git/debian/rules +++ b/distro/debian/dms-git/debian/rules @@ -27,12 +27,12 @@ override_dh_auto_build: # Verify core directory exists (native package format has source at root) test -d core || (echo "ERROR: core directory not found!" && exit 1) - # Patch go.mod to use Go 1.24 base version (Debian 13 has 1.23.x, may vary) - sed -i 's/^go 1\.24\.[0-9]*/go 1.24/' core/go.mod + # Pin go.mod and vendor/modules.txt to the installed Go toolchain version + GO_INSTALLED=$$(go version | grep -oP 'go\K[0-9]+\.[0-9]+'); \ + sed -i "s/^go [0-9]\+\.[0-9]\+\(\.[0-9]*\)\?$$/go $${GO_INSTALLED}/" core/go.mod; \ + sed -i "s/^\(## explicit; go \)[0-9]\+\.[0-9]\+\(\.[0-9]*\)\?$$/\1$${GO_INSTALLED}/" core/vendor/modules.txt - # Build dms-cli from source using vendored dependencies - # Extract version info and build in single shell to preserve variables - # Architecture mapping: Debian amd64/arm64 -> Makefile amd64/arm64 + # Build dms-cli (single shell to preserve variables; arch: Debian amd64/arm64 -> Makefile amd64/arm64) VERSION="$(UPSTREAM_VERSION)"; \ COMMIT=$$(echo "$(UPSTREAM_VERSION)" | grep -oP '(?<=git)[0-9]+\.[a-f0-9]+' | cut -d. -f2 | head -c8 || echo "unknown"); \ if [ "$(DEB_HOST_ARCH)" = "amd64" ]; then \ diff --git a/distro/fedora/dms-git.spec b/distro/fedora/dms-git.spec index 685f3f8e..083ae225 100644 --- a/distro/fedora/dms-git.spec +++ b/distro/fedora/dms-git.spec @@ -28,7 +28,7 @@ Requires: accountsservice Requires: dms-cli = %{epoch}:%{version}-%{release} Requires: dgop -# Core utilities (Highly recommended for DMS functionality) +# Core utilities (Recommended for DMS functionality) Recommends: cava Recommends: danksearch Recommends: matugen @@ -65,6 +65,13 @@ Provides native DBus bindings, NetworkManager integration, and system utilities. VERSION="%{version}" COMMIT=$(echo "%{version}" | grep -oP '[a-f0-9]{7,}' | head -n1 || echo "unknown") +# Pin go.mod and vendor/modules.txt to the installed Go toolchain version +GO_INSTALLED=$(go version | grep -oP 'go\K[0-9]+\.[0-9]+') +sed -i "s/^go [0-9]\+\.[0-9]\+\(\.[0-9]*\)\?$/go ${GO_INSTALLED}/" core/go.mod +# Only patch vendor/modules.txt when a vendor dir exists (OBS/offline builds) +[ -f core/vendor/modules.txt ] && \ + sed -i "s/^\(## explicit; go \)[0-9]\+\.[0-9]\+\(\.[0-9]*\)\?$/\1${GO_INSTALLED}/" core/vendor/modules.txt || true + cd core make dist VERSION="$VERSION" COMMIT="$COMMIT" diff --git a/distro/opensuse/dms-git.spec b/distro/opensuse/dms-git.spec index 94ddc985..17d26398 100644 --- a/distro/opensuse/dms-git.spec +++ b/distro/opensuse/dms-git.spec @@ -55,8 +55,10 @@ mkdir -p $HOME $GOCACHE $GOMODCACHE # OBS has no network access, so use local toolchain only export GOTOOLCHAIN=local -# Patch go.mod to use base Go version (e.g., go 1.24 instead of go 1.24.6) -sed -i 's/^go 1\.24\.[0-9]*/go 1.24/' core/go.mod +# Pin go.mod and vendor/modules.txt to the installed Go toolchain version +GO_INSTALLED=$(go version | grep -oP 'go\K[0-9]+\.[0-9]+') +sed -i "s/^go [0-9]\+\.[0-9]\+\(\.[0-9]*\)\?$/go ${GO_INSTALLED}/" core/go.mod +sed -i "s/^\(## explicit; go \)[0-9]\+\.[0-9]\+\(\.[0-9]*\)\?$/\1${GO_INSTALLED}/" core/vendor/modules.txt # Extract version info for embedding in binary VERSION="%{version}"