]> err.no Git - dak/commitdiff
init_db.py: fixes for `do_suite'
authorMario Domenech Goulart <mario@ossystems.com.br>
Mon, 8 Feb 2010 18:37:25 +0000 (16:37 -0200)
committerMario Domenech Goulart <mario@ossystems.com.br>
Mon, 8 Feb 2010 18:37:25 +0000 (16:37 -0200)
* set `suite_name' mandatory field for the the Suite object

* set `suite_id' for the SuiteArchitecture object

Signed-off-by: Mario Domenech Goulart <mario@ossystems.com.br>
dak/init_db.py

index ea8083ee37c148f81da24ec717fd63066ac87a04..a34ec4cfac2114f5e34123bc47040a2ccab19e64 100755 (executable)
@@ -133,7 +133,9 @@ class InitDB(object):
         s.query(Suite).delete()
 
         for suite in self.Cnf.SubTree("Suite").List():
+            suite = suite.lower()
             su = Suite()
+            su.suite_name  = suite
             su.version     = self.Cnf.get("Suite::%s::Version" % suite, "-")
             su.origin      = self.Cnf.get("Suite::%s::Origin" % suite, "")
             su.description = self.Cnf.get("Suite::%s::Description" % suite, "")
@@ -141,11 +143,11 @@ class InitDB(object):
 
             for architecture in self.Cnf.ValueList("Suite::%s::Architectures" % (suite)):
                 sa = SuiteArchitecture()
-                sa.suite_id = su.suite_id
                 a = s.query(Architecture).filter_by(arch_string=architecture)
                 if a.count() < 1:
                     utils.fubar("E: Architecture %s not found for suite %s" % (architecture, suite))
                 sa.arch_id = a.one().arch_id
+                sa.suite_id = su.suite_id
                 s.add(sa)
 
         s.commit()