[X2Go-Commits] [x2goclient] 01/01: debian/rules: fix version detection on testing and unstable.

git-admin at x2go.org git-admin at x2go.org
Sat Dec 3 03:52:25 CET 2022


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goclient.

commit b029658146bf1e841f26809933417ff3a07ee9cc
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Fri Dec 2 00:36:50 2022 +0100

    debian/rules: fix version detection on testing and unstable.
    
    lsb_release -r currently only outputs n/a on these suites, so fall back
    to a rather fragile detection via apt-cache policy instead.
---
 debian/changelog |  3 +++
 debian/rules     | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index b2e16c7..1c9a107 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -180,6 +180,9 @@ x2goclient (4.1.2.3-0x2go1) UNRELEASED; urgency=medium
       allowing passed-in values through the environment.
     + Utilize new version switching in main Makefile by overriding the
       QT_VERSION make variable.
+    + Fix version detection on testing and unstable. lsb_release -r currently
+      only outputs n/a on these suites, so fall back to a rather fragile
+      detection via apt-cache policy instead.
   * debian/:
     + New file "watch". We won't need this per se (since we're upstream and
       there cannot be a newer version of the Debian package without releasing
diff --git a/debian/rules b/debian/rules
index 4eb06ad..6cde8fa 100755
--- a/debian/rules
+++ b/debian/rules
@@ -35,6 +35,26 @@ else
 
   ifeq ($(VENDOR_DEBIAN),yes)
     RELEASE_VER := $(shell /usr/bin/lsb_release -r | /bin/sed -e 's/[	 ]*//g' | /usr/bin/cut -d ':' -f '2' | /usr/bin/cut -d '.' -f '1')
+
+    # Newer Debian versions might report "n/a" for testing and unstable.
+    ifeq ($(RELEASE_VER),n/a)
+      # On these platforms, the best way to determine the system version is by
+      # going through apt-cache policy.
+      # Note that this should only be the case for either testing or unstable.
+      # Other systems should have a proper version number.
+      # This is also why we can just drop any suites/archive names (this is
+      # what a= means) containing a dash character (e.g., stable-updates)
+      # and only pick the first match.
+      RELEASE_VER := $(shell /usr/bin/apt-cache policy | grep -E 'o=(De|Rasp)bian,' | grep -E 'l=(De|Rasp)bian,' | grep -F 'c=main,' | grep -Eo 'a=[^, ]*' | grep -v -- '-' | head -n '1')
+
+      # Do error checking.
+      ifneq ($(RELEASE_VER),testing)
+        ifneq ($(RELEASE_VER),unstable)
+          $(error Release version could not be determined, sorry. Extracted value: $(RELEASE_VER))
+        endif
+      endif
+    endif
+
     # Let's fake testing's and unstable's "release version"...
     ifeq ($(RELEASE_VER),testing)
       RELEASE_VER := 999

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list