]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/policy.py
Add by-hash support
[dak.git] / daklib / policy.py
index dad9e9d1ec20c685848dac377ae23ecf87e70942..aa5f12f0ac141e10e04552c11449ff842618cea2 100644 (file)
@@ -17,7 +17,7 @@
 """module to process policy queue uploads"""
 
 from .config import Config
-from .dbconn import BinaryMetadata, Component, MetadataKey, Override, OverrideType, Suite, get_mapped_component
+from .dbconn import BinaryMetadata, Component, MetadataKey, Override, OverrideType, Suite, get_mapped_component, get_mapped_component_name
 from .fstransactions import FilesystemTransaction
 from .regexes import re_file_changes, re_file_safe
 from .packagelist import PackageList
@@ -87,7 +87,7 @@ class UploadCopy(object):
             for byhand in self.upload.byhand:
                 src = os.path.join(queue.path, byhand.filename)
                 dst = os.path.join(directory, byhand.filename)
-                if not os.path.exists(dst) or not ignore_existing:
+                if os.path.exists(src) and (not os.path.exists(dst) or not ignore_existing):
                     fs.copy(src, dst, mode=mode, symlink=symlink)
 
             # copy .changes
@@ -287,8 +287,9 @@ class PolicyQueueUploadHandler(object):
             # see daklib.archive.source_component_from_package_list
             # which we cannot use here as we might not have a Package-List
             # field for old packages
+            mapped_components = [ get_mapped_component_name(c) for c in components ]
             query = self.session.query(Component).order_by(Component.ordering) \
-                    .filter(Component.component_name.in_(components))
+                    .filter(Component.component_name.in_(mapped_components))
             source_component = query.first().component_name
 
             override = self._source_override(source_component)