__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
@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
"""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
# 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)