[X2Go-Commits] [buildscripts] 06/07: bin/build-rpm-package: add support for OpenSuSE Tumbleweed.

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 c119e8ac9f9787ed2ab041a4e568f45af854f15c
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Nov 16 01:24:11 2017 +0100

    bin/build-rpm-package: add support for OpenSuSE Tumbleweed.
---
 bin/build-rpm-package | 136 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 83 insertions(+), 53 deletions(-)

diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index b05fa26..82c8e17 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -45,6 +45,7 @@ PACKAGES_WITHOUT_OTHERMIRROR="keyring"
 GNUPGHOME="${HOME}/.gnupg"
 
 OPENSUSE_DOWNLOAD_URL="https://download.opensuse.org/distribution/#LEAP##VERSION#/repo/oss/suse/"
+OPENSUSE_DOWNLOAD_TUMBLEWEED_URL="https://download.opensuse.org/tumbleweed/repo/oss/suse/"
 OPENSUSE_DOWNLOAD_ARCHIVE_URL="https://ftp.gwdg.de/pub/opensuse/discontinued/distribution/#LEAP##VERSION#/repo/oss/suse/"
 SLE_DOWNLOAD_URL="/srv/mirrors/non-public/sle/#VERSION#/rpms/"
 
@@ -585,21 +586,26 @@ sign_packages () {
 	if [ "${dist}" = "opensuse" ] || [ "${dist}" = "sle" ]; then
 		typeset -i tmp_suse_major_version="0"
 		typeset -i tmp_suse_minor_version="0"
-		tmp_suse_major_version="$(get_generic_major_version "${codename}")"
+		if [[ "${codename}" = "tumbleweed" ]]; then
+			# Fake the version for tumbleweed builds.
+			tmp_suse_major_version="tumbleweed"
+		else
+			tmp_suse_major_version="$(get_generic_major_version "${codename}")"
 
-		if [ "${?}" -ne "0" ]; then
-			echo "Unable to extract SUSE version."
-			exit "1"
-		fi
+			if [ "${?}" -ne "0" ]; then
+				echo "Unable to extract SUSE version."
+				exit "1"
+			fi
 
-		tmp_suse_minor_version="$(get_generic_minor_version "${codename}")"
+			tmp_suse_minor_version="$(get_generic_minor_version "${codename}")"
 
-		if [ "${?}" -ne "0" ]; then
-			echo "Unable to extract minor SUSE version."
-			exit "1"
-		fi
+			if [ "${?}" -ne "0" ]; then
+				echo "Unable to extract minor SUSE version."
+				exit "1"
+			fi
 
-		[ "${tmp_suse_major_version}" -lt "12" ] && gpg_sign_with="${GPG_KEY_EPEL5}"
+			[ "${tmp_suse_major_version}" -lt "12" ] && gpg_sign_with="${GPG_KEY_EPEL5}"
+		fi
 	fi
 
 	typeset rpmmacro_v3sign="%__gpg_sign_cmd %{__gpg} /usr/bin/gpg --force-v3-sigs --digest-algo=sha1 --batch --no-verbose --no-armor --passphrase-fd 3 --no-secmem-warning -u \"%{_gpg_name}\" -sbo %{__signature_filename} %{__plaintext_filename}"
@@ -651,18 +657,24 @@ sign_packages () {
 # 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.
+# Takes the *SuSE major version number or a code name.
+# Outputs the mapped major version number or a code name.
 wrap_suse_major_version () {
-	typeset -i major_version="${1:?"Error: no *SuSE major version passed to ${FUNCNAME}()."}"
+	typeset 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
+	# Pass special code name "tumbleweed" right through.
+	if [[ "${major_version}" != "tumbleweed" ]]; then
+		# For any code name differently from "tumbleweed", we assume an integer-based version number.
+		typeset -i tmp_major_version="${major_version}"
+
+		if [[ "${tmp_major_version}" -lt "10" ]]; then
+			echo "Invalid OpenSuSE major version number (${tmp_major_version}), might not be less than 10."
+			return "1"
+		fi
 
-	if [[ "${major_version}" -eq "42" ]]; then
-		major_version="14"
+		if [[ "${major_version}" -eq "42" ]]; then
+			major_version="14"
+		fi
 	fi
 
 	echo "${major_version}"
@@ -878,18 +890,23 @@ build_packages() {
 
 					typeset -i tmp_suse_major_version="0"
 					typeset -i tmp_suse_minor_version="0"
-					tmp_suse_major_version="$(get_generic_major_version "${l_CODENAME}")"
+					if [[ "${l_CODENAME}" = "tumbleweed" ]]; then
+						# Fake the version for tumbleweed builds.
+						tmp_suse_major_version="tumbleweed"
+					else
+						tmp_suse_major_version="$(get_generic_major_version "${l_CODENAME}")"
 
-					if [ "${?}" -ne "0" ]; then
-						echo "Unable to extract SUSE version."
-						exit "1"
-					fi
+						if [ "${?}" -ne "0" ]; then
+							echo "Unable to extract SUSE version."
+							exit "1"
+						fi
 
-					tmp_suse_minor_version="$(get_generic_minor_version "${l_CODENAME}")"
+						tmp_suse_minor_version="$(get_generic_minor_version "${l_CODENAME}")"
 
-					if [ "${?}" -ne "0" ]; then
-						echo "Unable to extract minor SUSE version."
-						exit "1"
+						if [ "${?}" -ne "0" ]; then
+							echo "Unable to extract minor SUSE version."
+							exit "1"
+						fi
 					fi
 
 					if [ "x${l_DIST}" = "xopensuse" ]; then
@@ -902,23 +919,31 @@ build_packages() {
 							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"
+						if [[ "${tmp_suse_major_version}" != "tumbleweed" ]]; then
+							if [ "${tmp_suse_major_version}" -lt "14" ] ||
+							   ( [ "${tmp_suse_major_version}" -eq "14" ] && [ "${tmp_suse_minor_version}" -lt "2" ] ); then
+								legacy_release="1"
+							fi
 						fi
 
 						if [ "${legacy_release}" -eq "1" ]; then
 							DOWNLOAD_URL="${OPENSUSE_DOWNLOAD_ARCHIVE_URL}"
 						else
-							DOWNLOAD_URL="${OPENSUSE_DOWNLOAD_URL}"
+							if [[ "${tmp_suse_major_version}" = "tumbleweed" ]]; then
+								DOWNLOAD_URL="${OPENSUSE_DOWNLOAD_TUMBLEWEED_URL}"
+							else
+								DOWNLOAD_URL="${OPENSUSE_DOWNLOAD_URL}"
+							fi
 						fi
 
 						DOWNLOAD_URL="$(sed -e "s/#VERSION#/${l_CODENAME}/" <<< "${DOWNLOAD_URL}")"
 
-						if [ "${tmp_suse_major_version}" -gt "13" ]; then
-							DOWNLOAD_URL="$(sed -e 's_#LEAP#_leap/_' <<< "${DOWNLOAD_URL}")"
-						else
-							DOWNLOAD_URL="$(sed -e 's_#LEAP#__' <<< "${DOWNLOAD_URL}")"
+						if [[ "${tmp_suse_major_version}" != "tumbleweed" ]]; then
+							if [ "${tmp_suse_major_version}" -gt "13" ]; then
+								DOWNLOAD_URL="$(sed -e 's_#LEAP#_leap/_' <<< "${DOWNLOAD_URL}")"
+							else
+								DOWNLOAD_URL="$(sed -e 's_#LEAP#__' <<< "${DOWNLOAD_URL}")"
+							fi
 						fi
 					elif [ "x${l_DIST}" = "xsle" ]; then
 						DOWNLOAD_URL="$(sed "s/#VERSION#/${l_CODENAME}/" <<< "${SLE_DOWNLOAD_URL}")"
@@ -1173,28 +1198,33 @@ upload_packages() {
 
 					typeset -i tmp_suse_major_version="0"
 					typeset -i tmp_suse_minor_version="0"
-					tmp_suse_major_version="$(get_generic_major_version "${l_CODENAME}")"
+					if [[ "${l_CODENAME}" = "tumbleweed" ]]; then
+						# Fake the version for tumbleweed builds.
+						tmp_suse_major_version="tumbleweed"
+					else
+						tmp_suse_major_version="$(get_generic_major_version "${l_CODENAME}")"
 
-					if [ "${?}" -ne "0" ]; then
-						echo "Unable to extract major SUSE version."
-						exit "1"
-					fi
+						if [ "${?}" -ne "0" ]; then
+							echo "Unable to extract major SUSE version."
+							exit "1"
+						fi
 
-					tmp_suse_minor_version="$(get_generic_minor_version "${l_CODENAME}")"
+						tmp_suse_minor_version="$(get_generic_minor_version "${l_CODENAME}")"
 
-					if [ "${?}" -ne "0" ]; then
-						echo "Unable to extract minor SUSE version."
-						exit "1"
-					fi
+						if [ "${?}" -ne "0" ]; then
+							echo "Unable to extract minor SUSE version."
+							exit "1"
+						fi
 
-					[ "${tmp_suse_major_version}" -lt "12" ] && gpg_sign_with="${GPG_KEY_EPEL5}"
+						[ "${tmp_suse_major_version}" -lt "12" ] && gpg_sign_with="${GPG_KEY_EPEL5}"
 
-					[ "${tmp_suse_major_version}" -gt "13" ] && distro_string="${distro_string}Leap:"
-					distro_string="${distro_string}${l_CODENAME}"
+						[ "${tmp_suse_major_version}" -gt "13" ] && distro_string="${distro_string}Leap:"
+						distro_string="${distro_string}${l_CODENAME}"
 
-					# 11.1 and below only support SHA1 checksums (or at least the upstream repositories exclusively use SHA1 checksums.)
-					if [ "${tmp_suse_major_version}" -lt "11" ] || { [ "${tmp_suse_major_version}" -eq "11" ] && [ "${tmp_suse_minor_version}" -le "1" ]; }; then
-						use_sha256="0"
+						# 11.1 and below only support SHA1 checksums (or at least the upstream repositories exclusively use SHA1 checksums.)
+						if [ "${tmp_suse_major_version}" -lt "11" ] || { [ "${tmp_suse_major_version}" -eq "11" ] && [ "${tmp_suse_minor_version}" -le "1" ]; }; then
+							use_sha256="0"
+						fi
 					fi
 				else
 					distro_string="SLE:"

--
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