]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
Simplify sbuild-post-build-* script by using the new %SBUILD_CHROOT_DIR and %SBUILD_P...
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Mon, 28 Jul 2014 09:58:08 +0000 (11:58 +0200)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Mon, 28 Jul 2014 09:58:08 +0000 (11:58 +0200)
sbuild-post-build-copy-chroot-to-tmp
sbuild-post-build-get-reports

index bda111e7d2451022fee5cb0b661dc3134ae61791..ead973729972aaafb2440e0c2e2459c28315e6c4 100755 (executable)
@@ -1,19 +1,11 @@
 #!/bin/sh
-set -e
+set -eu
 
-# FIXME: Fix sbuild to pass the chroot base path to this script!
-dsc=$1
-chroots=$(find /var/lib/schroot/mount/*/build/ -maxdepth 2 -name $dsc | wc -l)
-if test "$chroots" -eq 0; then
-    echo "$0: Failed to find chroot in /var/lib/schroot/mount." >&2
-    exit 1
-elif test "$chroots" -gt 1; then
-    echo "$0: Found multiple chroots (but only one wanted):" >&2
-    find /var/lib/schroot/mount/*/build/ -maxdepth 2 -name $dsc >&2
+chrootdir=$1
+if test ! -d "$chrootdir"; then
+    echo "$0: Given chroot directory '$chrootdir' does not exists or is no directory!" >&2
     exit 1
 fi
-# FIXME: possible race condition
-chroot=$(readlink -f "$(dirname $(find /var/lib/schroot/mount/*/build/ -maxdepth 2 -name $dsc))/../..")
 
-echo "sudo rsync -a --exclude=/dev/ --exclude=/proc/ --exclude=/sys/ $chroot/ /tmp/$(basename $chroot)"
-sudo rsync -a --exclude=/dev/ --exclude=proc/ --exclude=/sys/ $chroot/ /tmp/$(basename $chroot)
+echo "sudo rsync -a --exclude=/dev/ --exclude=/proc/ --exclude=/sys/ $chrootdir/ /tmp/$(basename $chrootdir)"
+sudo rsync -a --exclude=/dev/ --exclude=proc/ --exclude=/sys/ $chrootdir/ /tmp/$(basename $chrootdir)
index 191c2cb3a5889ec81f19bbe3b7bfdbe79f5ddef9..05ab37a436ffd73449c1aa9d78ba2cf0677efa69 100755 (executable)
@@ -1,19 +1,11 @@
 #!/bin/sh
-set -e
+set -eu
 
-# FIXME: Fix sbuild to pass the chroot base path to this script!
-dsc=$1
-chroots=$(find /var/lib/schroot/mount/*/build/ -maxdepth 2 -name $dsc | wc -l)
-if test "$chroots" -eq 0; then
-    echo "$0: Failed to find chroot in /var/lib/schroot/mount." >&2
-    exit 1
-elif test "$chroots" -gt 1; then
-    echo "$0: Found multiple chroots (but only one wanted):" >&2
-    find /var/lib/schroot/mount/*/build/ -maxdepth 2 -name $dsc >&2
+pkgbuilddir=$1
+if test ! -d "$pkgbuilddir"; then
+    echo "$0: Given package build directory '$pkgbuilddir' does not exists or is no directory!" >&2
     exit 1
 fi
-# FIXME: possible race condition
-builddir=$(dirname $(find /var/lib/schroot/mount/*/build/ -maxdepth 2 -name $dsc))
 
 # Determine git checkout directory (which is stored in the workspace)
 # Note: Assume that $OLDPWD points to <Jenkins job dir>/deb-packages/$source
@@ -22,12 +14,7 @@ workspace=${OLDPWD}/../../workspace
 if echo "${BUILD_TRIGGERS}" | grep -q 'no-test'; then
     echo "Found build trigger 'no-test' so no reports.tgz will be created."
 else
-    cd $builddir
-    if test "$(find * -maxdepth 0 -type d | wc -l)" -eq 1; then
-        # switch into extract Debian source directory
-        cd $(find * -maxdepth 0 -type d | head -n 1)
-    fi
-
+    cd $pkgbuilddir
     files=$(find . -name surefire-reports -o -name failsafe-reports -o -name unittest.log -o -name tests-0.log -o -name build.log -o -name test-run-all.xml | wc -l)
     if test "$files" -eq 0; then
         echo "Found no report file in $(pwd)."