Martin Pitt [2012-06-21 11:13 +0200]:
> Attached patch does that.

Version 2 of the patch, this now filters out udebs.

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.0ubuntu4/debian/control
--- autopkgtest-2.2.0ubuntu1/debian/control	2012-06-19 18:35:41.000000000 +0200
+++ autopkgtest-2.2.0ubuntu4/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.0ubuntu4/runner/adt-run
--- autopkgtest-2.2.0ubuntu1/runner/adt-run	2012-06-19 18:34:47.000000000 +0200
+++ autopkgtest-2.2.0ubuntu4/runner/adt-run	2012-06-21 18:05:58.000000000 +0200
@@ -1125,7 +1125,11 @@
 			t._debug('  literal dependency '+d)
 			dn.append(d)
 		else:
-			for (pkg,bin) in t.act.binaries:
+			if hasattr(t.act, 'tests_tree'):
+			    srcdir = t.act.tests_tree.path[1]
+			else:
+			    srcdir = '.'
+			for pkg in packages_from_source(srcdir):
 				dp = d.replace('@',pkg)
 				t._debug('  synthesised dependency '+dp)
 				dn.append(dp)
@@ -1346,6 +1350,28 @@
 		act.pkg = m.groups()[0]
 	if not act.pkg: badpkg('no good Package: line in control file')
 
+def packages_from_source(srcdir):
+    (rc, output) = subprocess_cooked(['dh_listpackages'],
+            stdout=subprocess.PIPE, cwd=srcdir)
+    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
+    with open(os.path.join(srcdir, 'debian', 'control')) as f:
+        cur_pkg = None
+        for line in f:
+            if line.startswith('Package:'):
+                cur_pkg = line.split(None, 1)[1].strip()
+            if 'Package-Type: udeb' in line:
+                try:
+                    packages.remove(cur_pkg)
+                except ValueError:
+                    pass
+
+    return packages
+
 class Binaries:
  def __init__(b, tb):
 	b.dir = TemporaryDir('binaries')

Attachment: signature.asc
Description: Digital signature

Reply via email to