Bug#705917: pbuilder: Add basic DEP-8 autopkgtest

James Hunt james.hunt at ubuntu.com
Mon Apr 22 07:53:59 UTC 2013


Package: pbuilder
Version: 0.213
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu raring ubuntu-patch

Dear Maintainer,

The attached debdiff adds a basic DEP-8 autopkgtest for pbuilder.

See:

- https://code.launchpad.net/~jamesodhunt/ubuntu/raring/pbuilder/dep8-procenv
-
https://code.launchpad.net/~jamesodhunt/ubuntu/raring/pbuilder/dep8-procenv/+merge/159690


In Ubuntu, the attached patch was generated to achieve the following:

* ability to detect if pbuilder is able to:
  - create a chroot for the current release.
  - build a package.
* check that the resulting package is installable and the binary runnable.

Thanks for considering the patch.


-- System Information:
Debian Release: wheezy/sid
  APT prefers raring-updates
  APT policy: (500, 'raring-updates'), (500, 'raring-security'), (500, 'raring')
Architecture: i386 (i686)

Kernel: Linux 3.8.0-19-generic (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash


Kind regards,

James.
--
James Hunt
____________________________________
#upstart on freenode
http://upstart.ubuntu.com/cookbook
https://lists.ubuntu.com/mailman/listinfo/upstart-devel
-------------- next part --------------
=== modified file 'debian/changelog'

=== modified file 'debian/control'
--- debian/control	2012-11-05 23:27:25 +0000
+++ debian/control	2013-04-22 07:41:08 +0000
@@ -18,6 +18,7 @@
 Standards-Version: 3.9.1
 XS-Debian-Vcs-Git: git://git.debian.org/git/pbuilder/pbuilder.git
 XS-Debian-Vcs-Browser: http://git.debian.org/?p=pbuilder/pbuilder.git
+XS-Testsuite: autopkgtest
 
 Package: pbuilder
 Architecture: all

=== added directory 'debian/tests'
=== added file 'debian/tests/build_procenv'
--- debian/tests/build_procenv	1970-01-01 00:00:00 +0000
+++ debian/tests/build_procenv	2013-04-18 18:02:15 +0000
@@ -0,0 +1,47 @@
+#!/bin/sh -e
+
+# The package we'll ask pbuilder to build.
+#
+# The advantage of this package being that it runs itself as part of its
+# build, which has the nice side-effect of exposing the full pbuilder
+# environment to those perusing the autopkgtest logs.
+pkg=procenv
+
+dir=/var/cache/pbuilder/result
+
+# Avoid conflict with ADT
+unset TMPDIR
+
+# Have to redirect stderr to avoid ADT thinking the test has failed
+# (the return code is still being checked, so this seems reasonable).
+echo "INFO: Creating pbuilder buildd chroot for current release"
+pbuilder --create --debug --debootstrapopts --variant=buildd 2>&1
+
+if [ ! -d "$dir" ]; then
+	echo "ERROR: cannot find directory $dir" >&2
+	exit 1
+fi
+
+# '--download-only' to avoid unpack which generates a signature
+# warning to stderr, causing this test to fail.
+echo "INFO: Downloading source for package '$pkg'"
+apt-get source --download-only "$pkg"
+
+dsc=$(ls ${pkg}*.dsc)
+
+echo "INFO: Building package '$pkg' from '$dsc'"
+pbuilder --build --debug "$dsc" 2>&1
+
+arch=$(dpkg --print-architecture)
+
+pkg_and_version=$(echo "$dsc"|sed 's/\.dsc$//g')
+deb=${dir}/${pkg_and_version}_${arch}.deb
+
+echo "INFO: Installing package '$pkg' from '$deb'"
+dpkg -i ${dir}/${pkg}*.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"

=== added file 'debian/tests/control'
--- debian/tests/control	1970-01-01 00:00:00 +0000
+++ debian/tests/control	2013-04-18 18:02:15 +0000
@@ -0,0 +1,3 @@
+Tests: build_procenv
+Depends: @, debian-keyring
+Restrictions: needs-root



More information about the Pbuilder-maint mailing list