Hi Mattia,

On Wed, Oct 04, 2017 at 09:44:18PM +0200, Mattia Rizzolo wrote:
> On Wed, Oct 04, 2017 at 08:59:34PM +0200, Guido Günther wrote:
> > Attached patch supports both adt-rn and autopkgtest so we can continue
> > to build in wheezy and jessie.
> 
> ooohhh, I remembered there were some simple bugs lying around while I
> was doing the upload, but I didn't actually looked to the bug list and
> instead only fixed the FTBFS in the upload I did today...
> 
> 
> Thank you very much for the patch, much appreciated!
> Just, I noticed that you introduced an AUTOPKGTEST_OPTIONS without any
> kind of migration from ADT_OPTIONS.  Could you please consider that as
> well in your patch?  Also take care that ADT_OPTIONS is also mentioned
> before the hunks you modified.

Thanks for having a look. It falls back to ADT_OPTION for
AUTOPKGTEST_OPTIONS but uses ADT_OPTIONS for the adt-run in case someone
wants different sets of options for the two.
 -- Guido

> 
> > I doubled the while invocations instead of special casing even more
> > options so it stays easier to extend.
> 
> That's fine in something so short :)
> 
> -- 
> regards,
>                         Mattia Rizzolo
> 
> GPG Key: 66AE 2B4A FCCF 3F52 DA18  4D18 4B04 3FCD B944 4540      .''`.
> more about me:  https://mapreri.org                             : :'  :
> Launchpad user: https://launchpad.net/~mapreri                  `. `'`
> Debian QA page: https://qa.debian.org/developer.php?login=mattia  `-


From 7ee94bd2ce69b6b68315f17e066c7f9be27ab7ef Mon Sep 17 00:00:00 2001
Message-Id: <7ee94bd2ce69b6b68315f17e066c7f9be27ab7ef.1507221883.git....@sigxcpu.org>
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <a...@sigxcpu.org>
Date: Wed, 4 Oct 2017 19:29:52 +0200
Subject: [PATCH] B20aupkgtest: Prefer autopkgtest over adt-run

autopkgtest 5.0 dropped support for adt-run. Cater for that but still
allow to use adt-run in older chroot.

Closes: #876399
---
 examples/B20autopkgtest | 40 +++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/examples/B20autopkgtest b/examples/B20autopkgtest
index e2c3758..bef32b6 100644
--- a/examples/B20autopkgtest
+++ b/examples/B20autopkgtest
@@ -46,11 +46,12 @@ if [ ! -f debian/files ]; then
     exit 1
 fi
 
-if [ -n "${ADT_OPTIONS:-}" ] ; then
-    echo "*** Using provided ADT_OPTIONS $ADT_OPTIONS ***"
+OPTS="${AUTOPKGTEST_OPTIONS:-$ADT_OPTIONS}"
+if [ -n "${OPTS}" ]; then
+    echo "*** Using provided AUTOPKGTEST_OPTIONS ${OPTS} ***"
 fi
 
-# try to launch adt-run in a new PID namespace so several testsuites can run
+# try to launch autopkgtest in a new PID namespace so several testsuites can run
 # in parallel, newpid exists in jessie and newer only though
 unset newpid_name
 if ! apt-cache policy newpid | grep -q 'newpid:' ; then
@@ -64,22 +65,31 @@ fi
 # pbuilder's pbuilder-satisfydepends-classic
 apt-get install -y "${APTGETOPT[@]}" autopkgtest apt-utils pbuilder $newpid_name
 
-# since autopkgtest 3.16 the --tmp-dir option is gone, make sure
-# we've --output-dir available though before using it
-if adt-run --help | grep -q -- --output-dir 2>/dev/null ; then
-    OUTPUT_OPTION='--output-dir'
-else
-    OUTPUT_OPTION='--tmp-dir'
-fi
-
 mkdir -p "$BUILDDIR/autopkgtest.out"
 
-$newpid_name adt-run \
-    ${OUTPUT_OPTION} "$BUILDDIR/autopkgtest.out" \
+if which autopkgtest >/dev/null; then
+  $newpid_name autopkgtest \
+    --output-dir "$BUILDDIR/autopkgtest.out" \
     --summary "$BUILDDIR/autopkgtest.summary" \
     "$BUILDDIR"/*.deb \
-    --built-tree "${PWD}" \
-    ${ADT_OPTIONS:-} --- adt-virt-null || EXIT=$?
+    "${PWD}" \
+    ${OPTS} -- autopkgtest-virt-null || EXIT=$?
+else
+  # since autopkgtest 3.16 the --tmp-dir option is gone, make sure
+  # we've --output-dir available though before using it
+  if adt-run --help | grep -q -- --output-dir 2>/dev/null ; then
+      OUTPUT_OPTION='--output-dir'
+  else
+      OUTPUT_OPTION='--tmp-dir'
+  fi
+
+  $newpid_name adt-run \
+      ${OUTPUT_OPTION} "$BUILDDIR/autopkgtest.out" \
+      --summary "$BUILDDIR/autopkgtest.summary" \
+      "$BUILDDIR"/*.deb \
+      --built-tree "${PWD}" \
+      ${ADT_OPTIONS} --- adt-virt-null || EXIT=$?
+fi
 
 # collect autopkgtest output in a single file so pbuilder automatically copies it
 tar -caf "$BUILDDIR/autopkgtest.tar.gz" "$BUILDDIR/autopkgtest.out"
-- 
2.14.1

Reply via email to