]> git.decadent.org.uk Git - dak.git/blobdiff - neve
add OverrideSuite for w-p-u
[dak.git] / neve
diff --git a/neve b/neve
index b29e5a53d67cb4c9fc85adb017ee23cd86b0de96..eb94e2e3e72c2ff9ff3a20d4858060df8cce2e81 100755 (executable)
--- a/neve
+++ b/neve
@@ -2,7 +2,7 @@
 
 # Populate the DB
 # Copyright (C) 2000, 2001, 2002  James Troup <james@nocrew.org>
-# $Id: neve,v 1.9 2002-05-08 11:18:24 troup Exp $
+# $Id: neve,v 1.13 2002-06-09 17:33:46 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
@@ -37,7 +37,7 @@
 
 ###############################################################################
 
-import commands, os, pg, re, select, string, sys, tempfile, time;
+import commands, os, pg, re, select, string, tempfile, time;
 import apt_pkg;
 import db_access, utils;
 
@@ -148,7 +148,7 @@ def reject (str, prefix="Rejected: "):
 def check_signature (filename):
     if not utils.re_taint_free.match(os.path.basename(filename)):
         reject("!!WARNING!! tainted filename: '%s'." % (filename));
-        return 0;
+        return None;
 
     status_read, status_write = os.pipe();
     cmd = "gpgv --status-fd %s --keyring %s --keyring %s %s" \
@@ -171,7 +171,7 @@ def check_signature (filename):
             internal_error = internal_error + "gpgv status line is malformed (incorrect prefix '%s').\n" % (gnupg);
             continue;
         args = split[2:];
-        if keywords.has_key(keyword) and keyword != "NODATA":
+        if keywords.has_key(keyword) and keyword != "NODATA" and keyword != "SIGEXPIRED":
             internal_error = internal_error + "found duplicate status token ('%s')." % (keyword);
             continue;
         else:
@@ -186,8 +186,7 @@ def check_signature (filename):
 
     # Now check for obviously bad things in the processed output
     if keywords.has_key("SIGEXPIRED"):
-        reject("key used to sign %s has expired." % (filename));
-        bad = 1;
+        utils.warn("%s: signing key has expired." % (filename));
     if keywords.has_key("KEYREVOKED"):
         reject("key used to sign %s has been revoked." % (filename));
         bad = 1;
@@ -309,10 +308,20 @@ def update_suites ():
         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():
+        for architecture in Cnf.ValueList("Suite::%s::Architectures" % (suite)):
             architecture_id = db_access.get_architecture_id (architecture);
             projectB.query("INSERT INTO suite_architectures (suite, architecture) VALUES (currval('suite_id_seq'), %d)" % (architecture_id));
 
+def update_override_type():
+    projectB.query("DELETE FROM override_type");
+    for type in Cnf.ValueList("OverrideType"):
+        projectB.query("INSERT INTO override_type (type) VALUES ('%s')" % (type));
+
+def update_priority():
+    projectB.query("DELETE FROM priority");
+    for priority in Cnf.SubTree("Priority").List():
+        projectB.query("INSERT INTO priority (priority, level) VALUES ('%s', %s)" % (priority, Cnf["Priority::%s" % (priority)]));
+
 ###############################################################################
 
 def get_or_set_files_id (filename, size, md5sum, location_id):
@@ -333,8 +342,6 @@ def process_sources (location, filename, suite, component, archive, dsc_dir):
 
     suite = string.lower(suite);
     suite_id = db_access.get_suite_id(suite);
-    if suite == 'stable':
-        testing_id = db_access.get_suite_id("testing");
     try:
         file = utils.open_file (filename);
     except utils.cant_open_exc:
@@ -398,10 +405,6 @@ def process_sources (location, filename, suite, component, archive, dsc_dir):
 
         src_associations_id_serial = src_associations_id_serial + 1;
         src_associations_query_cache.write("%d\t%d\t%d\n" % (src_associations_id_serial, suite_id, tmp_source_id))
-        # populate 'testing' with a mirror of 'stable'
-        if suite == "stable":
-            src_associations_id_serial = src_associations_id_serial + 1;
-            src_associations_query_cache.write("%d\t%d\t%d\n" % (src_associations_id_serial, testing_id, tmp_source_id))
 
     file.close();
 
@@ -414,8 +417,6 @@ def process_packages (location, filename, suite, component, archive):
     count_bad = 0;
     suite = string.lower(suite);
     suite_id = db_access.get_suite_id(suite);
-    if suite == "stable":
-        testing_id = db_access.get_suite_id("testing");
     try:
         file = utils.open_file (filename);
     except utils.cant_open_exc:
@@ -473,9 +474,6 @@ def process_packages (location, filename, suite, component, archive):
 
             bin_associations_id_serial = bin_associations_id_serial + 1;
             bin_associations_query_cache.write("%d\t%d\t%d\n" % (bin_associations_id_serial, suite_id, tmp_binaries_id));
-            if suite == "stable":
-                bin_associations_id_serial = bin_associations_id_serial + 1;
-                bin_associations_query_cache.write("%d\t%d\t%d\n" % (bin_associations_id_serial, testing_id, tmp_binaries_id));
             count_total = count_total +1;
 
     file.close();
@@ -522,6 +520,8 @@ def main ():
     update_archives();
     update_locations();
     update_suites();
+    update_override_type();
+    update_priority();
     projectB.query("COMMIT WORK");
 
     files_query_cache = utils.open_file(Cnf["Neve::ExportDir"]+"files","w");
@@ -542,9 +542,9 @@ def main ():
             suite = Cnf.Find("Location::%s::Suite" % (location));
             do_sources(location, prefix, suite, "",  server);
         elif type == "legacy":
-            for suite in Cnf.SubTree("Location::%s::Suites" % (location)).List():
+            for suite in Cnf.ValueList("Location::%s::Suites" % (location)):
                 for component in Cnf.SubTree("Component").List():
-                    prefix = Cnf.Find("Suite::%s::CodeName" % (suite)) + '/' + component + '/source/'
+                    prefix = Cnf["Suite::%s::CodeName" % (suite)] + '/' + component + '/source/'
                     do_sources(location, prefix, suite, component, server);
         elif type == "pool":
             continue;
@@ -566,12 +566,12 @@ def main ():
             print 'Processing '+location+'...';
             process_packages (location, packages, suite, "", server);
         elif type == "legacy":
-            for suite in Cnf.SubTree("Location::%s::Suites" % (location)).List():
+            for suite in Cnf.ValueList("Location::%s::Suites" % (location)):
                 for component in Cnf.SubTree("Component").List():
-                    for architecture in Cnf.SubTree("Suite::%s::Architectures" % (suite)).List():
-                        if architecture == "source" or architecture == "all":
-                            continue;
-                        packages = location + Cnf.Find("Suite::%s::CodeName" % (suite)) + '/' + component + '/binary-' + architecture + '/Packages'
+                    architectures = filter(utils.real_arch,
+                                           Cnf.ValueList("Suite::%s::Architectures" % (suite)));
+                    for architecture in architectures:
+                        packages = location + Cnf["Suite::%s::CodeName" % (suite)] + '/' + component + '/binary-' + architecture + '/Packages'
                         print 'Processing '+packages+'...';
                         process_packages (location, packages, suite, component, server);
         elif type == "pool":