X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=katie;h=5596586d14d3a0042ff50160c64a88c66232096a;hb=62f80fe886360a984b5225c7aaa7637635335248;hp=ebb52958bc127c4e7aaf6880980492d7c11ad548;hpb=4b41dc06229eed89f52f397fc7df5d665fa092cf;p=dak.git diff --git a/katie b/katie index ebb52958..5596586d 100755 --- a/katie +++ b/katie @@ -2,7 +2,7 @@ # Installs Debian packaes # Copyright (C) 2000 James Troup -# $Id: katie,v 1.18 2001-01-16 21:52:37 troup Exp $ +# $Id: katie,v 1.22 2001-01-23 20:27:35 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 @@ -94,7 +94,7 @@ def usage (exit_code): -d, --debug=VALUE debug -k, --ack-new acknowledge new packages -m, --manual-reject=MSG manual reject with `msg' - -n, --dry-run don't do anything + -n, --no-action don't do anything -p, --no-lock don't check lockfile !! for cron.daily only !! -r, --no-version-check override version check -u, --distribution=DIST override distribution to `dist'""" @@ -105,7 +105,7 @@ def check_signature (filename): (result, output) = commands.getstatusoutput("gpg --emulate-md-encode-bug --batch --no-options --no-default-keyring --always-trust --keyring=%s --keyring=%s < %s >/dev/null" % (Cnf["Dinstall::PGPKeyring"], Cnf["Dinstall::GPGKeyring"], filename)) if (result != 0): - reject_message = "Rejected: GPG signature check failed on `%s'.\n%s\n" % (filename, output) + reject_message = "Rejected: GPG signature check failed on `%s'.\n%s\n" % (os.path.basename(filename), output) return 0 return 1 @@ -113,9 +113,9 @@ def check_signature (filename): # See if a given package is in the override table -def in_override_p (package, component, suite, binary_type): - global overrides; - +def in_override_p (package, component, suite, binary_type, file): + global files; + if binary_type == "": # must be source type = "dsc"; else: @@ -136,15 +136,20 @@ def in_override_p (package, component, suite, binary_type): if string.lower(component[:7]) == "non-us/": component = component[7:]; - q = projectB.query("SELECT package FROM override WHERE package = '%s' AND suite = %s AND component = %s AND type = %s" + q = projectB.query("SELECT s.section, p.priority FROM override o, section s, priority p WHERE package = '%s' AND suite = %s AND component = %s AND type = %s AND o.section = s.id AND o.priority = p.id" % (package, suite_id, component_id, type_id)); result = q.getresult(); # If checking for a source package fall back on the binary override type if type == "dsc" and not result: type_id = db_access.get_override_type_id("deb"); - q = projectB.query("SELECT package FROM override WHERE package = '%s' AND suite = %s AND component = %s AND type = %s" + q = projectB.query("SELECT s.section, p.priority FROM override o, section s, priority p WHERE package = '%s' AND suite = %s AND component = %s AND type = %s AND o.section = s.id AND o.priority = p.id" % (package, suite_id, component_id, type_id)); result = q.getresult(); + + # Remember the section and priority so we can check them later if appropriate + if result != []: + files[file]["override section"] = result[0][0]; + files[file]["override priority"] = result[0][1]; return result; @@ -202,11 +207,13 @@ def check_changes(filename): # 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"] + changes["distribution"]["unstable"] = 1; reject_message = reject_message + "Mapping frozen to unstable.\n" # 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" # Ensure target distributions exist @@ -214,12 +221,17 @@ def check_changes(filename): 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(): if not Cnf.has_key("Suite::Stable::Architectures::%s" % (i)): reject_message = reject_message + "Mapping stable to unstable for unreleased arch `%s'.\n" % (i) del changes["distribution"]["stable"] + changes["distribution"]["unstable"] = 1; # Map arches not being released from frozen to unstable if changes["distribution"].has_key("frozen"): @@ -227,6 +239,7 @@ def check_changes(filename): if not Cnf.has_key("Suite::Frozen::Architectures::%s" % (i)): reject_message = reject_message + "Mapping frozen to unstable for non-releasing arch `%s'.\n" % (i) del changes["distribution"]["frozen"] + changes["distribution"]["unstable"] = 1; # Handle uploads to stable if changes["distribution"].has_key("stable"): @@ -275,8 +288,15 @@ def check_files(): files[file]["type"] = "byhand"; # Checks for a binary package... elif re_isadeb.match(file) != None: + files[file]["type"] = "deb"; + # Extract package information using dpkg-deb - control = apt_pkg.ParseSection(apt_inst.debExtractControl(utils.open_file(file,"r"))) + try: + control = apt_pkg.ParseSection(apt_inst.debExtractControl(utils.open_file(file,"r"))) + except: + reject_message = reject_message + "Rejected: %s: debExtractControl() raised %s.\n" % (file, sys.exc_type); + # Can't continue, none of the checks on control would work. + continue; # Check for mandatory fields if control.Find("Package") == None: @@ -315,7 +335,6 @@ def check_files(): files[file]["dbtype"] = "deb"; else: reject_message = reject_message + "Rejected: %s is neither a .deb or a .udeb.\n " % (file); - files[file]["type"] = "deb"; files[file]["fullname"] = "%s_%s_%s.deb" % (control.Find("Package", ""), epochless_version, control.Find("Architecture", "")) files[file]["source"] = control.Find("Source", ""); if files[file]["source"] == "": @@ -354,7 +373,7 @@ def check_files(): else: files[file]["byhand"] = 1; files[file]["type"] = "byhand"; - + files[file]["oldfiles"] = {} for suite in changes["distribution"].keys(): # Skip byhand @@ -366,7 +385,7 @@ def check_files(): continue # See if the package is NEW - if not in_override_p(files[file]["package"], files[file]["component"], suite, files[file].get("dbtype","")): + if not in_override_p(files[file]["package"], files[file]["component"], suite, files[file].get("dbtype",""), file): files[file]["new"] = 1 # Find any old binary packages @@ -407,7 +426,7 @@ def check_files(): # Check the md5sum & size against existing files (if any) location = Cnf["Dir::PoolDir"]; files[file]["location id"] = db_access.get_location_id (location, component, archive); - + files[file]["pool name"] = utils.poolify (changes["source"], files[file]["component"]); files_id = db_access.get_files_id(files[file]["pool name"] + file, files[file]["size"], files[file]["md5sum"], files[file]["location id"]); if files_id == -1: @@ -576,6 +595,51 @@ def check_md5sums (): if apt_pkg.md5sum(file_handle) != files[file]["md5sum"]: reject_message = reject_message + "Rejected: md5sum check failed for %s.\n" % (file); +def check_override (): + # Only check section & priority on sourceful uploads + if not changes["architecture"].has_key("source"): + return; + + summary = "" + for file in files.keys(): + if not files[file].has_key("new") and (files[file]["type"] == "dsc" or files[file]["type"] == "deb"): + section = files[file]["section"]; + override_section = files[file]["override section"]; + if section != override_section and section != "-": + summary = summary + "%s: section is overridden from %s to %s.\n" % (file, section, override_section); + if files[file]["type"] == "deb": # don't do priority for source + priority = files[file]["priority"]; + override_priority = files[file]["override priority"]; + if priority != override_priority and priority != "-": + summary = summary + "%s: priority is overridden from %s to %s.\n" % (file, priority, override_priority); + + if summary == "": + return; + + mail_message = """Return-Path: %s +From: %s +To: %s +Bcc: troup@auric.debian.org +Subject: %s override disparity + +There are disparities between your recently installed upload and the +override file for the following file(s): + +%s +Either the package or the override file is incorrect. If you think +the override is correct and the package wrong please fix the package +so that this disparity is fixed in the next upload. If you feel the +override is incorrect then please reply to this mail and explain why. + +-- +Debian distribution maintenance software + +(This message was generated automatically; if you believe that there +is a problem with it please contact the archive administrators by +mailing ftpmaster@debian.org) +""" % (Cnf["Dinstall::MyEmailAddress"], Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], changes["source"], summary); + utils.send_mail (mail_message, "") + ##################################################################################################################### def action (changes_filename): @@ -805,6 +869,7 @@ Installing: %s""" % (Cnf["Dinstall::MyEmailAddress"], Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], os.path.basename(changes_filename), reject_message, summary, installed_footer) utils.send_mail (mail_message, "") announce (short_summary, 1) + check_override (); #####################################################################################################################