]> err.no Git - dak/commitdiff
Improve error message for uploads that miss files.
authorAnsgar Burchardt <ansgar@debian.org>
Tue, 18 Sep 2012 19:40:49 +0000 (21:40 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Tue, 18 Sep 2012 21:21:15 +0000 (23:21 +0200)
daklib/checks.py
daklib/upload.py

index 2e76e78329c8e6fd57d74e2d0d890d33d64f55ba..7298026208a82a8f231812b253a581f7c9b5d2f0 100644 (file)
@@ -34,6 +34,7 @@ import daklib.utils as utils
 import apt_inst
 import apt_pkg
 from apt_pkg import version_compare
+import errno
 import os
 import time
 import yaml
@@ -165,13 +166,23 @@ class ChangesCheck(Check):
 class HashesCheck(Check):
     """Check hashes in .changes and .dsc are valid."""
     def check(self, upload):
-        changes = upload.changes
-        for f in changes.files.itervalues():
-            f.check(upload.directory)
-        source = changes.source
-        if source is not None:
-            for f in source.files.itervalues():
+        what = None
+        try:
+            changes = upload.changes
+            what = changes.filename
+            for f in changes.files.itervalues():
                 f.check(upload.directory)
+            source = changes.source
+            what = source.filename
+            if source is not None:
+                for f in source.files.itervalues():
+                    f.check(upload.directory)
+        except IOError as e:
+            if e.errno == errno.ENOENT:
+                raise Reject('{0} refers to non-existing file: {1}\n'
+                             'Perhaps you need to include it in your upload?'
+                             .format(what, os.path.basename(e.filename)))
+            raise
 
 class ExternalHashesCheck(Check):
     """Checks hashes in .changes and .dsc against an external database."""
index c55c4090496818d9c5f5cf07f64ec6445d58e7af..447fa34a4805272b84adecd5126f69ec37426338 100644 (file)
@@ -489,3 +489,10 @@ class Source(object):
         if len(fields) > 1:
             return fields[0]
         return "main"
+
+    @property
+    def filename(self):
+        """filename of .dsc file
+        @type: str
+        """
+        return self._dsc_file.filename