On 05/19/2013 11:19 PM, Colin Watson wrote:
On Wed, Apr 10, 2013 at 11:32:39AM +0200, Christoph Berg wrote:
Re: Jean-Baptiste Lallement 2013-04-09 <516462a9.7040...@canonical.com>
This patch adds support for versioned dependencies in the test
control file. It checks that the format of the dependency is correct
and that the version number is valid.

The dependencies are written unchanged to the .dsc that is used by
pbuilder-satisfydepends-classic to install the packages.

"|" is also disallowed in the list, yet pbuilder supports that.

Indeed, this breaks lintian's autopkgtest:

   
https://jenkins.qa.ubuntu.com/view/Saucy/view/AutoPkgTest/job/saucy-adt-lintian/ARCH=i386,label=adt/6/artifact/results/log

Thanks for the review. Here is a modified version of the patch that supports list of test dependencies with '|'.

I tested it against lintian (which passes with this patch) and binutils (which was expected to fail), ipython and apport


--
Jean-Baptiste
IRC: jibel
=== modified file 'debian/changelog'
--- debian/changelog	2013-01-07 09:52:04 +0000
+++ debian/changelog	2013-04-04 10:17:30 +0000
@@ -1,3 +1,10 @@
+autopkgtest (2.2.3ubuntu4) raring; urgency=low
+
+  * Implemented support for versioned dependencies in test control file.
+    (LP: #1164362) Closes: #693540.
+
+ -- Jean-Baptiste Lallement <jean-baptiste.lallem...@canonical.com>  Thu, 04 Apr 2013 12:14:34 +0200
+
 autopkgtest (2.2.3ubuntu3) raring; urgency=low
 
   * Capitalize field names read from control file. (LP: #1096788)

=== modified file 'runner/adt-run'
--- runner/adt-run	2013-01-07 09:01:37 +0000
+++ runner/adt-run	2013-05-21 09:58:57 +0000
@@ -36,7 +36,7 @@
 import fnmatch
 import shutil
 import copy
-from debian import deb822
+from debian import deb822, debian_support
 
 from optparse import OptionParser
 signal.signal(signal.SIGINT, signal.SIG_DFL) # undo stupid Python SIGINT thing
@@ -1066,11 +1066,21 @@
 	debug("Field_DependS: %s %s %s %s" % (f.stz, f.base, f.tnames, f.vl), 2)
 	dl = map(lambda x: x.strip(),
 		flatten(map(lambda (lno, v): v.split(','), f.vl)))
-	re = regexp.compile('[^-.+:~0-9a-z()<>=*@]')
-	for d in dl:
-		if re.search(d):
-			badpkg("Test Depends field contains dependency"
-			       " `%s' with invalid characters" % d)
+	re = regexp.compile(r"(?P<package>[a-z0-9+-.]+)\s*(\((?P<relation><<|<=|>=|=|>>)\s*(?P<version>[^\)]*)\))?$")
+	for di in dl:
+		for d in di.split('|'):
+			d = d.strip()
+			if d == '@': continue  # Expanded to binary packages
+			m = re.match(d)
+			if not m:
+				badpkg("Test Depends field contains an invalid "
+				       "dependency `%s'" % d)
+			if m.group("version"):
+				try:
+					dsv = debian_support.NativeVersion(m.group("version"))
+				except ValueError:
+					badpkg("Test Depends field contains dependency"
+					       " `%s' with an invalid version" % d)
 	f.base['depends'] = dl
 
 class Field_Tests_directory(FieldBase):

Reply via email to