[X2Go-Commits] [x2goserver] 02/04: debian/rules: port new OS version detection code from X2Go Client, which also fixes detecting testing and unstable.
git-admin at x2go.org
git-admin at x2go.org
Wed May 24 22:25:21 CEST 2023
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch feature/x2godialog
in repository x2goserver.
commit a161254f752171cc7b73dd83fdf0e3ecf1d693f6
Author: Mihai Moldovan <ionic at ionic.de>
Date: Wed May 24 22:22:27 2023 +0200
debian/rules: port new OS version detection code from X2Go Client, which also fixes detecting testing and unstable.
---
debian/changelog | 2 ++
debian/rules | 93 +++++++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 78 insertions(+), 17 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 4da8ddbf..e4b5ed4c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -471,6 +471,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium
quoted result). Quote the values in the variable directly and try not to
"double-quote" the resulting string.
+ Remove unintentional addition of USE_GTK variable.
+ + Port new OS version detection code from X2Go Client, which also fixes
+ detecting testing and unstable.
* debian/libx2go-server-perl.install:
+ Remove duplicated entry for X2Go/Utils.pm.
* debian/x2goserver.init:
diff --git a/debian/rules b/debian/rules
index 18fc9353..1ed48256 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,24 +7,83 @@ SUBSTVARS_LEGACY = -Vdist:Depends="perl"
SUBSTVARS_MULTI_ARCH_HINT = -Vdist:Depends="perl:any"
SUBSTVARS = $(SUBSTVARS_LEGACY)
-ifeq ($(shell { dpkg-vendor --is Debian && echo yes; } || { dpkg-vendor --is Raspbian && echo yes; }),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')
-# Let's fake testing's and unstable's "release version"...
-ifeq ($(RELEASE_VER),testing)
- RELEASE_VER = 999
-endif
-ifeq ($(RELEASE_VER),unstable)
- RELEASE_VER = 9999
-endif
-ifeq ($(shell /bin/bash -c '(( $(RELEASE_VER) >= 8 )) && echo yes'),yes)
- SUBSTVARS = $(SUBSTVARS_MULTI_ARCH_HINT)
-endif
-else ifeq ($(shell dpkg-vendor --is Ubuntu && echo yes),yes)
- RELEASE_VER_MAJOR = $(shell /usr/bin/lsb_release -r | /bin/sed -e 's/[ ]*//g' | /usr/bin/cut -d ':' -f '2' | /usr/bin/cut -d '.' -f '1')
- RELEASE_VER_MINOR = $(shell /usr/bin/lsb_release -r | /bin/sed -e 's/[ ]*//g' | /usr/bin/cut -d ':' -f '2' | /usr/bin/cut -d '.' -f '2')
-ifeq ($(shell /bin/bash -c '(( $(RELEASE_VER_MAJOR) >= 16 )) && echo yes'),yes)
- SUBSTVARS = $(SUBSTVARS_MULTI_ARCH_HINT)
+# Setting these disables autodetection.
+FORCE_VENDOR ?=
+FORCE_RELEASE_VER ?=
+
+ifneq ($(FORCE_VENDOR),)
+ ifneq ($(FORCE_RELEASE_VER),)
+ VENDOR_DEBIAN := $(shell if [ 'debian' = '$(FORCE_VENDOR)' ] || [ '$(FORCE_VENDOR)' = 'raspbian' ]; then echo 'yes'; fi)
+ VENDOR_UBUNTU := $(shell if [ 'ubuntu' = '$(FORCE_VENDOR)' ]; then echo 'yes'; fi)
+ RELEASE_VER := $(FORCE_RELEASE_VER)
+
+ ifeq ($(VENDOR_UBUNTU),yes)
+ RELEASE_VER_MAJOR := $(shell printf '%s\n' '$(RELEASE_VER)' | /usr/bin/cut -d '.' -f '1')
+ RELEASE_VER_MINOR := $(shell printf '%s\n' '$(RELEASE_VER)' | /usr/bin/cut -d '.' -f '2')
+ endif
+ else
+ $(error FORCE_VENDOR passed, but FORCE_RELEASEVER empty.)
+ endif
+else
+ VENDOR_DEBIAN := $(shell { dpkg-vendor --is 'Debian' && echo 'yes'; } || { dpkg-vendor --is 'Raspbian' && echo 'yes'; })
+
+ 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=[^, ]*' | sed -e 's/^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
+ endif
+ ifeq ($(RELEASE_VER),unstable)
+ RELEASE_VER := 9999
+ endif
+ else
+ VENDOR_UBUNTU := $(shell dpkg-vendor --is 'Ubuntu' && echo 'yes')
+
+ ifeq ($(VENDOR_UBUNTU),yes)
+ RELEASE_VER_MAJOR := $(shell /usr/bin/lsb_release -r | /bin/sed -e 's/[ ]*//g' | /usr/bin/cut -d ':' -f '2' | /usr/bin/cut -d '.' -f '1')
+ RELEASE_VER_MINOR := $(shell /usr/bin/lsb_release -r | /bin/sed -e 's/[ ]*//g' | /usr/bin/cut -d ':' -f '2' | /usr/bin/cut -d '.' -f '2')
+ endif
+ endif
endif
+
+# Actual version switch.
+ifeq ($(VENDOR_DEBIAN),yes)
+ ifeq ($(shell /bin/bash -c '(( $(RELEASE_VER) >= 8 )) && echo '"'"'yes'"'"),yes)
+ SUBSTVARS = $(SUBSTVARS_MULTI_ARCH_HINT)
+ endif
+else
+ ifeq ($(VENDOR_UBUNTU),yes)
+ # Example of how to use major and minor as a selector, we currently won't need
+ # this as the transition happened on a major version.
+ #ifeq ($(shell /bin/bash -c '(( $(RELEASE_VER_MAJOR) == 16 )) && echo '"'"'yes'"'"),yes)
+ #ifeq ($(shell /bin/bash -c '(( $(RELEASE_VER_MINOR) >= 4 )) && echo '"'"'yes'"'"),yes)
+ #SUBSTVARS = $(SUBSTVARS_MULTI_ARCH_HINT)
+ #endif
+ #endif
+ ifeq ($(shell /bin/bash -c '(( $(RELEASE_VER_MAJOR) >= 16 )) && echo '"'"'yes'"'"),yes)
+ SUBSTVARS = $(SUBSTVARS_MULTI_ARCH_HINT)
+ endif
+ endif
endif
export NXLIBDIR='/usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)/nx'
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
More information about the x2go-commits
mailing list