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)
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
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
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
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."""
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)
if len(fields) > 1:
return fields[0]
return "main"
+
+ @property
+ def filename(self):
+ """filename of .dsc file
+ @type: str
+ """
+ return self._dsc_file.filename