[devscripts] 01/01: sadt: Add support for @builddeps@ in tests' Depends.

James McCoy jamessan at debian.org
Wed Jan 29 03:35:09 UTC 2014


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit ab8940fb187fadb5c8591edbb3c15565078a0cc0
Author: Jakub Wilk <jwilk at debian.org>
Date:   Sun Jan 26 21:50:35 2014 +0100

    sadt: Add support for @builddeps@ in tests' Depends.
    
    Closes: #736798
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog |  8 ++++++++
 scripts/sadt     | 14 +++++++++++---
 scripts/sadt.pod |  4 ++++
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index afb004c..2552de7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+devscripts (2.14.2) UNRELEASED; urgency=medium
+
+  [ Jakub Wilk ]
+  * sadt:
+    + Add support for @builddeps@ in tests' Depends.  (Closes: #736798)
+
+ -- Jakub Wilk <jwilk at debian.org>  Sun, 26 Jan 2014 21:50:35 +0100
+
 devscripts (2.14.1) unstable; urgency=medium
 
   * Actually install sadt.  (Closes: #736683)
diff --git a/scripts/sadt b/scripts/sadt
index 5c9aa7b..c6cca1f 100755
--- a/scripts/sadt
+++ b/scripts/sadt
@@ -166,7 +166,7 @@ class TestGroup(object):
     def __iter__(self):
         return iter(self.tests)
 
-    def expand_depends(self, packages):
+    def expand_depends(self, packages, build_depends):
         if '@' not in self.depends:
             return
         or_clauses = []
@@ -183,6 +183,9 @@ class TestGroup(object):
             finally:
                 sys.stderr = orig_sys_stderr
         for or_clause in parsed_depends:
+            if len(or_clause) == 1 and or_clause[0]['name'] == '@builddeps@':
+                or_clauses += build_depends
+                continue
             stripped_or_clause = [r for r in or_clause if r['name'] != '@']
             if len(stripped_or_clause) < len(or_clause):
                 for package in packages:
@@ -195,7 +198,6 @@ class TestGroup(object):
         self.depends = deb822.PkgRelation.str(or_clauses)
 
     def check_depends(self):
-        assert '@' not in self.depends
         if self._check_depends_cache is not None:
             if isinstance(self._depends_cache, Exception):
                 raise self._check_depends_cache
@@ -341,6 +343,7 @@ def main():
     options.tests = frozenset(options.tests)
     options.ignore_restrictions = frozenset(options.ignore_restrictions.split(','))
     binary_packages = set()
+    build_depends = []
     try:
         file = open('debian/control', encoding='UTF-8')
     except IOError as exc:
@@ -352,6 +355,11 @@ def main():
         for n, para in enumerate(deb822.Packages.iter_paragraphs(file)):
             if n == 0:
                 para['Source']
+                for field in 'Build-Depends', 'Build-Depends-Indep':
+                    try:
+                        build_depends += deb822.PkgRelation.parse_relations(para[field])
+                    except KeyError:
+                        continue
             else:
                 binary_packages.add(para['Package'])
     test_groups = []
@@ -375,7 +383,7 @@ def main():
                     break
                 method(value)
             if group is not None:
-                group.expand_depends(binary_packages)
+                group.expand_depends(binary_packages, build_depends)
                 test_groups += [group]
     failures = []
     n_skip = n_ok = 0
diff --git a/scripts/sadt.pod b/scripts/sadt.pod
index 362ff06..0884e71 100644
--- a/scripts/sadt.pod
+++ b/scripts/sadt.pod
@@ -62,6 +62,10 @@ Show a help message and exit.
 
 =back
 
+=head1 CONFORMING TO
+
+README.package-tests shipped by autopkgtest 2.6
+
 =head1 SEE ALSO
 
 B<adt-run>(1)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list