Tags: patch

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.

--
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-04-04 09:53:37 +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,19 @@
 	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()<>=*@]')
+	re = regexp.compile(r"(?P<package>[a-z0-9+-.]+)\s*(\((?P<relation><<|<=|>=|=|>>)\s*(?P<version>[^\)]*)\))?$")
 	for d in dl:
-		if re.search(d):
-			badpkg("Test Depends field contains dependency"
-			       " `%s' with invalid characters" % d)
+		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