]> git.decadent.org.uk Git - dak.git/commitdiff
Fix handling of mapped components in process-new
authorAnsgar Burchardt <ansgar@debian.org>
Wed, 12 Aug 2015 07:58:02 +0000 (09:58 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Wed, 12 Aug 2015 07:58:02 +0000 (09:58 +0200)
I really would like to get rid of mapped components on security-master...

daklib/dbconn.py
daklib/policy.py

index a599e5c1cf1c96fb63498f19e2ff55cb77677666..973fa797552fe3ae86025e4ccff7d9e31248743a 100644 (file)
@@ -691,6 +691,16 @@ def get_component(component, session=None):
 
 __all__.append('get_component')
 
+def get_mapped_component_name(component_name):
+    cnf = Config()
+    for m in cnf.value_list("ComponentMappings"):
+        (src, dst) = m.split()
+        if component_name == src:
+            component_name = dst
+    return component_name
+
+__all__.append('get_mapped_component_name')
+
 @session_wrapper
 def get_mapped_component(component_name, session=None):
     """get component after mappings
@@ -709,11 +719,7 @@ def get_mapped_component(component_name, session=None):
     @rtype:  L{daklib.dbconn.Component} or C{None}
     @return: component after applying maps or C{None}
     """
-    cnf = Config()
-    for m in cnf.value_list("ComponentMappings"):
-        (src, dst) = m.split()
-        if component_name == src:
-            component_name = dst
+    component_name = get_mapped_component_name(component_name)
     component = session.query(Component).filter_by(component_name=component_name).first()
     return component
 
index dad9e9d1ec20c685848dac377ae23ecf87e70942..3c986c8071d678d2e74187785e8d584dcd936958 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
@@ -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)