From: James Troup Date: Mon, 22 May 2006 00:09:21 +0000 (-0500) Subject: Merge key-auto-fetch branch. X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=5ea129bba83114905c1266b77744eeed8e9bb020;hp=3e385281f6302cdbe57858bf9157e84bff063d29;p=dak.git Merge key-auto-fetch branch. --- diff --git a/ChangeLog b/ChangeLog index 23566093..905a4162 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2006-05-21 James Troup + + * dak/check_archive.py (check_indices_files_exist): use list + comprehension instead of map(). No longer need to import + deprecated string module as a side-effect. + * dak/check_overrides.py (process): likewise. + (main): likewise. + * dak/cruft_report.py (do_obsolete_source): likewise. + (main): likewise. + * dak/ls.py (main): likewise. + * dak/make_suite_file_list.py (write_filelists): likewise. + * dak/process_accepted.py (stable_install): likewise. + * dak/rm.py (main): likewise. + * dak/stats.py (number_of_packages): likewise. + * daklib/logging.py (Logger.log): likewise. + * daklib/queue.py (Upload.source_exists): likewise. + (Upload.cross_suite_version_check): likewise. + * daklib/utils.py (parse_args): likewise. + 2006-05-21 James Troup * daklib/utils.py (process_gpgv_output): new function, split out diff --git a/dak/check_archive.py b/dak/check_archive.py index 52f04280..84bc7799 100755 --- a/dak/check_archive.py +++ b/dak/check_archive.py @@ -26,7 +26,7 @@ ################################################################################ -import commands, os, pg, stat, string, sys, time +import commands, os, pg, stat, sys, time import apt_pkg, apt_inst import daklib.database import daklib.utils @@ -345,7 +345,7 @@ def check_indices_files_exist(): for suite in [ "stable", "testing", "unstable" ]: for component in Cnf.ValueList("Suite::%s::Components" % (suite)): architectures = Cnf.ValueList("Suite::%s::Architectures" % (suite)) - for arch in map(string.lower, architectures): + for arch in [ i.lower() for i in architectures ]: if arch == "source": validate_sources(suite, component) elif arch == "all": diff --git a/dak/check_overrides.py b/dak/check_overrides.py index 15f944c8..7ed38147 100755 --- a/dak/check_overrides.py +++ b/dak/check_overrides.py @@ -112,7 +112,7 @@ SELECT b.package FROM binaries b, bin_associations ba, files f, location l, component c WHERE b.type = '%s' AND b.id = ba.bin AND f.id = b.file AND l.id = f.location AND c.id = l.component AND ba.suite IN (%s) AND c.id = %s -""" % (type, ",".join(map(str,affected_suites)), component_id)) +""" % (type, ",".join([ str(i) for i in affected_suites ]), component_id)) for i in q.getresult(): packages[i[0]] = 0 @@ -122,7 +122,7 @@ SELECT s.source FROM source s, src_associations sa, files f, location l, component c WHERE s.id = sa.source AND f.id = s.file AND l.id = f.location AND c.id = l.component AND sa.suite IN (%s) AND c.id = %s -""" % (",".join(map(str,affected_suites)), component_id)) +""" % (",".join([ str(i) for i in affected_suites]), component_id)) for i in q.getresult(): src_packages[i[0]] = 0 @@ -322,7 +322,7 @@ def main (): suites.append(suite) q = projectB.query("SELECT id FROM suite WHERE suite_name in (%s)" \ - % ", ".join(map(repr, suites)).lower()) + % ", ".join([ repr(i) for i in suites ]).lower()) suiteids = [] for i in q.getresult(): diff --git a/dak/cruft_report.py b/dak/cruft_report.py index c8183aae..2a3974e5 100755 --- a/dak/cruft_report.py +++ b/dak/cruft_report.py @@ -27,7 +27,7 @@ ################################################################################ -import commands, pg, os, string, sys, time +import commands, pg, os, sys, time import apt_pkg import daklib.database import daklib.utils @@ -209,8 +209,7 @@ def do_obsolete_source(duplicate_bins, bin2source): # Source has already been removed continue else: - obsolete[source] = map(string.strip, - source_binaries[source].split(',')) + obsolete[source] = [ i.strip() for i in source_binaries[source].split(',') ] for binary in duplicate_bins[key]: if bin2source.has_key(binary) and bin2source[binary]["source"] == source: continue @@ -226,7 +225,7 @@ def do_obsolete_source(duplicate_bins, bin2source): if not obsolete[source]: to_remove.append(source) output += " * %s (%s)\n" % (source, source_versions[source]) - for binary in map(string.strip, source_binaries[source].split(',')): + for binary in [ i.strip() for i in source_binaries[source].split(',') ]: if bin2source.has_key(binary): output += " o %s (%s) is built by %s.\n" \ % (binary, bin2source[binary]["version"], @@ -320,7 +319,7 @@ def main (): source_version = Sources.Section.Find('Version') architecture = Sources.Section.Find('Architecture') binaries = Sources.Section.Find('Binary') - binaries_list = map(string.strip, binaries.split(',')) + binaries_list = [ i.strip() for i in binaries.split(',') ] if "bnb" in checks: # Check for binaries not built on any architecture. diff --git a/dak/ls.py b/dak/ls.py index 87d20a18..a1f8c8ec 100755 --- a/dak/ls.py +++ b/dak/ls.py @@ -124,7 +124,7 @@ def main (): new_packages = [] for package in packages: q = projectB.query("SELECT DISTINCT b.package FROM binaries b, bin_associations ba, suite su, source s WHERE b.source = s.id AND su.id = ba.suite AND b.id = ba.bin AND s.source %s '%s' %s" % (comparison_operator, package, con_suites)) - new_packages.extend(map(lambda x: x[0], q.getresult())) + new_packages.extend([ i[0] for i in q.getresult() ]) if package not in new_packages: new_packages.append(package) packages = new_packages diff --git a/dak/make_suite_file_list.py b/dak/make_suite_file_list.py index 20fe186c..56810b29 100755 --- a/dak/make_suite_file_list.py +++ b/dak/make_suite_file_list.py @@ -33,7 +33,7 @@ ################################################################################ -import copy, os, pg, string, sys +import copy, os, pg, sys import apt_pkg import symlink_dists import daklib.database @@ -275,7 +275,7 @@ def write_filelists(packages, dislocated_files): suites = Cnf.SubTree("Suite").List() else: suites = daklib.utils.split_args(Options["Suite"]) - for suite in map(string.lower, suites): + for suite in [ i.lower() for i in suites ]: d.setdefault(suite, {}) if not Options["Component"]: components = Cnf.ValueList("Suite::%s::Components" % (suite)) @@ -293,7 +293,7 @@ def write_filelists(packages, dislocated_files): architectures = Cnf.ValueList("Suite::%s::Architectures" % (suite)) else: architectures = daklib.utils.split_args(Options["Architectures"]) - for arch in map(string.lower, architectures): + for arch in [ i.lower() for i in architectures ]: d[suite][component].setdefault(arch, {}) if arch == "source": types = [ "dsc" ] diff --git a/dak/process_accepted.py b/dak/process_accepted.py index 849cdfe9..e791b43d 100755 --- a/dak/process_accepted.py +++ b/dak/process_accepted.py @@ -488,7 +488,7 @@ def stable_install (summary, short_summary): q = projectB.query(que) # Reduce the query results to a list of version numbers - ql = map(lambda x: x[0], q.getresult()) + ql = [ i[0] for i in q.getresult() ] if not ql: daklib.utils.fubar("[INTERNAL ERROR] couldn't find '%s' (%s for %s architecture) in binaries table." % (package, version, architecture)) else: diff --git a/dak/rm.py b/dak/rm.py index 8008232b..253110a9 100755 --- a/dak/rm.py +++ b/dak/rm.py @@ -298,7 +298,7 @@ def main (): field = "b.package" else: field = "s.source" - con_packages = "AND %s IN (%s)" % (field, ", ".join(map(repr, arguments))) + con_packages = "AND %s IN (%s)" % (field, ", ".join([ repr(i) for i in arguments ])) (con_suites, con_architectures, con_components, check_source) = \ daklib.utils.parse_args(Options) diff --git a/dak/stats.py b/dak/stats.py index 53c8d2a9..df608214 100755 --- a/dak/stats.py +++ b/dak/stats.py @@ -182,7 +182,7 @@ SELECT suite, count(suite) FROM src_associations GROUP BY suite;""") for arch in Cnf.ValueList("Suite::%s::Architectures" % (suite)): suite_arches[suite_id][arch] = "" suite_id_list.append(suite_id) - output_list = map(lambda x: output_format(x), suite_list) + output_list = [ output_format(i) for i in suite_list ] longest_suite = longest(output_list) arch_list = arches.values() arch_list.sort() diff --git a/daklib/logging.py b/daklib/logging.py index bd81582a..11792c8b 100644 --- a/daklib/logging.py +++ b/daklib/logging.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Logging functions -# Copyright (C) 2001, 2002 James Troup +# Copyright (C) 2001, 2002, 2006 James Troup # $Id: logging.py,v 1.4 2005-11-15 09:50:32 ajt Exp $ # This program is free software; you can redistribute it and/or modify @@ -59,7 +59,7 @@ class Logger: timestamp = time.strftime("%Y%m%d%H%M%S") details.insert(0, timestamp) # Force the contents of the list to be string.join-able - details = map(str, details) + details = [ str(i) for i in details ] # Write out the log in TSV self.logfile.write("|".join(details)+'\n') # Flush the output to enable tail-ing diff --git a/daklib/queue.py b/daklib/queue.py index 72d226ad..13409eb4 100644 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -19,7 +19,7 @@ ############################################################################### -import cPickle, errno, os, pg, re, stat, string, sys, time +import cPickle, errno, os, pg, re, stat, sys, time import apt_inst, apt_pkg import utils, database @@ -699,7 +699,7 @@ distribution.""" q = self.projectB.query(que) # Reduce the query results to a list of version numbers - ql = map(lambda x: x[0], q.getresult()) + ql = [ i[0] for i in q.getresult() ] # Try (1) if source_version in ql: @@ -788,8 +788,8 @@ distribution.""" # Check versions for each target suite for target_suite in self.pkg.changes["distribution"].keys(): - must_be_newer_than = map(string.lower, self.Cnf.ValueList("Suite::%s::VersionChecks::MustBeNewerThan" % (target_suite))) - must_be_older_than = map(string.lower, self.Cnf.ValueList("Suite::%s::VersionChecks::MustBeOlderThan" % (target_suite))) + must_be_newer_than = [ i.lower for i in self.Cnf.ValueList("Suite::%s::VersionChecks::MustBeNewerThan" % (target_suite)) ] + must_be_older_than = [ i.lower for i in self.Cnf.ValueList("Suite::%s::VersionChecks::MustBeOlderThan" % (target_suite)) ] # Enforce "must be newer than target suite" even if conffile omits it if target_suite not in must_be_newer_than: must_be_newer_than.append(target_suite) diff --git a/daklib/utils.py b/daklib/utils.py index 47978228..230391a1 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -683,7 +683,7 @@ def parse_args(Options): else: suite_ids_list.append(suite_id) if suite_ids_list: - con_suites = "AND su.id IN (%s)" % ", ".join(map(str, suite_ids_list)) + con_suites = "AND su.id IN (%s)" % ", ".join([ str(i) for i in suite_ids_list ]) else: fubar("No valid suite given.") else: @@ -699,7 +699,7 @@ def parse_args(Options): else: component_ids_list.append(component_id) if component_ids_list: - con_components = "AND c.id IN (%s)" % ", ".join(map(str, component_ids_list)) + con_components = "AND c.id IN (%s)" % ", ".join([ str(i) for i in component_ids_list ]) else: fubar("No valid component given.") else: @@ -720,7 +720,7 @@ def parse_args(Options): else: arch_ids_list.append(architecture_id) if arch_ids_list: - con_architectures = "AND a.id IN (%s)" % ", ".join(map(str, arch_ids_list)) + con_architectures = "AND a.id IN (%s)" % ", ".join([ str(i) for i in arch_ids_list ]) else: if not check_source: fubar("No valid architecture given.")