[X2Go-Commits] [buildscripts] 02/07: bin/build-rpm-package: work around OpenSuSE version number madness by mapping major version 42 to the more-sane value of 14 prior doing comparisons.

git-admin at x2go.org git-admin at x2go.org
Thu Nov 16 01:25:49 CET 2017


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

x2go pushed a commit to branch master
in repository buildscripts.

commit a1db46679ca3a9f8e24187604fc38447293013ce
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Nov 15 23:49:23 2017 +0100

    bin/build-rpm-package: work around OpenSuSE version number madness by mapping major version 42 to the more-sane value of 14 prior doing comparisons.
---
 bin/build-rpm-package | 53 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 51 insertions(+), 2 deletions(-)

diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index 63d1ce1..2145b7d 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -631,6 +631,47 @@ sign_packages () {
 	return 0
 }
 
+# Maps a *SuSE version number to a "real" value.
+# This is really working around OpenSuSE trying to be "smart".
+# OpenSuSE started out with major version number 10.
+# They continued doing releases up to major version number 13. During that time,
+# the development was decoupled from SLE{S,D}.
+# With OpenSuSE Leap, SLE{S,D} and OpenSuSE development lines were streamlined again.
+# OpenSuSE Leap started as a fork of SLE{S,D} 12, profiting from bug and security fixes
+# from the enterprise version. This posed a versioning problem, though.
+# OpenSuSE Leap was supposed to get a version number referencing the SLE{S,D} version,
+# but major version 12 has already been used for an OpenSuSE release before.
+# The "smart" solution, instead of just incrementing the version number to 14 which
+# wouldn't have made the heritage from SLE{S,D} clear enough, was to use the version
+# number 42 for the first OpenSuSE Leap release instead.
+# The rationale was to take the (more or less) arbitrary number 30 and add the SLE{S,D}
+# major version number 12 to that, hence major version 42.
+# Later, it was decided that SLE{S,D} skips version numbers 13 and 14 and instead
+# releases major version 15 instead. This would give OpenSuSE Leap the opportunity to
+# sync up again.
+# Thus, OpenSuSE Leap 42 will be followed by OpenSuSE Leap 15.
+# Great idea! What could possibly go wrong?
+# We'll undo this madness internally and just map OpenSuSE Leap 42 to its more sane
+# major version 14 counterpart instead.
+# Takes the *SuSE major version number.
+# Outputs the mapped major version number.
+wrap_suse_major_version () {
+	typeset -i major_version="${1:?"Error: no *SuSE major version passed to ${FUNCNAME}()."}"
+
+	if [[ "${major_version}" -lt "10" ]]; then
+		echo "Invalid OpenSuSE major version number, might not be less than 10."
+		return "1"
+	fi
+
+	if [[ "${major_version}" -eq "42" ]]; then
+		major_version="14"
+	fi
+
+	echo "${major_version}"
+
+	return "0"
+}
+
 prepare_workspace() {
 	# make sure our local working copy is up to date...
 	if [ -d "${PROJECT_DIR}/.git" ]; then
@@ -855,8 +896,16 @@ build_packages() {
 
 					if [ "x${l_DIST}" = "xopensuse" ]; then
 						typeset -i legacy_release="0"
-						if [ "${tmp_suse_major_version}" -lt "42" ] ||
-						   ( [ "${tmp_suse_major_version}" -eq "42" ] && [ "${tmp_suse_minor_version}" -lt "2" ] ); then
+
+						tmp_suse_major_version="$(wrap_suse_major_version "${tmp_suse_major_version}")"
+
+						if [ "${?}" -ne "0" ]; then
+							echo "Unable to map OpenSuSE version number to a sane value."
+							exit "1"
+						fi
+
+						if [ "${tmp_suse_major_version}" -lt "14" ] ||
+						   ( [ "${tmp_suse_major_version}" -eq "14" ] && [ "${tmp_suse_minor_version}" -lt "2" ] ); then
 							legacy_release="1"
 						fi
 

--
Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git


More information about the x2go-commits mailing list