]> git.decadent.org.uk Git - dak.git/commitdiff
add katie's checks to lisa
authorJames Troup <james@nocrew.org>
Sun, 19 May 2002 22:33:56 +0000 (22:33 +0000)
committerJames Troup <james@nocrew.org>
Sun, 19 May 2002 22:33:56 +0000 (22:33 +0000)
lisa

diff --git a/lisa b/lisa
index 22341b849751f19ac14b5a2c60fd955e68565532..76d17e515ad7541f6cea021faedab715ccabe508 100755 (executable)
--- a/lisa
+++ b/lisa
@@ -2,7 +2,7 @@
 
 # Handles NEW and BYHAND packages
 # Copyright (C) 2001, 2002  James Troup <james@nocrew.org>
-# $Id: lisa,v 1.13 2002-05-19 19:55:56 troup Exp $
+# $Id: lisa,v 1.14 2002-05-19 22:33:56 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
@@ -58,7 +58,7 @@ import apt_pkg, apt_inst;
 import db_access, fernanda, katie, logging, utils;
 
 # Globals
-lisa_version = "$Revision: 1.13 $";
+lisa_version = "$Revision: 1.14 $";
 
 Cnf = None;
 Options = None;
@@ -69,10 +69,66 @@ Logger = None;
 Priorities = None;
 Sections = None;
 
+reject_message = "";
+
 ################################################################################
 ################################################################################
 ################################################################################
 
+def reject (str, prefix="Rejected: "):
+    global reject_message;
+    if str:
+        reject_message = reject_message + prefix + str + "\n";
+
+def recheck():
+    global reject_message;
+    files = Katie.pkg.files;
+    reject_message = "";
+
+    for file in files.keys():
+        # Check that the source still exists
+        if files[file]["type"] == "deb":
+            source_version = files[file]["source version"];
+            source_package = files[file]["source package"];
+            if not Katie.pkg.changes["architecture"].has_key("source") \
+               and not Katie.source_exists(source_package, source_version):
+                reject("no source found for %s %s (%s)." % (source_package, source_version, file));
+
+        # Version and file overwrite checks
+        if files[file]["type"] == "deb":
+            reject(Katie.check_binary_against_db(file));
+        elif files[file]["type"] == "dsc":
+            reject(Katie.check_source_against_db(file));
+            (reject_msg, is_in_incoming) = Katie.check_dsc_against_db(file);
+            reject(reject_msg);
+
+    if reject_message:
+        answer = "XXX";
+        if Options["No-Action"] or Options["Automatic"]:
+            answer = 'S'
+
+        print "REJECT\n" + reject_message,;
+        prompt = "[R]eject, Skip, Quit ?";
+
+        while string.find(prompt, answer) == -1:
+            answer = utils.our_raw_input(prompt);
+            m = katie.re_default_answer.match(prompt);
+            if answer == "":
+                answer = m.group(1);
+            answer = string.upper(answer[:1]);
+
+        if answer == 'R':
+            Katie.do_reject(0, reject_message);
+        elif answer == 'S':
+            return 0;
+        elif answer == 'Q':
+            sys.exit(0);
+
+    return 1;
+
+################################################################################
+
+
 def determine_new (changes, files):
     new = {};
 
@@ -767,6 +823,9 @@ def do_pkg(changes_file):
     Katie.update_subst();
     files = Katie.pkg.files;
 
+    if not recheck():
+        return;
+
     (new, byhand) = check_status(files);
     if new or byhand:
         if new: