]> git.decadent.org.uk Git - dak.git/blobdiff - katie
claire on non-us
[dak.git] / katie
diff --git a/katie b/katie
index df97db7d8796bff4961f4fa4f23874e5658f218d..5596586d14d3a0042ff50160c64a88c66232096a 100755 (executable)
--- a/katie
+++ b/katie
@@ -2,7 +2,7 @@
 
 # Installs Debian packaes
 # Copyright (C) 2000  James Troup <james@nocrew.org>
-# $Id: katie,v 1.19 2001-01-18 04:51:10 troup Exp $
+# $Id: katie,v 1.22 2001-01-23 20:27:35 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
@@ -94,7 +94,7 @@ def usage (exit_code):
   -d, --debug=VALUE         debug
   -k, --ack-new             acknowledge new packages
   -m, --manual-reject=MSG   manual reject with `msg'
-  -n, --dry-run             don't do anything
+  -n, --no-action           don't do anything
   -p, --no-lock             don't check lockfile !! for cron.daily only !!
   -r, --no-version-check    override version check
   -u, --distribution=DIST   override distribution to `dist'"""
@@ -105,7 +105,7 @@ def check_signature (filename):
 
     (result, output) = commands.getstatusoutput("gpg --emulate-md-encode-bug --batch --no-options --no-default-keyring --always-trust --keyring=%s --keyring=%s < %s >/dev/null" % (Cnf["Dinstall::PGPKeyring"], Cnf["Dinstall::GPGKeyring"], filename))
     if (result != 0):
-        reject_message = "Rejected: GPG signature check failed on `%s'.\n%s\n" % (filename, output)
+        reject_message = "Rejected: GPG signature check failed on `%s'.\n%s\n" % (os.path.basename(filename), output)
         return 0
     return 1
 
@@ -207,11 +207,13 @@ def check_changes(filename):
     # Map frozen to unstable if frozen doesn't exist
     if changes["distribution"].has_key("frozen") and not Cnf.has_key("Suite::Frozen"):
         del changes["distribution"]["frozen"]
+        changes["distribution"]["unstable"] = 1;
         reject_message = reject_message + "Mapping frozen to unstable.\n"
 
     # Map testing to unstable
     if changes["distribution"].has_key("testing"):
         del changes["distribution"]["testing"]
+        changes["distribution"]["unstable"] = 1;
         reject_message = reject_message + "Mapping testing to unstable.\n"
 
     # Ensure target distributions exist
@@ -219,12 +221,17 @@ def check_changes(filename):
         if not Cnf.has_key("Suite::%s" % (i)):
             reject_message = reject_message + "Rejected: Unknown distribution `%s'.\n" % (i)
 
+    # Ensure there _is_ a target distribution
+    if changes["distribution"].keys() == []:
+        reject_message = reject_message + "Rejected: huh? Distribution field is empty in changes file.\n";
+            
     # Map unreleased arches from stable to unstable
     if changes["distribution"].has_key("stable"):
         for i in changes["architecture"].keys():
             if not Cnf.has_key("Suite::Stable::Architectures::%s" % (i)):
                 reject_message = reject_message + "Mapping stable to unstable for unreleased arch `%s'.\n" % (i)
                 del changes["distribution"]["stable"]
+                changes["distribution"]["unstable"] = 1;
     
     # Map arches not being released from frozen to unstable
     if changes["distribution"].has_key("frozen"):
@@ -232,6 +239,7 @@ def check_changes(filename):
             if not Cnf.has_key("Suite::Frozen::Architectures::%s" % (i)):
                 reject_message = reject_message + "Mapping frozen to unstable for non-releasing arch `%s'.\n" % (i)
                 del changes["distribution"]["frozen"]
+                changes["distribution"]["unstable"] = 1;
 
     # Handle uploads to stable
     if changes["distribution"].has_key("stable"):
@@ -280,8 +288,15 @@ def check_files():
             files[file]["type"] = "byhand";
         # Checks for a binary package...
         elif re_isadeb.match(file) != None:
+            files[file]["type"] = "deb";
+
             # Extract package information using dpkg-deb
-            control = apt_pkg.ParseSection(apt_inst.debExtractControl(utils.open_file(file,"r")))
+            try:
+                control = apt_pkg.ParseSection(apt_inst.debExtractControl(utils.open_file(file,"r")))
+            except:
+                reject_message = reject_message + "Rejected: %s: debExtractControl() raised %s.\n" % (file, sys.exc_type);
+                # Can't continue, none of the checks on control would work.
+                continue;
 
             # Check for mandatory fields
             if control.Find("Package") == None:
@@ -320,7 +335,6 @@ def check_files():
                 files[file]["dbtype"] = "deb";
             else:
                 reject_message = reject_message + "Rejected: %s is neither a .deb or a .udeb.\n " % (file);
-            files[file]["type"] = "deb";
             files[file]["fullname"] = "%s_%s_%s.deb" % (control.Find("Package", ""), epochless_version, control.Find("Architecture", ""))
             files[file]["source"] = control.Find("Source", "");
             if files[file]["source"] == "":
@@ -359,7 +373,7 @@ def check_files():
             else:
                 files[file]["byhand"] = 1;
                 files[file]["type"] = "byhand";
-                
+
         files[file]["oldfiles"] = {}
         for suite in changes["distribution"].keys():
             # Skip byhand
@@ -412,7 +426,7 @@ def check_files():
             # Check the md5sum & size against existing files (if any)
             location = Cnf["Dir::PoolDir"];
             files[file]["location id"] = db_access.get_location_id (location, component, archive);
-            
+
             files[file]["pool name"] = utils.poolify (changes["source"], files[file]["component"]);
             files_id = db_access.get_files_id(files[file]["pool name"] + file, files[file]["size"], files[file]["md5sum"], files[file]["location id"]);
             if files_id == -1: