]> git.decadent.org.uk Git - dak.git/blobdiff - lauren
Add new top level directories
[dak.git] / lauren
diff --git a/lauren b/lauren
index e2dbcd71cd637181cd529fc5d7a466b6af71de71..72bd88007f458b2df5ccd4b22c0e90c7ad278619 100755 (executable)
--- a/lauren
+++ b/lauren
@@ -1,8 +1,8 @@
 #!/usr/bin/env python
 
 # Manually reject packages for proprosed-updates
-# Copyright (C) 2001, 2002, 2003  James Troup <james@nocrew.org>
-# $Id: lauren,v 1.1 2003-02-21 19:18:05 troup Exp $
+# Copyright (C) 2001, 2002, 2003, 2004  James Troup <james@nocrew.org>
+# $Id: lauren,v 1.4 2004-04-01 17:13:11 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
 
 ################################################################################
 
-import os, pg, sys, tempfile;
+import os, pg, sys;
 import db_access, katie, logging, utils;
 import apt_pkg;
 
 ################################################################################
 
 # Globals
-lauren_version = "$Revision: 1.1 $";
+lauren_version = "$Revision: 1.4 $";
 
 Cnf = None;
 Options = None;
@@ -123,9 +123,7 @@ def reject (reject_message = ""):
     # If we weren't given a manual rejection message, spawn an editor
     # so the user can add one in...
     if not reject_message:
-        temp_filename = tempfile.mktemp();
-        fd = os.open(temp_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700);
-        os.close(fd);
+        temp_filename = utils.temp_filename();
         editor = os.environ.get("EDITOR","vi")
         answer = 'E';
         while answer == 'E':
@@ -199,15 +197,22 @@ def reject (reject_message = ""):
             architecture = files[file]["architecture"];
             q = projectB.query("SELECT b.id FROM binaries b, architecture a WHERE b.package = '%s' AND b.version = '%s' AND (a.arch_string = '%s' OR a.arch_string = 'all') AND b.architecture = a.id" % (package, version, architecture));
             ql = q.getresult();
+
+            # Horrible hack to work around partial replacement of
+            # packages with newer versions (from different source
+            # packages).  This, obviously, should instead check for a
+            # newer version of the package and only do the
+            # warn&continue thing if it finds one.
             if not ql:
-                utils.fubar("reject: Couldn't find %s_%s_%s in binaries table." % (package, version, architecture));
-            binary_id = ql[0][0];
-            projectB.query("DELETE FROM bin_associations WHERE suite = '%s' AND bin = '%s'" % (suite_id, binary_id));
+                utils.warn("reject: Couldn't find %s_%s_%s in binaries table." % (package, version, architecture));
+            else:
+                binary_id = ql[0][0];
+                projectB.query("DELETE FROM bin_associations WHERE suite = '%s' AND bin = '%s'" % (suite_id, binary_id));
     projectB.query("COMMIT WORK");
 
     # Send the rejection mail if appropriate
     if not Options["No-Mail"]:
-        utils.send_mail (reject_mail_message, "");
+        utils.send_mail(reject_mail_message);
 
     # Finally remove the .katie file
     katie_file = os.path.join(Cnf["Suite::Proposed-Updates::CopyKatie"], os.path.basename(changes_file[:-8]+".katie"));