[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] Only publish components in suites where they exist.



When generating the sources and packages file, just generate those
that should exist, according to the component_suite mapping.

Signed-off-by: Tollef Fog Heen <tfheen@varnish-software.com>
---
 dak/generate_packages_sources2.py |    2 +-
 dak/generate_releases.py          |    2 +-
 daklib/dbconn.py                  |    6 +++++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/dak/generate_packages_sources2.py b/dak/generate_packages_sources2.py
index d941d98..2c69afc 100755
--- a/dak/generate_packages_sources2.py
+++ b/dak/generate_packages_sources2.py
@@ -364,7 +364,6 @@ def main():
 
     force = Options.has_key("Force") and Options["Force"]
 
-    component_ids = [ c.component_id for c in session.query(Component).all() ]
 
     def parse_results(message):
         # Split out into (code, msg)
@@ -377,6 +376,7 @@ def main():
             logger.log(['E: ', msg])
 
     for s in suites:
+        component_ids = [ c.component_id for c in s.components ]
         if s.untouchable and not force:
             import utils
             utils.fubar("Refusing to touch %s (untouchable and not forced)" % s.suite_name)
diff --git a/dak/generate_releases.py b/dak/generate_releases.py
index c80e0d9..a86c33c 100755
--- a/dak/generate_releases.py
+++ b/dak/generate_releases.py
@@ -170,7 +170,7 @@ class ReleaseWriter(object):
 
         out.write("Architectures: %s\n" % (" ".join([a.arch_string for a in architectures])))
 
-        components = [ c.component_name for c in session.query(Component) ]
+        components = [ c.component_name for c in suite.components ]
 
         out.write("Components: %s\n" % (" ".join(components)))
 
diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index b5d1ea8..e611d47 100644
--- a/daklib/dbconn.py
+++ b/daklib/dbconn.py
@@ -2560,6 +2560,7 @@ class DBConn(object):
             'changelogs_text',
             'changes',
             'component',
+            'component_suite',
             'config',
             'dsc_files',
             'external_overrides',
@@ -2835,7 +2836,10 @@ class DBConn(object):
                                  srcformats = relation(SrcFormat, secondary=self.tbl_suite_src_formats,
                                      backref=backref('suites', lazy='dynamic')),
                                  archive = relation(Archive, backref='suites'),
-                                 acls = relation(ACL, secondary=self.tbl_suite_acl_map, collection_class=set)),
+                                 acls = relation(ACL, secondary=self.tbl_suite_acl_map, collection_class=set),
+                                 components = relation(Component, secondary=self.tbl_component_suite,
+                                                   order_by=self.tbl_component.c.ordering,
+                                                   backref=backref('suite'))),
                 extension = validator)
 
         mapper(Uid, self.tbl_uid,
-- 
1.7.10.4



Reply to: