From: Ian Jackson Date: Sun, 8 Jul 2012 18:27:04 +0000 (+0100) Subject: adt-run: Fix for 678359, thanks to Martin Pitt X-Git-Tag: debian/2.2.3~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=626519fae4dd36e97a9f3fb19fb460a24eca2cae;p=autopkgtest.git adt-run: Fix for 678359, thanks to Martin Pitt --- diff --git a/debian/changelog b/debian/changelog index 4f23960..924b6f7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +autopkgtest (2.2.3~~iwj) unstable; urgency=medium + + [ Martin Pitt ] + * Make `@' in tests' Depends work even if we're not building the + source tree. Closes: #678359. This is an important bugfix. + + -- Ian Jackson Sun, 08 Jul 2012 19:26:23 +0100 + autopkgtest (2.2.2) unstable; urgency=low [ Martin Pitt ] diff --git a/debian/control b/debian/control index 548f25a..2ef2353 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=autopkgtest/autopkgtest.git Package: autopkgtest Architecture: all -Depends: python (>= 2.6) +Depends: python (>= 2.6), debhelper Conflicts: autodebtest (<< 0.5.3) Replaces: autodebtest (<< 0.5.3) Recommends: apt-utils, pbuilder diff --git a/runner/adt-run b/runner/adt-run index 1efa756..0e30bd9 100755 --- a/runner/adt-run +++ b/runner/adt-run @@ -1090,7 +1090,7 @@ def run_tests(stanzas, tree): report('*', 'SKIP package has metadata but no tests') errorcode |= 8 for t in tests: - t.prepare() + t.prepare(tree) t.run(tree) if 'breaks-testbed' in t.restriction_names: testbed.needs_reset() @@ -1116,7 +1116,7 @@ class Test: global errorcode errorcode |= 4 report(t.what, 'FAIL ' + m) - def prepare(t): + def prepare(t, tree): t._debug('preparing') dn = [] for d in t.depends: @@ -1125,7 +1125,7 @@ class Test: t._debug(' literal dependency '+d) dn.append(d) else: - for (pkg,bin) in t.act.binaries: + for pkg in packages_from_source(t.act, tree): dp = d.replace('@',pkg) t._debug(' synthesised dependency '+dp) dn.append(dp) @@ -1205,19 +1205,11 @@ class Test: t._debug('----------------------------------------]') -def read_control(act, tree, control_override): +def read_stanzas(af): stanzas = [ ] - if control_override is not None: - control_af = control_override - testbed.blame('arg:'+control_override.spec) - else: - if act.missing_tests_control: - return () - control_af = RelativeInputFile(act.what+'-testcontrol', - tree, 'debian/tests/control') try: - control = open(control_af.read(), 'r') + control = open(af.read(), 'r') except (IOError,OSError), oe: if oe[0] != errno.ENOENT: raise return [] @@ -1261,6 +1253,21 @@ def read_control(act, tree, control_override): hcurrent.append((lno, l)) end_stanza(stz) + return stanzas + +def read_control(act, tree, control_override): + + if control_override is not None: + control_af = control_override + testbed.blame('arg:'+control_override.spec) + else: + if act.missing_tests_control: + return () + control_af = RelativeInputFile(act.what+'-testcontrol', + tree, 'debian/tests/control') + + stanzas = read_stanzas(control_af) + def testbadctrl(stz, lno, m): report_badctrl(lno, m) stz[' errs'] += 1 @@ -1346,6 +1353,29 @@ def determine_package(act): act.pkg = m.groups()[0] if not act.pkg: badpkg('no good Package: line in control file') +def packages_from_source(act, tree): + (rc, output) = subprocess_cooked(['dh_listpackages'], + stdout=subprocess.PIPE, cwd=tree.read(True)) + if rc: badpkg('failed to parse packages built from source, code %d' % rc) + + # filter out empty lines + packages = [p for p in output.split() if p] + + # filter out udebs + control_af = RelativeInputFile(act.what+'-control', + tree, 'debian/control') + for st in read_stanzas(control_af): + if 'Package' not in st: + # source stanza + continue + if 'Xc-package-type' in st: + try: + packages.remove(st['Package'][0][1]) + except ValueError: + pass + + return packages + class Binaries: def __init__(b, tb): b.dir = TemporaryDir('binaries')