[X2Go-Commits] [buildscripts] 01/01: bin/build-rpm-package: fix array subscripts, they must not contain single quotes (and even double quotes are a bad idea in arithmetic contexts).

git-admin at x2go.org git-admin at x2go.org
Wed Feb 22 08:24:42 CET 2023


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

x2go pushed a commit to branch master
in repository buildscripts.

commit c29d56a09acb043b297e9496d9bfe0ec159be1c8
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Feb 22 08:24:39 2023 +0100

    bin/build-rpm-package: fix array subscripts, they must not contain single quotes (and even double quotes are a bad idea in arithmetic contexts).
---
 bin/build-rpm-package | 62 +++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index b61bbb8..87666fe 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -189,9 +189,9 @@ set_vars() {
 # Returns 0 if the mock version is greater or equal the specified input,
 # 1 otherwise.
 check_mock_version_atleast () {
-	typeset MAJOR="${1:?"Error: no major version passed to ${FUNCNAME['0']}()."}"
-	typeset MINOR="${2:?"Error: no minor version passed to ${FUNCNAME['0']}()."}"
-	typeset PATCH="${3:?"Error: no patch version passed to ${FUNCNAME['0']}()."}"
+	typeset MAJOR="${1:?"Error: no major version passed to ${FUNCNAME[0]}()."}"
+	typeset MINOR="${2:?"Error: no minor version passed to ${FUNCNAME[0]}()."}"
+	typeset PATCH="${3:?"Error: no patch version passed to ${FUNCNAME[0]}()."}"
 
 	# Check input parameters for sanity.
 	typeset SANITY_CHECK_MAJOR="$(sed -e 's/^\([0-9][0-9]*\)$//' <<< "${MAJOR}")"
@@ -199,7 +199,7 @@ check_mock_version_atleast () {
 	typeset SANITY_CHECK_PATCH="$(sed -e 's/^\([0-9][0-9]*\)$//' <<< "${PATCH}")"
 
 	if [ -n "${SANITY_CHECK_MAJOR}" ] || [ -n "${SANITY_CHECK_MINOR}" ] || [ -n "${SANITY_CHECK_PATCH}" ]; then
-		echo "Error: input parameters of ${FUNCNAME['0']}() are not pure integers and failed sanity check." >&2
+		echo "Error: input parameters of ${FUNCNAME[0]}() are not pure integers and failed sanity check." >&2
 		exit 1
 	fi
 
@@ -213,7 +213,7 @@ check_mock_version_atleast () {
 	MOCK_VER="$(grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' <<< "${MOCK_VER}")"
 
 	if [ -z "${MOCK_VER}" ]; then
-		echo "Error: the reported mock version can not be handled by ${FUNCNAME['0']}()." >&2
+		echo "Error: the reported mock version can not be handled by ${FUNCNAME[0]}()." >&2
 		exit 1
 	fi
 
@@ -226,7 +226,7 @@ check_mock_version_atleast () {
 	typeset MOCK_VER_PATCH="$(sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)/\1/' <<< "${MOCK_VER}")"
 
 	if [ -z "${MOCK_VER_MAJOR}" ] || [ -z "${MOCK_VER_MINOR}" ] || [ -z "${MOCK_VER_PATCH}" ]; then
-		echo "Error: unable to parse mock version in ${FUNCNAME['0']}()." >&2
+		echo "Error: unable to parse mock version in ${FUNCNAME[0]}()." >&2
 		exit 1
 	else
 		typeset ret="1"
@@ -263,10 +263,10 @@ check_mock_version_atleast () {
 # Calling this function in a subshell is an error, as it NEEDS to modify
 # variables in global scope!
 create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET arch
-	typeset MOCK_BASE="${1:?"Error: no mock base config passed to ${FUNCNAME['0']}()."}"
-	typeset COMPONENT="${2:?"Error: no component (X2Go release group) passed to ${FUNCNAME['0']}()."}"
-	typeset TARGET="${3:?"Error: no target (full or base) passed to ${FUNCNAME['0']}()."}"
-	typeset arch="${4:?"Error: no architecture passed to ${FUNCNAME['0']}()."}"
+	typeset MOCK_BASE="${1:?"Error: no mock base config passed to ${FUNCNAME[0]}()."}"
+	typeset COMPONENT="${2:?"Error: no component (X2Go release group) passed to ${FUNCNAME[0]}()."}"
+	typeset TARGET="${3:?"Error: no target (full or base) passed to ${FUNCNAME[0]}()."}"
+	typeset arch="${4:?"Error: no architecture passed to ${FUNCNAME[0]}()."}"
 
 	# Check argument sanity.
 
@@ -515,12 +515,12 @@ cache_mock_config () {
 # Edits either OTHERMIRROR for type == suse or MOCK_CHROOT_CONFIG for type == redhat.
 # It is an error to execute this function in a subshell, as it MUST edit global variables.
 get_extra_repository () {
-	typeset TYPE="${1:?"Error: no type passed to ${FUNCNAME['0']}()."}"
-	typeset DIST="${2:?"Error: no distribution passed to ${FUNCNAME['0']}()."}"
-	typeset CODENAME="${3:?"Error: no codename (distro 'version') passed to ${FUNCNAME['0']}()."}"
-	typeset COMPONENT="${4:?"Error: no component (X2Go release group) passed to ${FUNCNAME['0']}()."}"
-	typeset PACKAGE="${5:?"Error: no package passed to ${FUNCAME['0']}()."}"
-	typeset ARCH="${6:?"Error: no architecture passed to ${FUNCNAME['0']}()."}"
+	typeset TYPE="${1:?"Error: no type passed to ${FUNCNAME[0]}()."}"
+	typeset DIST="${2:?"Error: no distribution passed to ${FUNCNAME[0]}()."}"
+	typeset CODENAME="${3:?"Error: no codename (distro 'version') passed to ${FUNCNAME[0]}()."}"
+	typeset COMPONENT="${4:?"Error: no component (X2Go release group) passed to ${FUNCNAME[0]}()."}"
+	typeset PACKAGE="${5:?"Error: no package passed to ${FUNCAME[0]}()."}"
+	typeset ARCH="${6:?"Error: no architecture passed to ${FUNCNAME[0]}()."}"
 	typeset WANT_EXTRA="$(make_boolean "${7}")"
 
 	# Note: we always add the extras repo, because that's defined as "packages missing from the main repository",
@@ -568,7 +568,7 @@ get_extra_repository () {
 			[ "${MOCK_BUGGY}" -eq "0" ] && MOCK_CHROOT_CONFIG="${MOCK_CHROOT_CONFIG}.cfg"
 			;;
 		*)
-			echo "Error: unknown type passed to ${FUNCNAME['0']}()" >&2
+			echo "Error: unknown type passed to ${FUNCNAME[0]}()" >&2
 			echo "Valid values: suse, redhat." >&2
 			exit 1
 			;;
@@ -581,9 +581,9 @@ get_extra_repository () {
 # Takes the distribution, its version (either a real number or a codename)
 # and the architecture.
 sign_packages () {
-	typeset dist="${1:?"Error: no distribution passed to ${FUNCNAME['0']}()."}"
-	typeset codename="${2:?"Error: no codename (distro 'version') passed to ${FUNCNAME['0']}()."}"
-	typeset arch="${3:?"Error: no architecture passed to ${FUNCNAME['0']}()."}"
+	typeset dist="${1:?"Error: no distribution passed to ${FUNCNAME[0]}()."}"
+	typeset codename="${2:?"Error: no codename (distro 'version') passed to ${FUNCNAME[0]}()."}"
+	typeset arch="${3:?"Error: no architecture passed to ${FUNCNAME[0]}()."}"
 
 	typeset gpg_sign_with="${GPG_KEY}"
 
@@ -666,7 +666,7 @@ sign_packages () {
 # 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 major_version="${1:?"Error: no *SuSE major version passed to ${FUNCNAME['0']}()."}"
+	typeset major_version="${1:?"Error: no *SuSE major version passed to ${FUNCNAME[0]}()."}"
 
 	# tumbleweed has the fictive version number 9999 and should always be getting
 	# passed-through directly.
@@ -689,8 +689,8 @@ wrap_suse_major_version () {
 # Returns success if the passed major and minor OpenSuSE version number is a
 # legacy release, failure otherwise.
 opensuse_is_legacy () {
-	typeset major_version="${1:?"Error: no OpenSuSE major version passed to ${FUNCNAME['0']}()."}"
-	typeset minor_version="${2:?"Error: no OpenSuSE minor version passed to ${FUNCNAME['0']}()."}"
+	typeset major_version="${1:?"Error: no OpenSuSE major version passed to ${FUNCNAME[0]}()."}"
+	typeset minor_version="${2:?"Error: no OpenSuSE minor version passed to ${FUNCNAME[0]}()."}"
 
 	# We're not printing a boolean value, but use the exit code, so the
 	# value must be zero for success (i.e., legacy) and non-zero for
@@ -712,12 +712,12 @@ opensuse_is_legacy () {
 # minor version number.
 # Outputs the generated dist value.
 generate_suse_dist_value () {
-	typeset distname="${1:?"Error: no *SuSE distribution name passed to ${FUNCNAME['0']}()."}"
-	typeset major_version="${2:?"Error: no *SuSE major version passed to ${FUNCNAME['0']}()."}"
-	typeset minor_version="${3:?"Error: no *SuSE minor version passed to ${FUNCNAME['0']}()."}"
+	typeset distname="${1:?"Error: no *SuSE distribution name passed to ${FUNCNAME[0]}()."}"
+	typeset major_version="${2:?"Error: no *SuSE major version passed to ${FUNCNAME[0]}()."}"
+	typeset minor_version="${3:?"Error: no *SuSE minor version passed to ${FUNCNAME[0]}()."}"
 
 	if [ 'sle' != "${distname}" ] && [ 'opensuse' != "${distname}" ]; then
-		printf 'Invalid distribution name '"'"'%s'"'"' passed to %s(), only '"'"'sle'"'"' and '"'"'opensuse'"'"' are supported.' "${distname}" "${FUNCNAME['0']}" >&2
+		printf 'Invalid distribution name '"'"'%s'"'"' passed to %s(), only '"'"'sle'"'"' and '"'"'opensuse'"'"' are supported.' "${distname}" "${FUNCNAME[0]}" >&2
 		return '1'
 	fi
 
@@ -728,7 +728,7 @@ generate_suse_dist_value () {
 
 	if [ '9999' = "${major_version}" ]; then
 		if [ 'opensuse' != "${distname}" ]; then
-			printf 'Invalid major version '"'"'%s'"'"' passed to %s() for distribution name '"'"'%s'"'"', this is unsupported.' "${major_version}" "${FUNCNAME['0']}" "${distname}" >&2
+			printf 'Invalid major version '"'"'%s'"'"' passed to %s() for distribution name '"'"'%s'"'"', this is unsupported.' "${major_version}" "${FUNCNAME[0]}" "${distname}" >&2
 			return '2'
 		fi
 
@@ -747,8 +747,8 @@ generate_suse_dist_value () {
 # obs-build configuration files.
 # Returns 0 on success or non-0 on failure.
 setup_opensuse_tumbleweed_config() {
-	typeset temp_dir="${1:?"Error: no temporary working directory passed to ${FUNCNAME['0']}()."}"
-	typeset obs_config_dir="${2:?"Error: no obs-build configuration subdirectory passed to ${FUNCNAME['0']}()."}"
+	typeset temp_dir="${1:?"Error: no temporary working directory passed to ${FUNCNAME[0]}()."}"
+	typeset obs_config_dir="${2:?"Error: no obs-build configuration subdirectory passed to ${FUNCNAME[0]}()."}"
 
 	typeset obs_factory_prjconf_url="https://api.opensuse.org/public/source/openSUSE:Factory/_config"
 	typeset obs_tumbleweed_prjconf_url="https://api.opensuse.org/public/source/openSUSE:Tumbleweed/_config"
@@ -784,7 +784,7 @@ setup_opensuse_tumbleweed_config() {
 # Takes a prefix string.
 # Returns 0 on success or non-0 on failure.
 map_prefix_to_vendor() {
-	typeset prefix="${1:?"Error: no prefix string passed to ${FUNCNAME['0']}()."}"
+	typeset prefix="${1:?"Error: no prefix string passed to ${FUNCNAME[0]}()."}"
 
 	typeset out=''
 	typeset ret='1'

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


More information about the x2go-commits mailing list