]> err.no Git - dak/commitdiff
daklib/archive.py: Use Package-List for choosing component
authorTollef Fog Heen <tfheen@varnish-software.com>
Tue, 17 Sep 2013 12:55:18 +0000 (14:55 +0200)
committerTollef Fog Heen <tfheen@err.no>
Tue, 17 Sep 2013 12:55:18 +0000 (14:55 +0200)
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 <tfheen@err.no>
daklib/archive.py

index 410e9cabd7eabbcdc2d2ac243ed45faf0edc088f..16b1aaa22f621831aa9975b4142f276839367e71 100644 (file)
@@ -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()