X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=jenna;h=0f635cb4a041fe194f856e4c998ee504a152cea3;hb=965f23a17180491622c2e4bc43f53433682973b4;hp=e214156c55d2901d0c2617664982c07ea4023a47;hpb=8ac80d15017f577f900496e8c8124d4bc6b46f44;p=dak.git diff --git a/jenna b/jenna index e214156c..0f635cb4 100755 --- a/jenna +++ b/jenna @@ -2,7 +2,7 @@ # Generate file list which is then fed to apt-ftparchive to generate Packages and Sources files # Copyright (C) 2000, 2001 James Troup -# $Id: jenna,v 1.8 2001-03-22 04:28:21 troup Exp $ +# $Id: jenna,v 1.12 2001-06-22 22:53:14 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 @@ -52,7 +52,7 @@ def generate_src_list(suite, component, output, dislocated_files): else: filename = path + filename; if sources.has_key(source): - sys.stderr.write("E: %s in %s / %s / source is duplicated. Gravity wins!" % (package, suite, component)); + utils.warn("%s in %s / %s / source is duplicated." % (source, suite, component)); else: sources[source] = filename; @@ -81,7 +81,7 @@ def generate_bin_list(suite, component, architecture, output, type, dislocated_f else: filename = path + filename; if packages.has_key(package): - sys.stderr.write("E: %s in %s / %s / %s / %s is duplicated. Gravity wins!" % (package, suite, component, architecture, type)); + utils.warn("%s in %s / %s / %s / %s is duplicated." % (package, suite, component, architecture, type)); else: packages[package] = filename; @@ -107,6 +107,40 @@ def generate_bin_list(suite, component, architecture, output, type, dislocated_f # yo momma was SQLin' like a pig last night! ########## +# If something has gone from arch:all to arch:any or vice-versa, +# clean out the old versions here. The rest of jenna won't do this +# because it's lame. I have no idea. + +def clean_duplicate_packages(suite): + print "Cleaning duplicate packages for %s..." % (suite) + + suite_id = db_access.get_suite_id(suite) + q = projectB.query(""" +SELECT b1.package, + b1.id, b1.version, a1.arch_string, + b2.id, b2.version, a2.arch_string + FROM bin_associations ba1, binaries b1, architecture a1, + bin_associations ba2, binaries b2, architecture a2 + WHERE ba1.suite = ba2.suite AND ba1.suite = %s + AND ba1.bin = b1.id AND b1.architecture = a1.id + AND ba2.bin = b2.id AND b2.architecture = a2.id + AND b1.package = b2.package + AND (a1.id = a2.id OR a1.arch_string = 'all' OR a2.arch_string = 'all') + AND b1.id != b2.id + AND versioncmp(b1.version, b2.version) <= 0 +ORDER BY b1.package, b1.version, a1.arch_string;""" % (suite_id)) + + ql = q.getresult() + seen = {} + for i in ql: + (package, oldid, oldver, oldarch, newid, newver, newarch) = i + if not seen.has_key(oldid): + seen[oldid] = newid + print "Removing %s %s on %s (ifo %s/%s)" % (package, oldver, oldarch, newver, newarch) + projectB.query("DELETE FROM bin_associations WHERE suite = %s AND bin = %s" % (suite_id, oldid)) + else: + print "%s %s on %s also superceded by %s/%s" % (package, oldver, oldarch, newver, newarch) + # If something has moved from one component to another we need to # clean out the old versions here. The rest of jenna won't do this # because it works on a per-component level for flexibility. @@ -114,7 +148,7 @@ def generate_bin_list(suite, component, architecture, output, type, dislocated_f def clean_suite (suite): print "Cleaning out packages for %s..." % (suite) - suite_id = db_access.get_suite_id(suite); + suite_id = db_access.get_suite_id(suite) q = projectB.query(""" SELECT b.id, b.package, a.arch_string, b.version, l.path, f.filename, c.name FROM binaries b, bin_associations ba, files f, location l, architecture a, component c @@ -197,6 +231,7 @@ def main(): else: dislocated_files = {}; clean_suite(suite); + clean_duplicate_packages(suite) components = Cnf["Jenna::Options::Component"]; if not Cnf.has_key("Suite::%s::Components" % (suite)): components = "-";