From: Tollef Fog Heen Date: Tue, 17 Sep 2013 12:55:18 +0000 (+0200) Subject: daklib/archive.py: Use Package-List for choosing component X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e116529b4652a3cd6224724fe26c047973f89416;p=dak daklib/archive.py: Use Package-List for choosing component When we are looking at a source-only upload, prefer to look at the Package-List field from the source package rather than just picking a random component. Signed-off-by: Tollef Fog Heen --- diff --git a/daklib/archive.py b/daklib/archive.py index 410e9cab..16b1aaa2 100644 --- a/daklib/archive.py +++ b/daklib/archive.py @@ -1260,9 +1260,11 @@ class ArchiveUpload(object): source_component_name = guess break if source_component_name is None: - source_component = self.session.query(Component).order_by(Component.component_id).first() - else: - source_component = self.session.query(Component).filter_by(component_name=source_component_name).one() + # Source-only upload, use Package-List: + source_component_name = source.package_list.values()[0]['component'] + if source_component_name not in suite.components: + raise ArchiveException('Component {0} does not exist in suite {1}.'.format(source_component_name, suite.suite_name)) + source_component = self.session.query(Component).filter_by(component_name=source_component_name).one() source_component_func = lambda source: source_component db_changes = self._install_changes()