]> git.decadent.org.uk Git - dak.git/commitdiff
Merge branch 'small-fixes'
authorAnsgar Burchardt <ansgar@debian.org>
Tue, 18 Sep 2012 21:23:05 +0000 (23:23 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Tue, 18 Sep 2012 21:23:05 +0000 (23:23 +0200)
daklib/archive.py
daklib/checks.py
daklib/upload.py

index 677d783cdd04530e9752b2656d422f4de5e6adda..0f3a316e79f4f9a0c41959098cd6bccd422959ab 100644 (file)
@@ -950,7 +950,7 @@ class ArchiveUpload(object):
         if suite.copychanges:
             src = os.path.join(self.directory, self.changes.filename)
             dst = os.path.join(suite.archive.path, 'dists', suite.suite_name, self.changes.filename)
-            self.transaction.fs.copy(src, dst)
+            self.transaction.fs.copy(src, dst, mode=suite.archive.mode)
 
         return (db_source, db_binaries)
 
@@ -998,7 +998,7 @@ class ArchiveUpload(object):
         self.transaction.session.flush()
 
         dst = os.path.join(policy_queue.path, self.changes.filename)
-        self.transaction.fs.copy(self.changes.path, dst)
+        self.transaction.fs.copy(self.changes.path, dst, mode=policy_queue.change_perms)
 
         return u
 
@@ -1075,7 +1075,7 @@ class ArchiveUpload(object):
 
         src = os.path.join(self.directory, hashed_file.filename)
         dst = os.path.join(policy_queue.path, hashed_file.filename)
-        fs.copy(src, dst)
+        fs.copy(src, dst, mode=policy_queue.change_perms)
 
         return byhand_file
 
index 2e76e78329c8e6fd57d74e2d0d890d33d64f55ba..f073d52fa43bc3d785667b7f15ce355ffd5941f5 100644 (file)
@@ -30,10 +30,12 @@ from daklib.regexes import *
 from daklib.textutils import fix_maintainer, ParseMaintError
 import daklib.lintian as lintian
 import daklib.utils as utils
+from daklib.upload import InvalidHashException
 
 import apt_inst
 import apt_pkg
 from apt_pkg import version_compare
+import errno
 import os
 import time
 import yaml
@@ -165,13 +167,25 @@ 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
+        except InvalidHashException as e:
+            raise Reject('{0}: {1}'.format(what, unicode(e)))
 
 class ExternalHashesCheck(Check):
     """Checks hashes in .changes and .dsc against an external database."""
index c55c4090496818d9c5f5cf07f64ec6445d58e7af..dcd008aae5e28aa1e81aea1240eb823c24ee488d 100644 (file)
@@ -439,6 +439,10 @@ class Source(object):
                     raise InvalidSourceException("Multiple .dsc found ({0} and {1})".format(self._dsc_file.filename, f.filename))
                 else:
                     self._dsc_file = f
+
+        # make sure the hash for the dsc is valid before we use it
+        self._dsc_file.check(directory)
+
         dsc_file_path = os.path.join(directory, self._dsc_file.filename)
         data = open(dsc_file_path, 'r').read()
         self._signed_file = SignedFile(data, keyrings, require_signature)
@@ -489,3 +493,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