]> git.decadent.org.uk Git - dak.git/commitdiff
daklib/checks.py, daklib/utils.py: check for source files
authorAnsgar Burchardt <ansgar@debian.org>
Sat, 7 Jul 2012 17:59:44 +0000 (11:59 -0600)
committerAnsgar Burchardt <ansgar@debian.org>
Sat, 11 Aug 2012 11:43:06 +0000 (13:43 +0200)
Reintroduce the check that all source files for the used format are
actually included.

daklib/checks.py
daklib/utils.py

index 06626fd16aae59b4de48dfd2b425c7a2c6ec7875..6091bc73f60deca61c50a74155022fd0bd475f45 100644 (file)
@@ -338,7 +338,11 @@ class SourceCheck(Check):
                 except Exception as e:
                     raise Reject('{0}: APT could not parse {1} field: {2}'.format(dsc_fn, field, e))
 
                 except Exception as e:
                     raise Reject('{0}: APT could not parse {1} field: {2}'.format(dsc_fn, field, e))
 
-        # TODO: check all expected files for given source format are included
+        rejects = utils.check_dsc_files(dsc_fn, control, source.files.keys())
+        if len(rejects) > 0:
+            raise Reject("\n".join(rejects))
+
+        return True
 
 class SingleDistributionCheck(Check):
     """Check that the .changes targets only a single distribution."""
 
 class SingleDistributionCheck(Check):
     """Check that the .changes targets only a single distribution."""
index 25549f049c95656df3b48759e83ad940f97dcb95..7b73df138de6b4a41a712872ac78465d89112f23 100644 (file)
@@ -368,7 +368,7 @@ def check_size(where, files):
 
 ################################################################################
 
 
 ################################################################################
 
-def check_dsc_files(dsc_filename, dsc=None, dsc_files=None):
+def check_dsc_files(dsc_filename, dsc, dsc_files):
     """
     Verify that the files listed in the Files field of the .dsc are
     those expected given the announced Format.
     """
     Verify that the files listed in the Files field of the .dsc are
     those expected given the announced Format.
@@ -387,13 +387,6 @@ def check_dsc_files(dsc_filename, dsc=None, dsc_files=None):
     """
     rejmsg = []
 
     """
     rejmsg = []
 
-    # Parse the file if needed
-    if dsc is None:
-        dsc = parse_changes(dsc_filename, signing_rules=1, dsc_file=1);
-
-    if dsc_files is None:
-        dsc_files = build_file_list(dsc, is_a_dsc=1)
-
     # Ensure .dsc lists proper set of source files according to the format
     # announced
     has = defaultdict(lambda: 0)
     # Ensure .dsc lists proper set of source files according to the format
     # announced
     has = defaultdict(lambda: 0)
@@ -408,7 +401,7 @@ def check_dsc_files(dsc_filename, dsc=None, dsc_files=None):
         (r'orig-.+\.tar\.(gz|bz2|xz)', ('more_orig_tar',)),
     )
 
         (r'orig-.+\.tar\.(gz|bz2|xz)', ('more_orig_tar',)),
     )
 
-    for f in dsc_files.keys():
+    for f in dsc_files:
         m = re_issource.match(f)
         if not m:
             rejmsg.append("%s: %s in Files field not recognised as source."
         m = re_issource.match(f)
         if not m:
             rejmsg.append("%s: %s in Files field not recognised as source."