[X2Go-Commits] [buildscripts] 03/03: bin/sbuild-deb-package: handle ppc64 arches in a smarter way.
git-admin at x2go.org
git-admin at x2go.org
Thu Nov 30 05:19:42 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 283d73a7f2b06a3b77c77066987c5a83aea1f702
Author: Mihai Moldovan <ionic at ionic.de>
Date: Thu Nov 30 05:10:31 2017 +0100
bin/sbuild-deb-package: handle ppc64 arches in a smarter way.
Only add arches to array if supported by the underlying codename.
---
bin/sbuild-deb-package | 122 +++++++++++++++++++++++++++++++++++++++----------
1 file changed, 99 insertions(+), 23 deletions(-)
diff --git a/bin/sbuild-deb-package b/bin/sbuild-deb-package
index fcf9a3f..223a699 100755
--- a/bin/sbuild-deb-package
+++ b/bin/sbuild-deb-package
@@ -136,6 +136,37 @@ set_vars() {
return 0
}
+# Maps a codename to a numerical version.
+# Takes the distribution name and the codename.
+# Outputs the numerical version or an empty string.
+# Returns either 0 on mapping success or non-0 otherwise.
+map_codename_to_numerical_version() {
+ typeset dist="${1:?"Error: no distribution name passed to ${FUNCNAME}()."}"
+ typeset codename_in="${2:?"Error: no codename passed to ${FUNCNAME}()."}"
+
+ if [ -n "${BASH_VERSINFO[0]}" ] && [ "${BASH_VERSINFO[0]}" -gt "3" ]; then
+ typeset -l codename="${codename_in}"
+ else
+ typeset codename="$(tr '[:upper:]' '[:lower:]' <<< "${codename_in}")"
+ fi
+
+ # Translate the version name for Debian releases.
+ [ "${codename}" = "sid" ] && codename="unstable"
+
+ typeset numerical_version=""
+ typeset -i ret="1"
+
+ if [ "${dist}" = "debian" ] || [ "${dist}" = "raspbian" ]; then
+ numerical_version="$("debian-codename-to-version.sh" "${codename}")"
+ ret="${?}"
+ elif [ "${dist}" = "ubuntu" ]; then
+ numerical_version="$("ubuntu-codename-to-version.sh" "${codename}")"
+ ret="${?}"
+ fi
+
+ return "${ret}"
+}
+
prepare_workspace() {
# make sure our local working copy is up to date...
if [ -d "${PROJECT_DIR}/.git" ]; then
@@ -202,6 +233,25 @@ clear_pkgdist() {
# the wrong distribution here...
test -z "${CODENAMES}" || grep "${CODENAMES}" <<< "${line}" || break
+ typeset numerical_version=""
+ typeset pretty_dist=""
+ typeset -i tmp_ret="1"
+ numerical_version="$("map_codename_to_numerical_version" "${l_DIST}" "${l_CODENAME}")"
+ tmp_ret="${?}"
+
+ if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "debian" ] || [ "${l_DIST}" = "raspbian" ]; then
+ pretty_dist="Debian"
+ fi
+
+ if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "ubuntu" ]; then
+ pretty_dist="Ubuntu"
+ fi
+
+ if [ "${tmp_ret}" -ne "0" ] || [ -z "${numerical_version}" ]; then
+ echo "Error: unable to map code name \"${l_CODENAME}\" to Debian or Ubuntu numerical versions. Unknown code name or not applicable to distribution \"${pretty_dist}\"? Aborting." >&2
+ exit "1"
+ fi
+
typeset -a arches
arches=()
case "${PLATFORM}" in
@@ -209,10 +259,16 @@ clear_pkgdist() {
arches+=( "amd64" "i386" )
;;
("ppc64")
- arches+=( "powerpc" "ppc64" )
+ # Only jessie and below support the legacy powerpc architecture.
+ [[ "${numerical_version}" -le "8" ]] && arches+=( "powerpc" )
+
+ # Currently, only unstable supports the new ppc64 architecture.
+ # Needs adaptation once it hits a testing or stable version.
+ [[ "${numerical_version}" -gt "10" ]] && arches+=( "ppc64" )
;;
("ppc64le")
- arches+=( "ppc64el" )
+ # Only jessie and up support the new ppc64el architecture.
+ [[ "${numerical_version}" -ge "8" ]] && arches+=( "ppc64el" )
;;
esac
@@ -279,38 +335,32 @@ build_packages() {
} || echo "1.0" > "debian/source/format"
}
- # for Ubuntu version is the codename of the distribution release
if [ -n "${BASH_VERSINFO[0]}" ] && [ "${BASH_VERSINFO[0]}" -gt 3 ]; then
typeset -l codename="${l_CODENAME}"
else
typeset codename="$(tr '[:upper:]' '[:lower:]' <<< "${l_CODENAME}")"
fi
- # translate the version name for Debian releases
- [ "x${l_CODENAME}" = "xsid" ] && codename="unstable"
- #[ "x$l_CODENAME" = "xjessie" ] && codename=testing
- #[ "x$l_CODENAME" = "xwheezy" ] && codename=stable
- #[ "x$l_CODENAME" = "xoldstable" ] && codename=oldstable
+ # Translate the version name for Debian releases.
+ [ "${codename}" = "sid" ] && codename="unstable"
typeset numerical_version=""
- typeset -i tmp_ret="1"
typeset pretty_dist=""
+ typeset -i tmp_ret="1"
+ numerical_version="$("map_codename_to_numerical_version" "${l_DIST}" "${codename}")"
+ tmp_ret="${?}"
if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "debian" ] || [ "${l_DIST}" = "raspbian" ]; then
pretty_dist="Debian"
- numerical_version="$("debian-codename-to-version.sh" "${codename}")"
- tmp_ret="${?}"
fi
if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "ubuntu" ]; then
pretty_dist="Ubuntu"
- numerical_version="$("ubuntu-codename-to-version.sh" "${codename}")"
- tmp_ret="${?}"
fi
if [ "${tmp_ret}" -ne "0" ] || [ -z "${numerical_version}" ]; then
echo "Error: unable to map code name \"${codename}\" to Debian or Ubuntu numerical versions. Unknown code name or not applicable to distribution \"${pretty_dist}\"? Aborting." >&2
- exit 1
+ exit "1"
fi
# modify the section for non-release package builds
@@ -339,12 +389,18 @@ build_packages() {
# will already be built by our x86_64 builder.
skip_arch_all="1"
- arches+=( "powerpc" "ppc64" )
+ # Only jessie and below support the legacy powerpc architecture.
+ [[ "${numerical_version}" -le "8" ]] && arches+=( "powerpc" )
+
+ # Currently, only unstable supports the new ppc64 architecture.
+ # Needs adaptation once it hits a testing or stable version.
+ [[ "${numerical_version}" -gt "10" ]] && arches+=( "ppc64" )
;;
("ppc64le")
skip_arch_all="1"
- arches+=( "ppc64el" )
+ # Only jessie and up support the new ppc64el architecture.
+ [[ "${numerical_version}" -ge "8" ]] && arches+=( "ppc64el" )
;;
esac
@@ -422,11 +478,6 @@ build_packages() {
fi
base_arch="${arches[1]}"
- # Clear out the ppc64 arch if not building against unstable to skip this part.
- # Refer to the first arches comment regarding this.
- if [[ "${base_arch}" = "ppc64" ]] && [[ "${codename}" != "unstable" ]]; then
- base_arch=""
- fi
[ -n "${base_arch}" ] && [ "x${SKIP_ARCH}" != "x${base_arch}" ] && grep -Eqs "Architecture.*(any|${base_arch})" "${TEMP_DIR}/${PROJECT}/debian/control" && {
typeset indirect="sbuild_options_${base_arch}[@]"
typeset -a indirect_resolve
@@ -463,6 +514,25 @@ upload_packages() {
# the wrong distribution here...
test -z "${CODENAMES}" || grep "${CODENAMES}" <<< "${line}" || break
+ typeset numerical_version=""
+ typeset pretty_dist=""
+ typeset -i tmp_ret="1"
+ numerical_version="$("map_codename_to_numerical_version" "${l_DIST}" "${l_CODENAME}")"
+ tmp_ret="${?}"
+
+ if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "debian" ] || [ "${l_DIST}" = "raspbian" ]; then
+ pretty_dist="Debian"
+ fi
+
+ if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "ubuntu" ]; then
+ pretty_dist="Ubuntu"
+ fi
+
+ if [ "${tmp_ret}" -ne "0" ] || [ -z "${numerical_version}" ]; then
+ echo "Error: unable to map code name \"${l_CODENAME}\" to Debian or Ubuntu numerical versions. Unknown code name or not applicable to distribution \"${pretty_dist}\"? Aborting." >&2
+ exit "1"
+ fi
+
typeset -a arches
arches=()
case "${PLATFORM}" in
@@ -470,10 +540,16 @@ upload_packages() {
arches+=( "amd64" "i386" )
;;
("ppc64")
- arches+=( "powerpc" "ppc64" )
+ # Only jessie and below support the legacy powerpc architecture.
+ [[ "${numerical_version}" -le "8" ]] && arches+=( "powerpc" )
+
+ # Currently, only unstable supports the new ppc64 architecture.
+ # Needs adaptation once it hits a testing or stable version.
+ [[ "${numerical_version}" -gt "10" ]] && arches+=( "ppc64" )
;;
("ppc64le")
- arches+=( "ppc64el" )
+ # Only jessie and up support the new ppc64el architecture.
+ [[ "${numerical_version}" -ge "8" ]] && arches+=( "ppc64el" )
;;
esac
--
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