+2006-05-21 James Troup <james@nocrew.org>
+
+ * 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-20 James Troup <james@nocrew.org>
* dak/find_null_maintainers.py (main):
################################################################################
-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
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":
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
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
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():
################################################################################
-import commands, pg, os, string, sys, time
+import commands, pg, os, sys, time
import apt_pkg
import daklib.database
import daklib.utils
# 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
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"],
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.
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
################################################################################
-import copy, os, pg, string, sys
+import copy, os, pg, sys
import apt_pkg
import symlink_dists
import daklib.database
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))
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" ]
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:
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)
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()
#!/usr/bin/env python
# Logging functions
-# Copyright (C) 2001, 2002 James Troup <james@nocrew.org>
+# Copyright (C) 2001, 2002, 2006 James Troup <james@nocrew.org>
# $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
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
###############################################################################
-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
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:
# 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)
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:
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:
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.")