[buildd-tools-devel] Bug#705926: Updated debdiff

James Hunt james.hunt at ubuntu.com
Tue Apr 23 09:18:59 UTC 2013


I raised a similar bug for a pbuilder DEP-8 test:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705917

Some concerns were raised on that bug so please find attached an updated sbuild
debdiff which take those concerns into account.

Kind regards,

James.
--
James Hunt
____________________________________
#upstart on freenode
http://upstart.ubuntu.com/cookbook
https://lists.ubuntu.com/mailman/listinfo/upstart-devel
-------------- next part --------------
diff -Nru sbuild-0.63.2/debian/changelog sbuild-0.63.2/debian/changelog
--- sbuild-0.63.2/debian/changelog	2013-01-17 14:00:53.000000000 +0000
+++ sbuild-0.63.2/debian/changelog	2013-04-23 10:06:31.000000000 +0100
@@ -1,3 +1,9 @@
+sbuild (0.63.2-1.1ubuntu2) UNRELEASED; urgency=low
+
+  * Added DEP-8 autopkgtest to build procenv.
+
+ -- James Hunt <james.hunt at ubuntu.com>  Tue, 23 Apr 2013 10:06:24 +0100
+
 sbuild (0.63.2-1.1ubuntu1) raring; urgency=low
 
   * Merge from Debian unstable. Remaining changes:
diff -Nru sbuild-0.63.2/debian/control sbuild-0.63.2/debian/control
--- sbuild-0.63.2/debian/control	2012-11-28 12:42:59.000000000 +0000
+++ sbuild-0.63.2/debian/control	2013-04-22 11:00:27.000000000 +0100
@@ -8,6 +8,7 @@
 Standards-Version: 3.9.1
 Vcs-Browser: http://git.debian.org/?p=buildd-tools/sbuild.git
 Vcs-Git: git://git.debian.org/git/buildd-tools/sbuild
+XS-Testsuite: autopkgtest
 
 Package: libsbuild-perl
 Architecture: all
diff -Nru sbuild-0.63.2/debian/tests/build_procenv sbuild-0.63.2/debian/tests/build_procenv
--- sbuild-0.63.2/debian/tests/build_procenv	1970-01-01 01:00:00.000000000 +0100
+++ sbuild-0.63.2/debian/tests/build_procenv	2013-04-23 10:00:42.000000000 +0100
@@ -0,0 +1,150 @@
+#!/bin/sh -e
+#---------------------------------------------------------------------
+# DEP-8 test for sbuild.
+#
+# Creates a sbuild chroot, builds a package, installs the resulting
+# .deb, then runs the command provided by the .deb.
+#---------------------------------------------------------------------
+
+die()
+{
+    msg="$*"
+    echo "ERROR: $msg" >&2
+    exit 1
+}
+
+# The package we'll ask sbuild to build (we know its buildable since
+# it's already in the archive :-)
+#
+# The advantage of choosing this particular package being that it runs
+# *itself* at the end of its build, which has the nice side-effect of
+# exposing the full sbuild environment to those perusing the autopkgtest
+# logs.
+pkg=procenv
+
+# os-release is more portable than lsb_release
+distro=$(grep ^ID= /etc/os-release 2>/dev/null | cut -d= -f2- || :)
+[ -z "$distro" ] && die "cannot establish distribution"
+
+if [ "$distro" = ubuntu ]
+then
+    # Build chroot for latest release.
+    release=$(distro-info --devel)
+
+    url=http://archive.ubuntu.com/ubuntu
+elif [ "$distro" = debian ]
+then
+    # Build chroot for latest stable release since
+    # sid may not be buildable on a particular day.
+    release=$(distro-info --stable)
+
+    url=http://archive.debian.org/debian
+else
+    die "need to know where archive is for distro '$distro'"
+fi
+
+arch=$(dpkg --print-architecture 2>/dev/null)
+[ -z "$arch" ] && die "cannot establish architecture"
+
+[ -z "$ADTTMP" ] && die "ADTTMP not set"
+dir="$ADTTMP/schroot-$release"
+
+# The expected name of the schroot that sbuild-createchroot will create
+chroot="${release}-${arch}-sbuild"
+
+# schroot does not allow a chroot name to be specified at creation time.
+# As such, we must take care to avoid stomping on a developers chroots.
+# If we find any that match the chroot we're about to try and make, exit
+# with a message.
+#
+# Note that we are very cautious in the grep check below; we purposely
+# don't match on the _type_ of schroot in case new schroot types are
+# added and this test is not updated to take account of the new types.
+
+schroots=$(schroot -l 2>/dev/null)
+
+if [ -n "$schroots" ] && echo "$schroots"|grep -q ":${release}-${arch}"
+then
+    echo "INFO:"
+    echo "INFO: Existing schroots detected for current release ($release)"
+    echo "INFO: and architecture ($arch)"
+    echo "INFO:"
+    echo "INFO: Not continuing."
+    echo "INFO:"
+
+    # exit successfully
+    exit 0
+fi
+
+# Use '--download-only' to avoid unpack which generates a
+# signature warning to stderr, causing this test to fail.
+# Take care to download the package version for the release we will
+# create the chroot for. 
+echo "INFO: Downloading source for package '$pkg'"
+apt-get source --download-only "$pkg/$release"
+
+dsc=$(ls ${pkg}*.dsc)
+
+echo "INFO: Creating sbuild chroot '$chroot' for release '$release' in directory '$dir' from url '$url'"
+sbuild-createchroot "$release" "$dir" "$url"
+
+echo "INFO: Checking chroot '$chroot' is known"
+schroot --list --all-chroots|grep "^chroot:${chroot}$"
+
+echo "INFO: Displaying information about chroot '$chroot'"
+schroot --info "${chroot}"
+
+# crucial
+echo "INFO: Creating sbuild key pair"
+sbuild-update --keygen 2>&1
+
+echo "INFO: Building package '$pkg' for release '$release' from '$dsc'"
+sbuild -A -d "$release" $dsc 2>&1
+
+pkg_and_version=$(echo "$dsc"|sed 's/\.dsc$//g')
+deb=${pkg_and_version}_${arch}.deb
+
+echo "INFO: Displaying sbuild log"
+cat ${pkg_and_version}_${arch}*.build
+
+echo "INFO: Installing package '$pkg' from '$deb'"
+dpkg -i "$deb"
+
+# run the command to prove the build worked but also to expose the
+# auto-package-test environment used for this test.
+cmd=$pkg
+echo "INFO: Showing AutoPkgTest environment by running '$cmd' from package '$pkg'"
+"$cmd"
+
+# There is no sbuild/schroot command to actually delete the chroot, but
+# we do want to clean up fully. The best we can do is end the schroot
+# session, and remove the sym links. Removing the chroot itself is not
+# necessary since it is created below $ADTTMP so will be removed
+# automatically by the AutoPkgTest environment.
+
+echo "INFO: Establishing schroot sessions for chroot '$chroot'"
+session=$(schroot --list --all-sessions|grep "^session:${release}-${arch}-" || :)
+if [ -n "$session" ]
+then
+    count=$(echo "$session"|wc -l)
+    [ $count -eq 1 ] || die "expected 1 session, found $count"
+
+    echo "INFO: Ending schroot session '$session'"
+    schroot --end-session --chroot "$session"
+else
+    echo "INFO: No schroot session to end"
+fi
+
+echo "INFO: Cleaning up"
+
+echo "INFO: Removing sbuild chroot symbolic link for '$chroot'"
+link=$(ls /etc/sbuild/chroot/${chroot})
+# remove soon-to-be-broken symbolic link
+[ -h "$link" ] && rm "$link"
+
+# remove soon-to-be stale configuration file
+echo "INFO: Removing schroot configuration file for '$chroot'"
+config=$(ls /etc/schroot/chroot.d/${chroot}-*)
+[ -f "$config" ] && rm "$config"
+
+echo "INFO: SUCCESS"
diff -Nru sbuild-0.63.2/debian/tests/control sbuild-0.63.2/debian/tests/control
--- sbuild-0.63.2/debian/tests/control	1970-01-01 01:00:00.000000000 +0100
+++ sbuild-0.63.2/debian/tests/control	2013-04-23 09:41:19.000000000 +0100
@@ -0,0 +1,3 @@
+Tests: build_procenv
+Depends: @, distro-info
+Restrictions: needs-root breaks-testbed


More information about the Buildd-tools-devel mailing list