]> git.decadent.org.uk Git - dak.git/blobdiff - jennifer
* katie.py (source_exists): expand the list of distributionsthe source may exist...
[dak.git] / jennifer
index 721d85c84c53f7aaf5247f51afacedfbd0964fbb..a769b63bcea942153a645be1a8145ef231ff9db1 100755 (executable)
--- a/jennifer
+++ b/jennifer
@@ -2,7 +2,7 @@
 
 # Checks Debian packages from Incoming
 # Copyright (C) 2000, 2001, 2002, 2003  James Troup <james@nocrew.org>
-# $Id: jennifer,v 1.31 2003-02-07 14:53:42 troup Exp $
+# $Id: jennifer,v 1.35 2003-07-29 14:00:39 ajt 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
@@ -29,7 +29,7 @@
 
 ################################################################################
 
-import FCNTL, errno, fcntl, gzip, os, re, shutil, stat, sys, time, traceback;
+import errno, fcntl, gzip, os, re, shutil, stat, sys, time, traceback;
 import apt_inst, apt_pkg;
 import db_access, katie, logging, utils;
 
@@ -45,7 +45,7 @@ re_valid_pkg_name = re.compile(r"^[\dA-Za-z][\dA-Za-z\+\-\.]+$");
 ################################################################################
 
 # Globals
-jennifer_version = "$Revision: 1.31 $";
+jennifer_version = "$Revision: 1.35 $";
 
 Cnf = None;
 Options = None;
@@ -432,7 +432,7 @@ def check_files():
                     reject("source version (%s) for %s doesn't match changes version %s." % (source_version, file, changes["version"]));
             else:
                 # Check in the SQL database
-                if not Katie.source_exists(source_package, source_version):
+                if not Katie.source_exists(source_package, source_version, changes["distribution"].keys()):
                     # Check in one of the other directories
                     source_epochless_version = utils.re_no_epoch.sub('', source_version);
                     dsc_filename = "%s_%s.dsc" % (source_package, source_epochless_version);
@@ -762,7 +762,7 @@ def check_timestamps():
                            % (filename, num_ancient_files, ancient_file,
                               time.ctime(ancient_date)));
             except:
-                reject("%s: timestamp check failed; caught %s" % (filename, sys.exc_type));
+                reject("%s: deb contents timestamp check failed [%s: %s]" % (filename, sys.exc_type, sys.exc_value));
 
 ################################################################################
 ################################################################################
@@ -912,7 +912,7 @@ def acknowledge_new (summary):
         print "Sending new ack.";
         Subst["__SUMMARY__"] = summary;
         new_ack_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/jennifer.new");
-        utils.send_mail(new_ack_message,"");
+        utils.send_mail(new_ack_message);
 
     # Finally remove the originals.
     os.chdir (pkg.directory);
@@ -1008,7 +1008,13 @@ def main():
 
     if not Options["No-Action"]:
         lock_fd = os.open(Cnf["Dinstall::LockFile"], os.O_RDWR | os.O_CREAT);
-        fcntl.lockf(lock_fd, FCNTL.F_TLOCK);
+        try:
+            fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB);
+        except IOError, e:
+            if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN':
+                utils.fubar("Couldn't obtain lock; assuming another jennifer is already running.");
+            else:
+                raise;
         Logger = Katie.Logger = logging.Logger(Cnf, "jennifer");
 
     # debian-{devel-,}-changes@lists.debian.org toggles writes access based on this header