Code cleanup
authorChristoph Berg <myon@debian.org>
Fri, 2 Oct 2015 18:52:39 +0000 (20:52 +0200)
committerChristoph Berg <myon@debian.org>
Fri, 2 Oct 2015 18:55:26 +0000 (20:55 +0200)
jenkins/sbuild-package
jenkins/sbuild-update.sh

index 2503efc9aacb6fdccb2777f8e7c09167f55bbaef..0287b1f945f464eb9c5c1d178699d4a19de9d749 100755 (executable)
@@ -14,6 +14,7 @@
 #  gid sbuild (for sbuild as such and for /var/lock/sbuild-package)
 #  adt-sbuild available in chroot (in pgdg-buildenv package)
 #  /var/tmp bind mount in schroot fstab for retrieving adt-run summary
+#  sbuild needs to pass through DEB_* variables (default)
 # Optional:
 #  newpid installed in chroot
 #  /etc/sbuild/sbuild.conf: $build_env_cmnd = 'newnet';
@@ -25,6 +26,8 @@ error () {
 
 set -eu
 
+chroot="source:$distribution-pgdg-$architecture-sbuild"
+
 # find dsc to build
 PACKAGE="${JOB_NAME%%-binaries*}"
 set -- ${PACKAGE}_*.dsc
@@ -39,8 +42,8 @@ if [ "$architecture" != "amd64" ] && egrep -q '^Architecture: all$' $DSC; then
 fi
 
 # check if chroot exists
-schroot -l | grep -q chroot:$distribution-pgdg-$architecture-sbuild || \
-  error "There is no schroot definition for chroot:$distribution-pgdg-$architecture-sbuild"
+schroot -l | grep -q $chroot || \
+  error "There is no schroot definition for $chroot"
 
 # decide if we should build arch:all packages
 case $architecture in
@@ -55,15 +58,13 @@ case $architecture in
 esac
 
 # prepare temp file for adt-run results
-ADT_SUMMARY=$(mktemp /var/tmp/adt.XXXXXX)
+export DEB_ADT_SUMMARY=$(mktemp /var/tmp/adt.XXXXXX)
 cleanup () {
-  rm -f "$ADT_SUMMARY"
+  rm -f "$DEB_ADT_SUMMARY"
 }
 trap "cleanup" 0 2 3 15
 
-# build package and run autopkgtests inside the chroot
-# (lock against concurrent apt-get update/upgrade operations)
-# (adt-sbuild is part of pgdg-buildenv)
+# lock against concurrent apt-get update/upgrade operations on the source chroot
 LOCKDIR="/var/lock/sbuild-package"
 if ! test -d $LOCKDIR; then
   mkdir $LOCKDIR
@@ -72,10 +73,10 @@ if ! test -d $LOCKDIR; then
 fi
 umask 002
 
+# build package and run autopkgtests inside the chroot
 (
   set -x
   flock --shared 9
-  DEB_ADT_SUMMARY=$ADT_SUMMARY \
   sbuild --nolog --batch --apt-update --no-apt-distupgrade \
     -d $distribution-pgdg --arch $architecture ${ARCH_ALL:-} \
     --finished-build-commands='adt-sbuild %SBUILD_BUILD_DIR %SBUILD_PKGBUILD_DIR' \
@@ -88,4 +89,4 @@ if [ "${FILTER_ARCH_ALL:-}" ]; then
 fi
 
 # convert autopkgtest results to junit format (writes a dummy record if package doesn't have tests)
-adtsummary2junit $ADT_SUMMARY > autopkgtest.xml
+adtsummary2junit $DEB_ADT_SUMMARY > autopkgtest.xml
index f6d641d12a9a46d7a8e049b7e6eab57e43a186fc..de3ace0621fcd815bcbb32ca9e7704d0dee2c12f 100755 (executable)
@@ -5,9 +5,11 @@ error () {
   exit 1
 }
 
+chroot="source:$distribution-pgdg-$architecture-sbuild"
+
 # check if chroot exists
-schroot -l | grep -q source:$distribution-pgdg-$architecture-sbuild || \
-  error "There is no schroot definition for source:$distribution-pgdg-$architecture-sbuild"
+schroot -l | grep -q $chroot || \
+  error "There is no schroot definition for $chroot"
 
 set -eux
 
@@ -39,7 +41,7 @@ umask 002
 (
   flock --exclusive 9
   cd /
-  schroot -u root -c source:$distribution-pgdg-$architecture-sbuild -- sh <<-EOF
+  schroot -u root -c $chroot -- sh <<-EOF
        set -ex
        
        if ! test -f /etc/apt/sources.list.d/pgdg.list; then