From e116529b4652a3cd6224724fe26c047973f89416 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Tue, 17 Sep 2013 14:55:18 +0200 Subject: [PATCH] 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 --- daklib/archive.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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() -- 2.39.5