summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-07-07 12:59:47 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-07-07 12:59:47 +0200
commit696afc5f7bdfd73ca3b10f02bef43ca87a2f4b4b (patch)
tree10d02fbc37e883880b2471eb25658fe6cf315b22 /bin
parentb530ac9fd1509e9da2f995473c92265c4c9c0c79 (diff)
parent9b98ace894ac4641e789dd04637aa52b58d3c177 (diff)
downloadbuildscripts-696afc5f7bdfd73ca3b10f02bef43ca87a2f4b4b.tar.gz
buildscripts-696afc5f7bdfd73ca3b10f02bef43ca87a2f4b4b.tar.bz2
buildscripts-696afc5f7bdfd73ca3b10f02bef43ca87a2f4b4b.zip
Merge branch 'Ionic-bugfix/debian-and-ubuntu-code-names-in-version-string' into arctica-builder
Attributes GH PR #1: https://github.com/ArcticaProject/buildscripts/pull/1
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-deb-package2
-rwxr-xr-xbin/debian-codename-to-version.sh90
-rwxr-xr-xbin/sbuild-deb-package68
-rwxr-xr-xbin/ubuntu-codename-to-version.sh80
4 files changed, 225 insertions, 15 deletions
diff --git a/bin/build-deb-package b/bin/build-deb-package
index 5f1ed5d..e787c69 100755
--- a/bin/build-deb-package
+++ b/bin/build-deb-package
@@ -274,7 +274,7 @@ build_packages() {
mkdir -p -- "${PKGDIST}/${l_DIST}/${l_CODENAME}/"{amd64,i386}
OTHERMIRROR=""
if [ "x${COMPONENT}" = "x${COMPONENT_NIGHTLY}" ]; then
- grep -qs "${PROJECT}" <<< "${PACKAGE_WITHOUT_OTHERMIRROR}" || OTHERMIRROR="deb http://${REPOS_SERVER}/${l_DIST}-nightly ${l_CODENAME} ${COMPONENT_MAIN} ${COMPONENT}"
+ grep -qs "${PROJECT}" <<< "${PACKAGE_WITHOUT_OTHERMIRROR}" || OTHERMIRROR="deb http://${REPOS_SERVER}/${l_DIST}-nightly ${l_CODENAME} ${COMPONENT_MAIN}"
else
grep "${PROJECT}" <<< "${PACKAGE_WITHOUT_OTHERMIRROR}" || OTHERMIRROR="deb http://${REPOS_SERVER}/${l_DIST} ${l_CODENAME} ${COMPONENT}"
fi
diff --git a/bin/debian-codename-to-version.sh b/bin/debian-codename-to-version.sh
new file mode 100755
index 0000000..42f497b
--- /dev/null
+++ b/bin/debian-codename-to-version.sh
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+# Copyright (C) 2016 by Mihai Moldovan <ionic@ionic.de>
+#
+# This programme is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This programme is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+export PATH="${HOME}/bin:${PATH}"
+
+# ${CDPATH} could lead to some very nasty problems. Better unset it.
+unset CDPATH
+
+# Takes a Debian code name and converts it into the
+# corresponding numerical version (based on year and month
+# of the release.)
+# The result is printed as a string with a trailing newline.
+# The return code is either 0, iff mapping was successful,
+# or 1 if the code name is unknown and mapping failed.
+
+# Where supported (BASH 4 and higher), automatically
+# lower-case the codename argument.
+if [ -n "${BASH_VERSINFO[0]}" ] && [ "${BASH_VERSINFO[0]}" -gt 3 ]; then
+ typeset -l codename
+fi
+codename="${1:?"No code name provided."}"
+
+if [ -z "${BASH_VERSINFO[0]}" ] || [ "${BASH_VERSINFO[0]}" -lt 4 ]; then
+ codename="$(tr '[:upper:]' '[:lower:]' <<< "${codename}")"
+fi
+
+typeset -i ret="0"
+
+case "${codename}" in
+ # The first version number is actually "fake",
+ # but given it's a rolling release,
+ # we can't really do better here.
+ ("sid"|"unstable") echo "9999";;
+
+ # FIXME: add "testing" - but how? It's not really
+ # a stable release on its own, but a rolling
+ # release (see sid/unstable above). Yet, it differs
+ # from sid/unstable by not having one unique
+ # code name, but a floating one of the next
+ # stable release. We know the new release number
+ # beforehand, but mapping "testing" to the
+ # upcoming version number means that "testing"s
+ # version number itself would be floating, creating
+ # problems after each new release and requiring an
+ # update. On the other hand, giving "testing" a
+ # fixed version number such as "999" (smaller than
+ # "unstable"s, yet bigger than anything we encountered
+ # so far) would create an inconsistency:
+ # The "testing" code name would have a different
+ # version number than the code-name-to-be-released-
+ # next.
+ # For now and due to the aforementioned problems,
+ # I decided to not handle the "testing" code name
+ # at all.
+ ("stretch") echo "9";;
+
+ ("jessie") echo "8";;
+ ("wheezy") echo "7";;
+ ("squeeze") echo "6";;
+ ("lenny") echo "5";;
+ ("etch") echo "4";;
+ ("sarge") echo "3.1";;
+ ("woody") echo "3.0";;
+ ("potato") echo "2.2";;
+ ("slink") echo "2.1";;
+ ("hamm") echo "2.0";;
+ ("bo") echo "1.3";;
+ ("rex") echo "1.2";;
+ ("buzz") echo "1.1";;
+
+ (*) ret="1";;
+esac
+
+exit "${ret}"
diff --git a/bin/sbuild-deb-package b/bin/sbuild-deb-package
index 9e66850..84f43ad 100755
--- a/bin/sbuild-deb-package
+++ b/bin/sbuild-deb-package
@@ -233,13 +233,38 @@ build_packages() {
}
# for Ubuntu version is the codename of the distribution release
- VERSION="${l_CODENAME}"
+ 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" ] && VERSION="unstable"
- #[ "x$l_CODENAME" = "xjessie" ] && VERSION=testing
- #[ "x$l_CODENAME" = "xwheezy" ] && VERSION=stable
- #[ "x$l_CODENAME" = "xoldstable" ] && VERSION=oldstable
+ [ "x${l_CODENAME}" = "xsid" ] && codename="unstable"
+ #[ "x$l_CODENAME" = "xjessie" ] && codename=testing
+ #[ "x$l_CODENAME" = "xwheezy" ] && codename=stable
+ #[ "x$l_CODENAME" = "xoldstable" ] && codename=oldstable
+
+ typeset numerical_version=""
+ typeset -i tmp_ret="1"
+ typeset pretty_dist=""
+
+ if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "debian" ]; then
+ pretty_dist="Debian"
+ numerical_version="$("${script_path}/debian-codename-to-version.sh" "${codename}")"
+ tmp_ret="${?}"
+ fi
+
+ if [ -n "${l_DIST}" ] && [ "${l_DIST}" = "ubuntu" ]; then
+ pretty_dist="Ubuntu"
+ numerical_version="$("${script_path}/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 \"${dist_pretty}\"? Aborting." >&2
+ exit 1
+ fi
# modify the section for non-main package builds
[ "x${COMPONENT}" != "xmain" ] && {
@@ -249,34 +274,45 @@ build_packages() {
# modify changelog for this build
if [ "${COMPONENT}" != "${COMPONENT_NIGHTLY}" ]; then
- dch --distribution "${VERSION}" --force-distribution -l "+git${DATE}.${GITREV}+${l_CODENAME}.${COMPONENT}." "Auto-built ${l_DIST} ${l_CODENAME} package for ${REPOS_SERVER} repository (Git commit: ${GIT_OBJECT_ID})."
+ dch --distribution "${codename}" --force-distribution -l "+git${DATE}.${GITREV}+${numerical_version}.${COMPONENT}." "Auto-built ${pretty_dist} ${l_CODENAME} package for ${REPOS_SERVER} repository (Git commit: ${GIT_OBJECT_ID})."
else
- dch --distribution "${VERSION}" --force-distribution -l "~git${DATE}.${GITREV}+${l_CODENAME}.${COMPONENT}." "Development-Snapshot!!! Auto-built ${l_DIST} ${l_CODENAME} package for ${REPOS_SERVER} repository (Git commit: ${GIT_OBJECT_ID})."
+ dch --distribution "${codename}" --force-distribution -l "~git${DATE}.${GITREV}+${numerical_version}.${COMPONENT}." "Development-Snapshot!!! Auto-built ${pretty_dist} ${l_CODENAME} package for ${REPOS_SERVER} repository (Git commit: ${GIT_OBJECT_ID})."
fi
mkdir -p -- "${PKGDIST}/${l_DIST}/${l_CODENAME}/"{amd64,i386}
OTHERMIRROR=""
if [ "x${COMPONENT}" = "x${COMPONENT_NIGHTLY}" ]; then
- grep -qs "${PROJECT}" <<< "${PACKAGE_WITHOUT_OTHERMIRROR}" || OTHERMIRROR="--extra-repository=\"deb http://${REPOS_SERVER}/${l_DIST}-nightly ${l_CODENAME} ${COMPONENT_MAIN} ${COMPONENT}\""
+ grep -qs "${PROJECT}" <<< "${PACKAGE_WITHOUT_OTHERMIRROR}" || OTHERMIRROR="deb http://${REPOS_SERVER}/${l_DIST}-nightly ${l_CODENAME} ${COMPONENT_MAIN}"
else
- grep "${PROJECT}" <<< "${PACKAGE_WITHOUT_OTHERMIRROR}" || OTHERMIRROR="--extra-repository=\"deb http://${REPOS_SERVER}/${l_DIST} ${l_CODENAME} ${COMPONENT}\""
+ grep "${PROJECT}" <<< "${PACKAGE_WITHOUT_OTHERMIRROR}" || OTHERMIRROR="deb http://${REPOS_SERVER}/${l_DIST} ${l_CODENAME} ${COMPONENT}"
fi
# create git changelog immediately prior to building the package
git --no-pager log --since "2 years ago" --format="%ai %aN (%h) %n%n%x09*%w(68,0,10) %s%d%n" > ChangeLog
# build the source package
- dpkg-buildpackage -uc -us -S
+ dpkg-buildpackage -uc -us -S -d
cd ..
DSCFILE="$(pwd)/$(ls -1 "${PROJECT}_"*.dsc | head -n1)"
+ SBUILD_OPTIONS="-n -j2 -sAd ${codename} -k ${GPG_KEY} --build-dep-resolver=aptitude"
+ SBUILD_OPTIONS_64="${SBUILD_OPTIONS} -c arctica-${l_CODENAME}"
+ SBUILD_OPTIONS_32="${SBUILD_OPTIONS} -c arctica-${l_CODENAME}-i386 --arch=i386 --debbuildopts=-B"
+ if [ -n "${SA_OPTION}" ]; then
+ SBUILD_OPTIONS_64=${SBUILD_OPTIONS}" ${SA_OPTION}"
+ fi
+
[ "x${SKIP_ARCH}" != "xamd64" ] && grep -Eqs 'Architecture.*(all|any|amd64)' "${TEMP_DIR}/${PROJECT}/debian/control" && {
cd "${PKGDIST}/${l_DIST}/${l_CODENAME}/amd64"
tac ${DSCFILE} | while read line; do
if echo $line | grep -E "^Files:" 1>/dev/null; then break; fi
# each line contains a file that is part of the src:package
filename="$(echo $line | cut -d" " -f3-)"
- cp "${TEMP_DIR}/${filename}" .
+ if [ -n "$filename" ]; then cp "${TEMP_DIR}/${filename}" .; fi
done
- nice ${SBUILD} -j2 -sAd "${VERSION}" -k "${GPG_KEY}" -c "arctica-${l_CODENAME}" ${OTHERMIRROR} ${SA_OPTION} "${DSCFILE}"
+ if [ -z "${OTHERMIRROR}" ]; then
+ nice ${SBUILD} ${SBUILD_OPTIONS_64} "${DSCFILE}"
+ else
+ nice ${SBUILD} ${SBUILD_OPTIONS_64} --extra-repository="${OTHERMIRROR}" "${DSCFILE}"
+ fi
}
[ "x${SKIP_ARCH}" != "xi386" ] && grep -Eqs 'Architecture.*(any|i386)' "${TEMP_DIR}/${PROJECT}/debian/control" && {
cd "${PKGDIST}/${l_DIST}/${l_CODENAME}/i386"
@@ -284,9 +320,13 @@ build_packages() {
if echo $line | grep -E "^Files:" 1>/dev/null; then break; fi
# each line contains a file that is part of the src:package
filename="$(echo $line | cut -d" " -f3-)"
- cp "${TEMP_DIR}/${filename}" .
+ if [ -n "$filename" ]; then cp "${TEMP_DIR}/${filename}" .; fi
done
- nice ${SBUILD} -j2 -sAd "${VERSION}" -k "${GPG_KEY}" -c "arctica-${l_CODENAME}-i386" ${OTHERMIRROR} --arch=i386 --debbuildopts="-B" "${DSCFILE}"
+ if [ -z "${OTHERMIRROR}" ]; then
+ nice ${SBUILD} ${SBUILD_OPTIONS_32} "${DSCFILE}"
+ else
+ nice ${SBUILD} ${SBUILD_OPTIONS_32} --extra-repository="${OTHERMIRROR}" "${DSCFILE}"
+ fi
}
done
}
diff --git a/bin/ubuntu-codename-to-version.sh b/bin/ubuntu-codename-to-version.sh
new file mode 100755
index 0000000..f2884cf
--- /dev/null
+++ b/bin/ubuntu-codename-to-version.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+# Copyright (C) 2016 by Mihai Moldovan <ionic@ionic.de>
+#
+# This programme is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This programme is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+export PATH="${HOME}/bin:${PATH}"
+
+# ${CDPATH} could lead to some very nasty problems. Better unset it.
+unset CDPATH
+
+# Takes a Debian code name and converts it into the
+# corresponding numerical version.
+# The result is printed as a string with a trailing newline.
+# The return code is either 0, iff mapping was successful,
+# or 1 if the code name is unknown and mapping failed.
+
+# Where supported (BASH 4 and higher), automatically
+# lower-case the codename argument.
+if [ -n "${BASH_VERSINFO[0]}" ] && [ "${BASH_VERSINFO[0]}" -gt 3 ]; then
+ typeset -l codename
+fi
+codename="${1:?"No code name provided."}"
+
+if [ -z "${BASH_VERSINFO[0]}" ] || [ "${BASH_VERSINFO[0]}" -lt 4 ]; then
+ codename="$(tr '[:upper:]' '[:lower:]' <<< "${codename}")"
+fi
+
+typeset -i ret="0"
+
+case "${codename}" in
+ # The first version number is actually "fake",
+ # but given it's a rolling release,
+ # we can't really do better here.
+ ("devel") echo "9999";;
+
+ ("yakkety") echo "16.10";;
+
+ ("xenial") echo "16.04";;
+ ("wily") echo "15.10";;
+ ("vivid") echo "15.04";;
+ ("utopic") echo "14.10";;
+ ("trusty") echo "14.04";;
+ ("saucy") echo "13.10";;
+ ("raring") echo "13.04";;
+ ("precise") echo "12.04";;
+ ("quantal") echo "12.10";;
+ ("oneiric") echo "11.10";;
+ ("natty") echo "11.04";;
+ ("maverick") echo "10.10";;
+ ("lucid") echo "10.04";;
+ ("karmic") echo "9.10";;
+ ("jaunty") echo "9.04";;
+ ("intrepid") echo "8.10";;
+ ("hardy") echo "8.04";;
+ ("gutsy") echo "7.10";;
+ ("feisty") echo "7.04";;
+ ("edgy") echo "6.10";;
+ ("dapper") echo "6.06";;
+ ("breezy") echo "5.10";;
+ ("hoary") echo "5.04";;
+ ("warty") echo "4.10";;
+
+ (*) ret="1";;
+esac
+
+exit "${ret}"