]> git.decadent.org.uk Git - dak.git/blobdiff - neve
cleanups
[dak.git] / neve
diff --git a/neve b/neve
index eb092bab533f473b341f62379c8573a606003b5c..100de615ab60a673588c08260b88f7929c1b8f9b 100755 (executable)
--- a/neve
+++ b/neve
@@ -2,7 +2,7 @@
 
 # Populate the DB
 # Copyright (C) 2000, 2001  James Troup <james@nocrew.org>
-# $Id: neve,v 1.5 2001-09-14 17:15:39 troup Exp $
+# $Id: neve,v 1.6 2001-11-04 22:41:31 troup Exp $
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -117,8 +117,10 @@ def update_suites ():
     projectB.query("DELETE FROM suite")
     for suite in Cnf.SubTree("Suite").List():
         SubSec = Cnf.SubTree("Suite::%s" %(suite))
-        projectB.query("INSERT INTO suite (suite_name, version, origin, description) VALUES ('%s', '%s', '%s', '%s')"
-                       % (string.lower(suite), SubSec["Version"], SubSec["Origin"], SubSec["Description"]))
+        projectB.query("INSERT INTO suite (suite_name) VALUES ('%s')" % string.lower(suite));
+        for i in ("Version", "Origin", "Description"):
+            if SubSec.has_key(i):
+                projectB.query("UPDATE suite SET %s = '%s' WHERE suite_name = '%s'" % (string.lower(i), SubSec[i], string.lower(suite)))
         for architecture in Cnf.SubTree("Suite::%s::Architectures" % (suite)).List():
             architecture_id = db_access.get_architecture_id (architecture);
             projectB.query("INSERT INTO suite_architectures (suite, architecture) VALUES (currval('suite_id_seq'), %d)" % (architecture_id));
@@ -146,7 +148,7 @@ def process_sources (location, filename, suite, component, archive):
     if suite == 'stable':
         testing_id = db_access.get_suite_id("testing");
     try:
-        file = utils.open_file (filename, "r")
+        file = utils.open_file (filename);
     except utils.cant_open_exc:
         print "WARNING: can't open '%s'" % (filename);
         return;
@@ -221,7 +223,7 @@ def process_packages (location, filename, suite, component, archive):
     if suite == "stable":
         testing_id = db_access.get_suite_id("testing");
     try:
-        file = utils.open_file (filename, "r")
+        file = utils.open_file (filename);
     except utils.cant_open_exc:
         print "WARNING: can't open '%s'" % (filename);
         return;
@@ -313,7 +315,7 @@ def main ():
     print "Re-Creating DB..."
     (result, output) = commands.getstatusoutput("psql -f init_pool.sql")
     if (result != 0):
-        sys.exit(2)
+        utils.fubar("psql invocation failed!\n", result);
     print output
 
     projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]), None, None, 'postgres')