Bug#870393: autopkgtest setup fails strangely with arch-qualified sources.list

Steve Langasek steve.langasek at canonical.com
Tue Aug 1 16:06:56 UTC 2017


Package: autopkgtest
Version: 4.3
Severity: minor
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu artful ubuntu-patch

On my system I have a mixture of arch-qualified (deb) and not-arch-qualified
(deb-src) lines in sources.list.  This results in 'autopkgtest
--apt-pocket=proposed=src:perl' trying to create files with names like
'/etc/apt/preferences.d/autopkgtest-http://archive.ubuntu.com/ubuntu-proposed'.

It's not obvious to me why the sed script in question behaves this way, but
it appears that e.g. this line is matching when it shouldn't and resulting
in the broken output:

  deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu artful-updates main

This can be resolved with a two-pass sed script, first ignoring the [] field
and then applying the rest of the rules to extract the series name.

Thanks for considering the patch.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru autopkgtest-4.3ubuntu1/lib/adt_testbed.py autopkgtest-4.3ubuntu2/lib/adt_testbed.py
--- autopkgtest-4.3ubuntu1/lib/adt_testbed.py	2017-01-11 03:34:09.000000000 -0800
+++ autopkgtest-4.3ubuntu2/lib/adt_testbed.py	2017-07-31 17:23:27.000000000 -0700
@@ -1176,7 +1176,7 @@
 
         # get release name
         script = 'SRCS=$(ls /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null|| true); '
-        script += '''REL=$(sed -rn '/^(deb|deb-src) .*(ubuntu.com|debian.org|ftpmaster|file:\/\/\/tmp\/testarchive)/ { s/^[^ ]+ +(\[.*\] *)?[^ ]* +([^ -]+) +.*$/\\2/p}' $SRCS | head -n1); '''
+        script += '''REL=$(sed -rn '/^(deb|deb-src) .*(ubuntu.com|debian.org|ftpmaster|file:\/\/\/tmp\/testarchive)/ { s/\[.*\] +//; s/^[^ ]+ +[^ ]* +([^ -]+) +.*$/\\1/p }' $SRCS | head -n1); '''
 
         script += 'mkdir -p /etc/apt/preferences.d; '
         script += 'PKGS="%s"; ' % ' '.join(binpkgs)


More information about the autopkgtest-devel mailing list