tag 678359 patch
thanks

Martin Pitt [2012-06-21  7:43 +0200]:
> IMHO the package list for @ should be generated from debian/control,
> not from the generated .debs during a local build.

Attached patch does that. I'm not quite sure about the handling of
t.act.tests_tree.path (it is -- erm -- not very easy to understand the
organization of all those AutoFile classes and their rather cryptic
members), but I tested it with running from an unpacked source tree
and from a .dsc, and it works fine now.

If you don't like the new debhelper dependency, we could also copy the
code, but it's quite a lot and not very easy. Pretty much every
package is going to install debhelper as a build dep anyway, though,
so I don't think it hurts.

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.0ubuntu3/debian/control
--- autopkgtest-2.2.0ubuntu1/debian/control	2012-06-19 18:35:41.000000000 +0200
+++ autopkgtest-2.2.0ubuntu3/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.0ubuntu3/runner/adt-run
--- autopkgtest-2.2.0ubuntu1/runner/adt-run	2012-06-19 18:34:47.000000000 +0200
+++ autopkgtest-2.2.0ubuntu3/runner/adt-run	2012-06-21 11:08:01.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,12 @@
 		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)
+    return [p for p in output.split() if p] # filter out empty lines
+
 class Binaries:
  def __init__(b, tb):
 	b.dir = TemporaryDir('binaries')

Attachment: signature.asc
Description: Digital signature

Reply via email to