Hello Ian, Ian Jackson [2012-07-04 16:51 +0100]: > > Where "This" == the list of binaries that are being produced by this > > source (as a new ctor argument)? > > No, the tree.
I see. I haven't done that yet, but I agree it could improve the structure a little. > > > Perhaps it would be better to generalise the first half of > > > read_control until it can be reused (as a non-class function called > > > something like read_stanzas, I guess). The updated patch does that now. I again tested it with an unpackaged source (--built-tree=.) and a .dsc. Thanks, Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
runner/adt-run: Expand '@' test Depends: from the test package's
debian/control instead from the list of built .debs. The latter does not
work if we do not actually build the source. This uses dh_listpackage to
avoid duplicating all the "Architecture:" parsing magic, so add a
debhelper dependency. (LP: #1015400, Closes: #678359)
diff -Nru autopkgtest-2.2.0ubuntu1/debian/control autopkgtest-2.2.0ubuntu5/debian/control
--- autopkgtest-2.2.0ubuntu1/debian/control 2012-06-19 18:35:41.000000000 +0200
+++ autopkgtest-2.2.0ubuntu5/debian/control 2012-06-21 10:50:14.000000000 +0200
@@ -9,7 +9,7 @@
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 -Nru autopkgtest-2.2.0ubuntu1/runner/adt-run autopkgtest-2.2.0ubuntu5/runner/adt-run
--- autopkgtest-2.2.0ubuntu1/runner/adt-run 2012-06-19 18:34:47.000000000 +0200
+++ autopkgtest-2.2.0ubuntu5/runner/adt-run 2012-07-04 18:37:10.000000000 +0200
@@ -1090,7 +1090,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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')
signature.asc
Description: Digital signature

