]> git.decadent.org.uk Git - dak.git/blobdiff - jennifer
* templates/lisa.bxa_notification: Fix some grammatical errors. Encourage contact...
[dak.git] / jennifer
index 574302eb083a7a889e4a91846bdd86080fd05dca..d824914bc472bfb7753bc379acc52daa5327a7b6 100755 (executable)
--- a/jennifer
+++ b/jennifer
@@ -2,7 +2,7 @@
 
 # Checks Debian packages from Incoming
 # Copyright (C) 2000, 2001  James Troup <james@nocrew.org>
-# $Id: jennifer,v 1.1 2002-02-12 23:08:07 troup Exp $
+# $Id: jennifer,v 1.10 2002-03-15 15:51:20 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
@@ -44,7 +44,7 @@ re_is_changes = re.compile (r"(.+?)_(.+?)_(.+?)\.changes$");
 ################################################################################
 
 # Globals
-jennifer_version = "$Revision: 1.1 $";
+jennifer_version = "$Revision: 1.10 $";
 
 Cnf = None;
 Options = None;
@@ -459,30 +459,12 @@ def check_changes():
     changes["chopversion"] = utils.re_no_epoch.sub('', changes["version"])
     changes["chopversion2"] = utils.re_no_revision.sub('', changes["chopversion"])
 
-    # Ensure the changes filename matches it's contents.
-
-    base_filename = os.path.basename(filename);
-    m = re_is_changes.match(base_filename);
-    # source package name
-    if m:
-        file_source = m.group(1);
-        if changes["source"] != file_source:
-            reject("package name part of changes filename (%s) does not match source field (%s) in the changes file." % (file_source, changes["source"]));
-        # source version
-        file_version = m.group(2);
-        if changes["chopversion"] != file_version:
-            reject("version part of changes filename (%s) does not match version field (%s) in the changes file." % (file_version, changes["chopversion"]));
-    else:
-        reject("invalid changes filename '%s'." % (filename));
-
-    # But ... we can't check architecture because there's no
-    # established policy or practice on how to handle
-    # multi-architecture uploads.  Instead we check what we can and
-    # reject if there's a changes file of the same name already in one
+    # Check there isn't already a changes file of the same name in one
     # of the queue directories.
+    base_filename = os.path.basename(filename);
     for dir in [ "Accepted", "Byhand", "Done", "New" ]:
         if os.path.exists(Cnf["Dir::Queue%sDir" % (dir) ]+'/'+base_filename):
-            reject("a changes file with the same name exists in the %s directory." % (dir));
+            reject("a changes file with the same name already exists in the %s directory." % (dir));
 
     return 1;
 
@@ -676,7 +658,7 @@ def check_files():
                 files[file]["new"] = 1;
 
             if files[file]["type"] == "deb":
-                reject(Katie.check_binaries_against_db(file, suite));
+                reject(Katie.check_binaries_against_db(file, suite),"");
 
             # Validate the component
             component = files[file]["component"];
@@ -705,6 +687,15 @@ def check_files():
             if files[file]["oldfiles"].has_key(suite) and files[file]["oldfiles"][suite]["name"] != files[file]["component"]:
                 files[file]["othercomponents"] = files[file]["oldfiles"][suite]["name"];
 
+    # If the .changes file says it has source, it must have source.
+    if changes["architecture"].has_key("source"):
+        has_source = 0;
+        for file in file_keys:
+            if files[file]["type"] == "dsc":
+                has_source = 1;
+        if not has_source:
+            reject("no source found and Architecture line in changes mention source.");
+
 ###############################################################################
 
 def check_dsc ():
@@ -753,10 +744,10 @@ def check_dsc ():
                 reject("version ('%s') in .dsc does not match version ('%s') in .changes." % (epochless_dsc_version, changes_version));
 
             # Ensure source is newer than existing source in target suites
-            reject(Katie.check_source_against_db(file));
+            reject(Katie.check_source_against_db(file),"");
 
             (reject_msg, is_in_incoming) = Katie.check_dsc_against_db(file);
-            reject(reject_msg);
+            reject(reject_msg, "");
             if is_in_incoming:
                 if not Options["No-Action"]:
                     copy_to_holding(is_in_incoming);
@@ -867,7 +858,6 @@ def check_timestamps():
                               time.ctime(ancient_date)));
             except:
                 reject("%s: timestamp check failed; caught %s" % (filename, sys.exc_type));
-                raise;
 
 ################################################################################
 ################################################################################
@@ -933,12 +923,11 @@ def action ():
             answer = 'A';
 
     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':
         os.chdir (pkg.directory);
@@ -971,15 +960,16 @@ def accept (summary, short_summary):
 
 def do_byhand (summary):
     print "Moving to BYHAND holding area."
+    Logger.log(["Moving to byhand", pkg.changes_file]);
 
     Katie.dump_vars(Cnf["Dir::QueueByhandDir"]);
 
     file_keys = files.keys();
 
-    # Move all the files into the accepted directory
+    # Move all the files into the byhand directory
     utils.move (pkg.changes_file, Cnf["Dir::QueueByhandDir"]);
     for file in file_keys:
-        utils.move (file, Cnf["Dir::QueueByhandDir"]);
+        utils.move (file, Cnf["Dir::QueueByhandDir"], perms=0660);
 
     # Check for override disparities
     if not Cnf["Dinstall::Options::No-Mail"]:
@@ -998,6 +988,7 @@ def acknowledge_new (summary):
     Subst = Katie.Subst;
 
     print "Moving to NEW holding area."
+    Logger.log(["Moving to new", pkg.changes_file]);
 
     Katie.dump_vars(Cnf["Dir::QueueNewDir"]);
 
@@ -1006,7 +997,7 @@ def acknowledge_new (summary):
     # Move all the files into the accepted directory
     utils.move (pkg.changes_file, Cnf["Dir::QueueNewDir"]);
     for file in file_keys:
-        utils.move (file, Cnf["Dir::QueueNewDir"]);
+        utils.move (file, Cnf["Dir::QueueNewDir"], perms=0660);
 
     if not Options["No-Mail"]:
         print "Sending new ack.";
@@ -1024,11 +1015,12 @@ def acknowledge_new (summary):
 
 # reprocess is necessary for the case of foo_1.2-1 and foo_1.2-2 in
 # Incoming. -1 will reference the .orig.tar.gz, but -2 will not.
-# dsccheckdistrib() can find the .orig.tar.gz but it will not have
-# processed it during it's checks of -2.  If -1 has been deleted or
-# otherwise not checked by jennifer, the .orig.tar.gz will not have been
-# checked at all.  To get round this, we force the .orig.tar.gz into
-# the .changes structure and reprocess the .changes file.
+# Katie.check_dsc_against_db() can find the .orig.tar.gz but it will
+# not have processed it during it's checks of -2.  If -1 has been
+# deleted or otherwise not checked by jennifer, the .orig.tar.gz will
+# not have been checked at all.  To get round this, we force the
+# .orig.tar.gz into the .changes structure and reprocess the .changes
+# file.
 
 def process_it (changes_file):
     global reprocess, reject_message;
@@ -1071,7 +1063,7 @@ def process_it (changes_file):
         raise;
     except:
         print "ERROR";
-       traceback.print_exc(file=sys.stdout);
+       traceback.print_exc(file=sys.stderr);
         pass;
 
     # Restore previous WD
@@ -1142,7 +1134,7 @@ def main():
         sets = "set"
         if accept_count > 1:
             sets = "sets"
-        sys.stderr.write("Accepted %d package %s, %s.\n" % (accept_count, sets, utils.size_type(int(accept_bytes))));
+        print "Accepted %d package %s, %s." % (accept_count, sets, utils.size_type(int(accept_bytes)));
         Logger.log(["total",accept_count,accept_bytes]);
 
     if not Options["No-Action"]: