]> git.decadent.org.uk Git - dak.git/blobdiff - katie
overwriting existing files is no good, mmkay? fix chmod 664 on directories.
[dak.git] / katie
diff --git a/katie b/katie
index a3c3ea009be3e4402bd861f671a924500ca29fc4..574fe1f3468acd6766d77f8b7a5bf311eb5d09dc 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.1.1.1 2000-11-24 00:20:08 troup Exp $
+# $Id: katie,v 1.5 2000-11-30 04:19:30 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
@@ -108,7 +108,7 @@ def usage (exit_code):
 def check_signature (filename):
     global reject_message
 
-    (result, output) = commands.getstatusoutput("gpg --emulate-md-encode-bug --batch --no-options --no-default-keyring --always-trust --load-extension rsaref --keyring=%s --keyring=%s < %s >/dev/null" % (Cnf["Dinstall::PGPKeyring"], Cnf["Dinstall::GPGKeyring"], 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)
         return 0
@@ -133,6 +133,10 @@ def read_override_file (filename, suite, component):
 def in_override_p (package, component, suite):
     global overrides;
 
+    # Avoid <undef> on unknown distributions
+    if db_access.get_suite_id(suite) == -1:
+        return None;
+
     # FIXME: nasty non-US speficic hack
     if string.lower(component[:7]) == "non-us/":
         component = component[7:];
@@ -199,7 +203,6 @@ def check_changes(filename):
             if re_isanum.match (i) == None:
                 reject_message = reject_message + "Rejected: `%s' from Closes field isn't a number.\n" % (i)
 
-
     # 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"]
@@ -372,6 +375,11 @@ def check_files():
                         else:
                             reject_message = reject_message + "Rejected"
                         reject_message = reject_message + ": %s Old version `%s' >= new version `%s'.\n" % (file, oldfile["version"], files[file]["version"])
+                # Check for existing copies of the file
+                q = projectB.query("SELECT b.id FROM binaries b, architecture a WHERE b.package = '%s' AND b.version = '%s' AND a.arch_string = '%s' AND a.id = b.architecture" % (files[file]["package"], files[file]["version"], files[file]["architecture"]))
+                if q.getresult() != []:
+                    reject_message = reject_message + "Rejected: can not overwrite existing copy of '%s' already in the archive.\n" % (file)
+
             # Find any old .dsc files
             elif files[file]["type"] == "dsc":
                 q = projectB.query("SELECT s.id, s.version, f.filename, l.path, c.name FROM source s, src_associations sa, suite su, location l, component c, files f WHERE s.source = '%s' AND su.suite_name = '%s' AND sa.source = s.id AND sa.suite = su.id AND f.location = l.id AND l.component = c.id AND f.id = s.file"
@@ -435,6 +443,10 @@ def check_dsc ():
                 if files.has_key(dsc_file):
                     actual_md5 = files[dsc_file]["md5sum"]
                     found = "%s in incoming" % (dsc_file)
+                    # Check the file does not already exist in the archive
+                    q = projectB.query("SELECT f.id FROM files f, location l WHERE f.filename ~ '/%s' AND l.id = f.location" % (dsc_file));
+                    if q.getresult() != []:
+                        reject_message = reject_message + "Rejected: can not overwrite existing copy of '%s' already in the archive.\n" % (dsc_file)
                 elif dsc_file[-12:] == ".orig.tar.gz":
                     # Check in Incoming
                     # See comment above process_it() for explanation...
@@ -466,7 +478,7 @@ def check_dsc ():
                     continue;
                 if actual_md5 != dsc_files[dsc_file]["md5sum"]:
                     reject_message = reject_message + "Rejected: md5sum for %s doesn't match %s.\n" % (found, file)
-                
+
     if string.find(reject_message, "Rejected:") != -1:
         return 0
     else: 
@@ -664,9 +676,8 @@ def install (changes_filename, summary, short_summary):
 
     # Copy the .changes file across for suite which need it.
     for suite in changes["distribution"].keys():
-        if Cnf.has_key("Suties::%s::CopyChanges" % (suite)):
-            destination = Cnf["Dir::RootDir"] + Cnf["Suite::%s::CopyChanges" % (suite)] + os.path.basename(changes_filename)
-            copy_file (changes_filename, destination)
+        if Cnf.has_key("Suite::%s::CopyChanges" % (suite)):
+            utils.copy (changes_filename, Cnf["Dir::RootDir"] + Cnf["Suite::%s::CopyChanges" % (suite)]);
 
     # If the .orig.tar.gz is in a legacy directory we need to poolify
     # it, so that apt-get source (and anything else that goes by the
@@ -825,8 +836,8 @@ def announce (short_summary, action):
     summary = ""
 
     for dist in changes["distribution"].keys():
-        list = Cnf["Suite::%s::Announce" % (dist)]
-        if lists_done.has_key(list):
+        list = Cnf.Find("Suite::%s::Announce" % (dist))
+        if list == None or lists_done.has_key(list):
             continue
         lists_done[list] = 1
         summary = summary + "Announcing to %s\n" % (list)