X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=katie.py;h=776310ddd73be779815dc93bfe721fbe01918b51;hb=5fed805777228403024d131fb189a1a1b2d53c34;hp=8f76c7d513753b1376089146a587fb04c799fc7d;hpb=6cc79b7b093af0c68c9d80c61d5aa7cfe72c9188;p=dak.git diff --git a/katie.py b/katie.py index 8f76c7d5..776310dd 100644 --- a/katie.py +++ b/katie.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # Utility functions for katie -# Copyright (C) 2001, 2002, 2003 James Troup -# $Id: katie.py,v 1.38 2003-08-18 15:04:17 ajt Exp $ +# Copyright (C) 2001, 2002, 2003, 2004 James Troup +# $Id: katie.py,v 1.44 2004-02-27 20:07:40 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 @@ -93,7 +93,6 @@ class Katie: def __init__(self, Cnf): self.Cnf = Cnf; - self.values = {}; # Read in the group-maint override file self.nmu = nmu_p(Cnf); self.accept_count = 0; @@ -263,7 +262,7 @@ class Katie: if files[file]["type"] == "deb": summary += apt_pkg.ParseSection(apt_inst.debExtractControl(utils.open_file(file)))["Description"] + '\n'; else: - files[file]["pool name"] = utils.poolify (changes["source"], files[file]["component"]) + files[file]["pool name"] = utils.poolify (changes.get("source",""), files[file]["component"]) destination = self.Cnf["Dir::PoolRoot"] + files[file]["pool name"] + file summary += file + "\n to " + destination + "\n" @@ -325,8 +324,8 @@ distribution."""; Subst["__STABLE_WARNING__"] = ""; mail_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/jennifer.bug-close"); utils.send_mail (mail_message); - if action: - self.Logger.log(["closing bugs"]+bugs); + if action: + self.Logger.log(["closing bugs"]+bugs); else: # NMU summary += "Setting bugs to severity fixed: "; @@ -469,7 +468,9 @@ distribution."""; return; summary = ""; - for file in files.keys(): + file_keys = files.keys(); + file_keys.sort(); + for file in file_keys: if not files[file].has_key("new") and files[file]["type"] == "deb": section = files[file]["section"]; override_section = files[file]["override section"]; @@ -570,7 +571,7 @@ distribution."""; pkg = self.pkg; reason_filename = pkg.changes_file[:-8] + ".reason"; - reject_filename = Cnf["Dir::Queue::Reject"] + '/' + reason_filename; + reason_filename = Cnf["Dir::Queue::Reject"] + '/' + reason_filename; # Move all the files into the reject directory reject_files = pkg.files.keys() + [pkg.changes_file]; @@ -578,16 +579,15 @@ distribution."""; # If we fail here someone is probably trying to exploit the race # so let's just raise an exception ... - if os.path.exists(reject_filename): - os.unlink(reject_filename); - fd = os.open(reject_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644); + if os.path.exists(reason_filename): + os.unlink(reason_filename); + reason_file = os.open(reason_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644); if not manual: Subst["__REJECTOR_ADDRESS__"] = Cnf["Dinstall::MyEmailAddress"]; Subst["__MANUAL_REJECT_MESSAGE__"] = ""; Subst["__CC__"] = "X-Katie-Rejection: automatic (moo)"; - os.write(fd, reject_message); - os.close(fd); + os.write(reason_file, reject_message); reject_mail_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/katie.rejected"); else: # Build up the rejection email @@ -597,10 +597,10 @@ distribution."""; Subst["__MANUAL_REJECT_MESSAGE__"] = reject_message; Subst["__CC__"] = "Cc: " + Cnf["Dinstall::MyEmailAddress"]; reject_mail_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/katie.rejected"); - # Write the rejection email out as the .reason file - os.write(fd, reject_mail_message); - os.close(fd); + os.write(reason_file, reject_mail_message); + + os.close(reason_file); # Send the rejection mail if appropriate if not Cnf["Dinstall::Options::No-Mail"]: @@ -645,17 +645,17 @@ distribution."""; ql = map(lambda x: x[0], q.getresult()); # Try (1) - if ql.count(source_version): + if source_version in ql: continue # Try (2) orig_source_version = re_bin_only_nmu_of_mu.sub('', source_version) - if ql.count(orig_source_version): + if orig_source_version in ql: continue # Try (3) orig_source_version = re_bin_only_nmu_of_nmu.sub('', source_version) - if ql.count(orig_source_version): + if orig_source_version in ql: continue # No source found... @@ -764,7 +764,7 @@ SELECT b.id FROM binaries b, architecture a files[file]["version"], files[file]["architecture"])) if q.getresult(): - self.reject("can not overwrite existing copy of '%s' already in the archive." % (file)); + self.reject("%s: can not overwrite existing copy already in the archive." % (file)); return self.reject_message;