From c3791ee4e4b8778e38a7bca368db8dacd11e04b2 Mon Sep 17 00:00:00 2001 From: James Troup Date: Fri, 13 Jul 2001 15:54:59 +0000 Subject: [PATCH] Various crash fixes and reject testing only uploads. --- TODO | 4 ++++ katie | 39 +++++++++++++++++++++++++-------------- utils.py | 8 ++++---- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/TODO b/TODO index 20999676..cd228b3e 100644 --- a/TODO +++ b/TODO @@ -14,6 +14,9 @@ More Urgent table. Then fix charisma to use them and write some scripting to handle the Santiago situation. ] + o katie's version check should include arch: all packages; see + #104087. + Less Urgent ----------- @@ -56,6 +59,7 @@ Less Urgent o cron.daily* should change umask (aj sucks) o Rene doesn't look at debian-installer but should. o Rene needs to check for binary-less source packages. + o Rene could accept a suite argument * Bizzare/uncertain: diff --git a/katie b/katie index 5b92f91b..05ca46ee 100755 --- a/katie +++ b/katie @@ -2,7 +2,7 @@ # Installs Debian packaes # Copyright (C) 2000, 2001 James Troup -# $Id: katie,v 1.52 2001-07-07 21:25:52 troup Exp $ +# $Id: katie,v 1.53 2001-07-13 15:54:59 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 @@ -36,6 +36,8 @@ import FCNTL, commands, fcntl, getopt, gzip, os, pg, pwd, re, shutil, stat, stri import apt_inst, apt_pkg import utils, db_access, logging +from types import *; + ############################################################################### re_isanum = re.compile (r"^\d+$"); @@ -232,6 +234,9 @@ def check_changes(filename): files = utils.build_file_list(changes, ""); except utils.changes_parse_error_exc, line: reject_message = reject_message + "Rejected: error parsing changes file '%s', can't grok: %s.\n" % (filename, line); + except utils.nk_format_exc, format: + reject_message = reject_message + "Rejected: unknown format '%s' of changes file '%s'.\n" % (format, filename); + return 0; # Check for mandatory fields for i in ("source", "binary", "architecture", "version", "distribution","maintainer", "files"): @@ -265,6 +270,10 @@ def check_changes(filename): if re_isanum.match (i) == None: reject_message = reject_message + "Rejected: `%s' from Closes field isn't a number.\n" % (i) + # Ensure there _is_ a target distribution + if changes["distribution"].keys() == []: + reject_message = reject_message + "Rejected: huh? Distribution field is empty in changes file.\n"; + # Map frozen to unstable if frozen doesn't exist if changes["distribution"].has_key("frozen") and not Cnf.has_key("Suite::Frozen"): del changes["distribution"]["frozen"] @@ -273,19 +282,17 @@ def check_changes(filename): # Map testing to unstable if changes["distribution"].has_key("testing"): - del changes["distribution"]["testing"] - changes["distribution"]["unstable"] = 1; - reject_message = reject_message + "Mapping testing to unstable.\n" + if len(changes["distribution"].keys()) > 1: + del changes["distribution"]["testing"]; + reject_message = reject_message + "Warning: Ignoring testing as a target suite.\n"; + else: + reject_message = reject_message + "Rejected: invalid distribution 'testing'.\n"; # Ensure target distributions exist for i in changes["distribution"].keys(): if not Cnf.has_key("Suite::%s" % (i)): reject_message = reject_message + "Rejected: Unknown distribution `%s'.\n" % (i) - # Ensure there _is_ a target distribution - if changes["distribution"].keys() == []: - reject_message = reject_message + "Rejected: huh? Distribution field is empty in changes file.\n"; - # Map unreleased arches from stable to unstable if changes["distribution"].has_key("stable"): for i in changes["architecture"].keys(): @@ -733,10 +740,14 @@ def check_override (): def update_subst (changes_filename): global Subst; - if changes.has_key("architecture"): - Subst["__ARCHITECTURE__"] = string.join(changes["architecture"].keys(), ' ' ); - else: - Subst["__ARCHITECTURE__"] = "Unknown"; + # If katie crashed out in the right place, architecture may still be a string. + if not changes.has_key("architecture") or not isinstance(changes["architecture"], DictType): + changes["architecture"] = { "Unknown" : "" }; + # and maintainer822 may not exist. + if not changes.has_key("maintainer822"): + changes["maintainer822"] = Cnf["Dinstall::MyEmailAddress"]; + + Subst["__ARCHITECTURE__"] = string.join(changes["architecture"].keys(), ' ' ); Subst["__CHANGES_FILENAME__"] = os.path.basename(changes_filename); Subst["__FILE_CONTENTS__"] = changes.get("filecontents", ""); @@ -761,7 +772,7 @@ def action (changes_filename): # changes["distribution"] may not exist in corner cases # (e.g. unreadable changes files) - if not changes.has_key("distribution"): + if not changes.has_key("distribution") or not isinstance(changes["distribution"], DictType): changes["distribution"] = {}; for suite in changes["distribution"].keys(): @@ -1355,7 +1366,7 @@ def main(): Subst = {} Subst["__ADMIN_ADDRESS__"] = Cnf["Dinstall::MyAdminAddress"]; Subst["__BUG_SERVER__"] = Cnf["Dinstall::BugServer"]; - bcc = "X-Katie: $Revision: 1.52 $" + bcc = "X-Katie: $Revision: 1.53 $" if Cnf.has_key("Dinstall::Bcc"): Subst["__BCC__"] = bcc + "\nBcc: %s" % (Cnf["Dinstall::Bcc"]); else: diff --git a/utils.py b/utils.py index 27d8f67a..4107533c 100644 --- a/utils.py +++ b/utils.py @@ -1,6 +1,6 @@ # Utility functions # Copyright (C) 2000, 2001 James Troup -# $Id: utils.py,v 1.28 2001-07-07 03:10:51 troup Exp $ +# $Id: utils.py,v 1.29 2001-07-13 15:54:59 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 @@ -216,7 +216,7 @@ def build_file_list(changes, dsc): if format != "": format = float(format) if dsc == "" and (format < 1.5 or format > 2.0): - raise nk_format_exc, changes["format"]; + raise nk_format_exc, format; # No really, this has happened. Think 0 length .dsc file. if not changes.has_key("files"): @@ -456,12 +456,12 @@ def cc_fix_changes (changes): def changes_compare (a, b): try: a_changes = parse_changes(a, 0) - except changes_parse_error_exc, line: + except: return -1; try: b_changes = parse_changes(b, 0) - except changes_parse_error_exc, line: + except: return 1; cc_fix_changes (a_changes); -- 2.39.5