]> git.decadent.org.uk Git - dak.git/blobdiff - katie
add a -r/--regex option
[dak.git] / katie
diff --git a/katie b/katie
index c84167c25617aecade8247d32a9692ddb94b124f..ca90a9d1d0125254291ba652b8eaecc8dd797872 100755 (executable)
--- a/katie
+++ b/katie
@@ -2,7 +2,7 @@
 
 # Installs Debian packages
 # Copyright (C) 2000, 2001  James Troup <james@nocrew.org>
-# $Id: katie,v 1.69 2002-02-12 23:13:59 troup Exp $
+# $Id: katie,v 1.75 2002-03-08 03:59:50 rmurray 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
@@ -39,7 +39,7 @@ import db_access, katie, logging, utils;
 ###############################################################################
 
 # Globals
-katie_version = "$Revision: 1.69 $";
+katie_version = "$Revision: 1.75 $";
 
 Cnf = None;
 Options = None;
@@ -196,12 +196,11 @@ def action ():
             answer = 'I';
 
     while string.find(prompt, answer) == -1:
-        print prompt,;
-        answer = utils.our_raw_input()
-        m = katie.re_default_answer.match(prompt)
+        answer = utils.our_raw_input(prompt);
+        m = katie.re_default_answer.match(prompt);
         if answer == "":
-            answer = m.group(1)
-        answer = string.upper(answer[:1])
+            answer = m.group(1);
+        answer = string.upper(answer[:1]);
 
     if answer == 'R':
         do_reject ();
@@ -219,11 +218,12 @@ def action ():
 
 def do_reject ():
     Subst["__REJECTOR_ADDRESS__"] = Cnf["Dinstall::MyEmailAddress"];
-    Subst["__MANUAL_REJECT_MESSAGE__"] = Cnf["Dinstall::MyEmailAddress"];
+    Subst["__REJECT_MESSAGE__"] = reject_message;
+    Subst["__CC__"] = "Cc: " + Cnf["Dinstall::MyEmailAddress"];
     reject_mail_message = utils.TemplateSubst(Subst,utils.open_file(Cnf["Dir::TemplatesDir"]+"/katie.unaccept").read());
 
     # Write the rejection email out as the <foo>.reason file
-    reason_filename = pkg.changes_file[:-8] + ".reason";
+    reason_filename = os.path.basename(pkg.changes_file[:-8]) + ".reason";
     reject_filename = Cnf["Dir::QueueRejectDir"] + '/' + reason_filename;
     # If we fail here someone is probably trying to exploit the race
     # so let's just raise an exception ...
@@ -260,7 +260,7 @@ def install ():
             install_date = time.strftime("%Y-%m-%d", time.localtime(time.time()));
             filename = files[file]["pool name"] + file;
             dsc_location_id = files[file]["location id"];
-            if not files[file]["files id"]:
+            if not files[file].has_key("files id") or not files[file]["files id"]:
                 files[file]["files id"] = db_access.set_files_id (filename, files[file]["size"], files[file]["md5sum"], dsc_location_id)
             projectB.query("INSERT INTO source (source, version, maintainer, file, install_date, sig_fpr) VALUES ('%s', '%s', %d, %d, '%s', %s)"
                            % (package, version, maintainer_id, files[file]["files id"], install_date, fingerprint_id));
@@ -299,14 +299,16 @@ def install ():
             source = files[file]["source package"]
             source_version = files[file]["source version"];
             filename = files[file]["pool name"] + file;
-            if not files[file]["files id"]:
+           if not files[file].has_key("location id") or not files[file]["location id"]:
+               files[file]["location id"] = db_access.get_location_id(Cnf["Dir::PoolDir"],files[file]["component"],utils.where_am_i());
+            if not files[file].has_key("files id") or not files[file]["files id"]:
                 files[file]["files id"] = db_access.set_files_id (filename, files[file]["size"], files[file]["md5sum"], files[file]["location id"])
             source_id = db_access.get_source_id (source, source_version);
             if source_id:
                 projectB.query("INSERT INTO binaries (package, version, maintainer, source, architecture, file, type, sig_fpr) VALUES ('%s', '%s', %d, %d, %d, %d, '%s', %d)"
                                % (package, version, maintainer_id, source_id, architecture_id, files[file]["files id"], type, fingerprint_id));
             else:
-                projectB.query("INSERT INTO binaries (package, version, maintainer, architecture, file, type) VALUES ('%s', '%s', %d, %d, %d, '%s', %d)"
+                projectB.query("INSERT INTO binaries (package, version, maintainer, architecture, file, type, sig_fpr) VALUES ('%s', '%s', %d, %d, %d, '%s', %d)"
                                % (package, version, maintainer_id, architecture_id, files[file]["files id"], type, fingerprint_id));
             for suite in changes["distribution"].keys():
                 suite_id = db_access.get_suite_id(suite);
@@ -382,6 +384,10 @@ def install ():
 ################################################################################
 
 def process_it (changes_file):
+    global reject_message;
+
+    reject_message = "";
+
     # Absolutize the filename to avoid the requirement of being in the
     # same directory as the .changes file.
     pkg.changes_file = os.path.abspath(changes_file);
@@ -392,6 +398,7 @@ def process_it (changes_file):
 
     Katie.init_vars();
     Katie.update_vars();
+    Katie.update_subst();
     check();
     action();