X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=katie.py;h=e898c2f01a41dff16726f4fa47ba41b440c67942;hb=ff6b60557955e8bd683b5722876f97198203215b;hp=308806cc547354d88f56ebfc6dc486a8ed558770;hpb=3686a00f1001f2d5692fa5e706b898053e39191a;p=dak.git diff --git a/katie.py b/katie.py index 308806cc..e898c2f0 100644 --- a/katie.py +++ b/katie.py @@ -2,7 +2,7 @@ # Utility functions for katie # Copyright (C) 2001, 2002, 2003, 2004 James Troup -# $Id: katie.py,v 1.45 2004-04-01 17:14:25 troup Exp $ +# $Id: katie.py,v 1.51 2004-11-27 18:02:22 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 @@ -30,9 +30,9 @@ from types import *; re_isanum = re.compile (r"^\d+$"); re_default_answer = re.compile(r"\[(.*)\]"); -re_fdnic = re.compile("\n\n"); -re_bin_only_nmu_of_mu = re.compile("\.\d+\.\d+$"); -re_bin_only_nmu_of_nmu = re.compile("\.\d+$"); +re_fdnic = re.compile(r"\n\n"); +re_bin_only_nmu_of_mu = re.compile(r"\.\d+\.\d+$"); +re_bin_only_nmu_of_nmu = re.compile(r"\.\d+$"); ############################################################################### @@ -66,7 +66,9 @@ class nmu_p: changes = pkg.changes; dsc = pkg.dsc; - (dsc_rfc822, dsc_name, dsc_email) = utils.fix_maintainer (dsc.get("maintainer",Cnf["Dinstall::MyEmailAddress"]).lower()); + i = utils.fix_maintainer (dsc.get("maintainer", + Cnf["Dinstall::MyEmailAddress"]).lower()); + (dsc_rfc822, dsc_rfc2047, dsc_name, dsc_email) = i; # changes["changedbyname"] == dsc_name is probably never true, but better safe than sorry if dsc_name == changes["maintainername"].lower() and \ (changes["changedby822"] == "" or changes["changedbyname"].lower() == dsc_name): @@ -76,7 +78,7 @@ class nmu_p: uploaders = dsc["uploaders"].lower().split(","); uploadernames = {}; for i in uploaders: - (rfc822, name, email) = utils.fix_maintainer (i.strip()); + (rfc822, rfc2047, name, email) = utils.fix_maintainer (i.strip()); uploadernames[name] = ""; if uploadernames.has_key(changes["changedbyname"].lower()): return 0; @@ -167,19 +169,19 @@ class Katie: d_files[file][i] = files[file][i]; ## changes # Mandatory changes fields - for i in [ "distribution", "source", "architecture", "version", "maintainer", - "urgency", "fingerprint", "changedby822", "changedbyname", - "maintainername", "maintaineremail", "closes" ]: + for i in [ "distribution", "source", "architecture", "version", + "maintainer", "urgency", "fingerprint", "changedby822", + "changedby2047", "changedbyname", "maintainer822", + "maintainer2047", "maintainername", "maintaineremail", + "closes", "changes" ]: d_changes[i] = changes[i]; # Optional changes fields - # FIXME: changes should be mandatory - for i in [ "changed-by", "maintainer822", "filecontents", "format", - "changes", "lisa note" ]: + for i in [ "changed-by", "filecontents", "format", "lisa note" ]: if changes.has_key(i): d_changes[i] = changes[i]; ## dsc - for i in [ "source", "version", "maintainer", "fingerprint", "uploaders", - "bts changelog" ]: + for i in [ "source", "version", "maintainer", "fingerprint", + "uploaders", "bts changelog" ]: if dsc.has_key(i): d_dsc[i] = dsc[i]; ## dsc_files @@ -208,9 +210,9 @@ class Katie: # If jennifer 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"] = self.Cnf["Dinstall::MyEmailAddress"]; + # and maintainer2047 may not exist. + if not changes.has_key("maintainer2047"): + changes["maintainer2047"] = self.Cnf["Dinstall::MyEmailAddress"]; Subst["__ARCHITECTURE__"] = " ".join(changes["architecture"].keys()); Subst["__CHANGES_FILENAME__"] = os.path.basename(self.pkg.changes_file); @@ -218,12 +220,13 @@ class Katie: # For source uploads the Changed-By field wins; otherwise Maintainer wins. if changes["architecture"].has_key("source") and changes["changedby822"] != "" and (changes["changedby822"] != changes["maintainer822"]): - Subst["__MAINTAINER_FROM__"] = changes["changedby822"]; - Subst["__MAINTAINER_TO__"] = changes["changedby822"] + ", " + changes["maintainer822"]; + Subst["__MAINTAINER_FROM__"] = changes["changedby2047"]; + Subst["__MAINTAINER_TO__"] = "%s, %s" % (changes["changedby2047"], + changes["maintainer2047"]); Subst["__MAINTAINER__"] = changes.get("changed-by", "Unknown"); else: - Subst["__MAINTAINER_FROM__"] = changes["maintainer822"]; - Subst["__MAINTAINER_TO__"] = changes["maintainer822"]; + Subst["__MAINTAINER_FROM__"] = changes["maintainer2047"]; + Subst["__MAINTAINER_TO__"] = changes["maintainer2047"]; Subst["__MAINTAINER__"] = changes.get("maintainer", "Unknown"); if self.Cnf.has_key("Dinstall::TrackingServer") and changes.has_key("source"): Subst["__MAINTAINER_TO__"] += "\nBcc: %s@%s" % (changes["source"], self.Cnf["Dinstall::TrackingServer"]) @@ -702,7 +705,7 @@ distribution."""; return okay ################################################################################ - + def in_override_p (self, package, component, suite, binary_type, file): files = self.pkg.files; @@ -723,7 +726,7 @@ distribution."""; type_id = db_access.get_override_type_id(type); # FIXME: nasty non-US speficic hack - if component[:7].lower() == "non-us/": + if component.lower().startswith("non-us/"): component = component[7:]; q = self.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" @@ -772,10 +775,10 @@ distribution."""; existent_version = entry[0]; suite = entry[1]; if suite in must_be_newer_than and \ - apt_pkg.VersionCompare(new_version, existent_version) != 1: + apt_pkg.VersionCompare(new_version, existent_version) < 1: self.reject("%s: old version (%s) in %s >= new version (%s) targeted at %s." % (file, existent_version, suite, new_version, target_suite)); if suite in must_be_older_than and \ - apt_pkg.VersionCompare(new_version, existent_version) != -1: + apt_pkg.VersionCompare(new_version, existent_version) > -1: self.reject("%s: old version (%s) in %s <= new version (%s) targeted at %s." % (file, existent_version, suite, new_version, target_suite)); ################################################################################ @@ -848,12 +851,11 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su actual_size = int(files[dsc_file]["size"]); found = "%s in incoming" % (dsc_file) # Check the file does not already exist in the archive - q = self.projectB.query("SELECT size, md5sum, filename FROM files WHERE filename LIKE '%%%s%%'" % (dsc_file)); - + q = self.projectB.query("SELECT f.size, f.md5sum, l.path, f.filename FROM files f, location l WHERE f.filename LIKE '%%%s%%' AND l.id = f.location" % (dsc_file)); ql = q.getresult(); # Strip out anything that isn't '%s' or '/%s$' for i in ql: - if i[2] != dsc_file and i[2][-(len(dsc_file)+1):] != '/'+dsc_file: + if i[3] != dsc_file and i[3][-(len(dsc_file)+1):] != '/'+dsc_file: ql.remove(i); # "[katie] has not broken them. [katie] has fixed a @@ -875,6 +877,7 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su files[dsc_file]["md5sum"] == i[1]: self.reject("ignoring %s, since it's already in the archive." % (dsc_file), "Warning: "); del files[dsc_file]; + self.pkg.orig_tar_gz = i[2] + i[3]; match = 1; if not match: