Commit 9a4fb568 authored by Ansgar's avatar Ansgar

stop using deprecated python-apt functions

Renamed functions and methods:

  Find              -> find
  FindB             -> find_b
  newConfiguration  -> Configuration
  ParseCommandLine  -> parse_commandline
  ParseSrcDepends   -> parse_src_depends
  ReadConfigFileISC -> read_config_file_isc
  SubTree           -> subtree
  ValueList         -> value_list
  VersionCompare    -> version_compare

Removed functions:

  debExtractControl: replaced with utils.deb_extract_control

Other changes:

  x.has_key(y) -> y in x
  x.Find(y)    -> x[y]

The last change was only done in places where `y' is sure to exists (`x.Find'
would return None otherwise, `x[y]' would raise an exception).
parent 57506ea6
......@@ -115,9 +115,9 @@ def main():
if not Cnf.has_key("Add-User::Options::%s" % (i)):
Cnf["Add-User::Options::%s" % (i)] = ""
apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
apt_pkg.parse_commandline(Cnf, Arguments, sys.argv)
Options = Cnf.SubTree("Add-User::Options")
Options = Cnf.subtree("Add-User::Options")
if Options["help"]:
usage()
......@@ -187,7 +187,7 @@ def main():
name, primary_key)
# Should we send mail to the newly added user?
if Cnf.FindB("Add-User::SendEmail"):
if Cnf.find_b("Add-User::SendEmail"):
mail = name + "<" + emails[0] +">"
Subst = {}
Subst["__NEW_MAINTAINER__"] = mail
......
......@@ -537,9 +537,9 @@ def main():
if not Cnf.has_key("Admin::Options::%s" % (i)):
Cnf["Admin::Options::%s" % (i)] = ""
arguments = apt_pkg.ParseCommandLine(Cnf, arguments, sys.argv)
arguments = apt_pkg.parse_commandline(Cnf, arguments, sys.argv)
options = Cnf.SubTree("Admin::Options")
options = Cnf.subtree("Admin::Options")
if options["Help"] or len(arguments) < 1:
usage()
if options["Dry-Run"]:
......
......@@ -162,8 +162,8 @@ def main():
if not Cnf.has_key(opt):
Cnf[opt] = ""
packages = apt_pkg.ParseCommandLine(Cnf, arguments, sys.argv)
Options = Cnf.SubTree('BtsCategorize::Options')
packages = apt_pkg.parse_commandline(Cnf, arguments, sys.argv)
Options = Cnf.subtree('BtsCategorize::Options')
if Options["Help"]:
usage()
......
......@@ -529,9 +529,9 @@ def main ():
if not cnf.has_key("Check-Archive::Options::%s" % (i)):
cnf["Check-Archive::Options::%s" % (i)] = ""
args = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
args = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
Options = cnf.SubTree("Check-Archive::Options")
Options = cnf.subtree("Check-Archive::Options")
if Options["Help"]:
usage()
......
......@@ -321,8 +321,8 @@ def main ():
for i in [ "help", "no-action" ]:
if not cnf.has_key("Check-Overrides::Options::%s" % (i)):
cnf["Check-Overrides::Options::%s" % (i)] = ""
apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
Options = cnf.SubTree("Check-Overrides::Options")
apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
Options = cnf.subtree("Check-Overrides::Options")
if Options["Help"]:
usage()
......
......@@ -208,8 +208,8 @@ def main ():
('n',"no-action","Clean-Queues::Options::No-Action"),
('v',"verbose","Clean-Queues::Options::Verbose")]
apt_pkg.ParseCommandLine(cnf.Cnf,Arguments,sys.argv)
Options = cnf.SubTree("Clean-Queues::Options")
apt_pkg.parse_commandline(cnf.Cnf,Arguments,sys.argv)
Options = cnf.subtree("Clean-Queues::Options")
if Options["Help"]:
usage()
......
......@@ -417,8 +417,8 @@ def main():
('n',"no-action","Clean-Suites::Options::No-Action"),
('m',"maximum","Clean-Suites::Options::Maximum", "HasArg")]
apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
Options = cnf.SubTree("Clean-Suites::Options")
apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
Options = cnf.subtree("Clean-Suites::Options")
if cnf["Clean-Suites::Options::Maximum"] != "":
try:
......
......@@ -124,8 +124,8 @@ def main():
('l', "limit", 'Contents::Options::Limit', "HasArg"),
('f', "force", 'Contents::Options::Force'),
]
args = apt_pkg.ParseCommandLine(cnf.Cnf, arguments, sys.argv)
options = cnf.SubTree('Contents::Options')
args = apt_pkg.parse_commandline(cnf.Cnf, arguments, sys.argv)
options = cnf.subtree('Contents::Options')
if (len(args) != 1) or options['Help']:
usage()
......
......@@ -320,7 +320,7 @@ def main ():
if not cnf.has_key("Control-Overrides::Options::Type"):
cnf["Control-Overrides::Options::Type"] = "deb"
file_list = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
file_list = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
if cnf["Control-Overrides::Options::Help"]:
usage()
......
......@@ -128,7 +128,7 @@ def britney_changelog(packages, suite, session):
new = {}
for p in current.keys():
if p in old.keys():
if apt_pkg.VersionCompare(current[p], old[p]) > 0:
if apt_pkg.version_compare(current[p], old[p]) > 0:
new[p] = [current[p], old[p]]
else:
new[p] = [current[p], 0]
......@@ -176,7 +176,7 @@ def version_checks(package, architecture, target_suite, new_version, session, fo
violations = False
for suite, version in suite_version_list:
cmp = apt_pkg.VersionCompare(new_version, version)
cmp = apt_pkg.version_compare(new_version, version)
if suite in must_be_newer_than and cmp < 1:
utils.warn("%s (%s): version check violated: %s targeted at %s is *not* newer than %s in %s" % (package, architecture, new_version, target_suite, version, suite))
violations = True
......@@ -199,7 +199,7 @@ def cmp_package_version(a, b):
cmp_package = cmp(a[0], b[0])
if cmp_package != 0:
return cmp_package
return apt_pkg.VersionCompare(a[1], b[1])
return apt_pkg.version_compare(a[1], b[1])
#######################################################################################
......@@ -397,11 +397,11 @@ def main ():
cnf["Control-Suite::Options::%s" % (i)] = ""
try:
file_list = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv);
file_list = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv);
except SystemError as e:
print "%s\n" % e
usage(1)
Options = cnf.SubTree("Control-Suite::Options")
Options = cnf.subtree("Control-Suite::Options")
if Options["Help"]:
usage()
......
......@@ -44,8 +44,8 @@ def main():
for option in [ "help", "source", "destination", "no-action" ]:
if not cnf.has_key("Copy-Installer::Options::%s" % (option)):
cnf["Copy-Installer::Options::%s" % (option)] = ""
extra_arguments = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
Options = cnf.SubTree("Copy-Installer::Options")
extra_arguments = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
Options = cnf.subtree("Copy-Installer::Options")
if Options["Help"]:
usage()
......
......@@ -106,7 +106,7 @@ def do_anais(architecture, binaries_list, source, session):
version = i[1]
if architectures.has_key(arch):
versions.append(version)
versions.sort(apt_pkg.VersionCompare)
versions.sort(apt_pkg.version_compare)
if versions:
latest_version = versions.pop()
else:
......@@ -123,7 +123,7 @@ def do_anais(architecture, binaries_list, source, session):
if versions_d != {}:
anais_output += "\n (*) %s_%s [%s]: %s\n" % (binary, latest_version, source, architecture)
versions = versions_d.keys()
versions.sort(apt_pkg.VersionCompare)
versions.sort(apt_pkg.version_compare)
for version in versions:
arches = versions_d[version]
arches.sort()
......@@ -401,7 +401,7 @@ def do_dubious_nbs(dubious_nbs):
source_binaries.get(source, "(source does not exist)"))
print " won't admit to building:"
versions = dubious_nbs[source].keys()
versions.sort(apt_pkg.VersionCompare)
versions.sort(apt_pkg.version_compare)
for version in versions:
packages = dubious_nbs[source][version].keys()
packages.sort()
......@@ -598,9 +598,9 @@ def main ():
if not cnf.has_key("Cruft-Report::Options::Wanna-Build-Dump"):
cnf["Cruft-Report::Options::Wanna-Build-Dump"] = "/srv/ftp-master.debian.org/scripts/nfu"
apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
Options = cnf.SubTree("Cruft-Report::Options")
Options = cnf.subtree("Cruft-Report::Options")
if Options["Help"]:
usage()
......@@ -722,7 +722,7 @@ def main ():
if source == "":
source = package
if bin2source.has_key(package) and \
apt_pkg.VersionCompare(version, bin2source[package]["version"]) > 0:
apt_pkg.version_compare(version, bin2source[package]["version"]) > 0:
bin2source[package]["version"] = version
bin2source[package]["source"] = source
else:
......@@ -751,10 +751,10 @@ def main ():
for source in nbs.keys():
for package in nbs[source].keys():
versions = nbs[source][package].keys()
versions.sort(apt_pkg.VersionCompare)
versions.sort(apt_pkg.version_compare)
latest_version = versions.pop()
source_version = source_versions.get(source,"0")
if apt_pkg.VersionCompare(latest_version, source_version) == 0:
if apt_pkg.version_compare(latest_version, source_version) == 0:
add_nbs(dubious_nbs, source, latest_version, package, suite_id, session)
if "nviu" in checks:
......
......@@ -59,7 +59,7 @@ def do_update(self):
c.execute("UPDATE queue SET path = %s WHERE id = %s", (dir, row[0]))
print "Adding missing queues to the queue table"
for q in cnf.SubTree("Dir::Queue").keys():
for q in cnf.subtree("Dir::Queue").keys():
qname = q.lower()
if qname in seenqueues.keys():
continue
......
......@@ -115,7 +115,7 @@ def do_update(self):
cnf = Config()
c.execute("""INSERT INTO queue (queue_name, path) VALUES ('buildd', '%s')""" % cnf["Dir::QueueBuild"].rstrip('/'))
for s in cnf.ValueList("Dinstall::QueueBuildSuites"):
for s in cnf.value_list("Dinstall::QueueBuildSuites"):
c.execute("""INSERT INTO suite_queue_copy (suite, queue)
VALUES ( (SELECT id FROM suite WHERE suite_name = '%s'),
(SELECT id FROM queue WHERE queue_name = 'buildd'))""" % s.lower())
......
......@@ -40,7 +40,7 @@ def _suites():
"""
return a list of suites to operate on
"""
suites = Config().SubTree("Suite").List()
suites = Config().subtree("Suite").list()
return suites
def arches(cursor, suite):
......
......@@ -53,9 +53,9 @@ def do_update(self):
for suite in s:
suites[suite[1]]=suite[0]
for suite in Cnf.SubTree("Suite").List():
for suite in Cnf.subtree("Suite").list():
print "Processing suite %s" % (suite)
architectures = Cnf.SubTree("Suite::" + suite).ValueList("Architectures")
architectures = Cnf.subtree("Suite::" + suite).value_list("Architectures")
suite = suite.lower()
for arch in architectures:
c.execute(query, [suites[suite], archs[arch]])
......
......@@ -55,7 +55,7 @@ def do_update(self):
for check in ["Enhances", "MustBeNewerThan", "MustBeOlderThan"]:
for suite_name in suite_id_map.keys():
for reference_name in [ s.lower() for s in cnf.ValueList("Suite::%s::VersionChecks::%s" % (suite_name, check)) ]:
for reference_name in [ s.lower() for s in cnf.value_list("Suite::%s::VersionChecks::%s" % (suite_name, check)) ]:
c.execute("""INSERT INTO version_check (suite, "check", reference) VALUES (%s, %s, %s)""", (suite_id_map[suite_name], check, suite_id_map[reference_name]))
c.execute("UPDATE config SET value = '52' WHERE name = 'db_revision'")
......
......@@ -49,8 +49,8 @@ def do_update(self):
c.execute("ALTER TABLE suite ADD COLUMN untouchable BOOLEAN NOT NULL DEFAULT FALSE;")
query = "UPDATE suite SET untouchable = TRUE WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
untouchable = Cnf.Find("Suite::%s::Untouchable" % (suite))
for suite in Cnf.subtree("Suite").list():
untouchable = Cnf.find("Suite::%s::Untouchable" % (suite))
if not untouchable:
continue
print "[Untouchable] Processing suite %s" % (suite)
......@@ -60,32 +60,32 @@ def do_update(self):
c.execute("ALTER TABLE suite ADD COLUMN announce text NOT NULL DEFAULT 'debian-devel-changes@lists.debian.org';")
query = "UPDATE suite SET announce = %s WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
announce_list = Cnf.Find("Suite::%s::Announce" % (suite))
for suite in Cnf.subtree("Suite").list():
announce_list = Cnf.find("Suite::%s::Announce" % (suite))
print "[Announce] Processing suite %s" % (suite)
suite = suite.lower()
c.execute(query, [announce_list, suite])
c.execute("ALTER TABLE suite ADD COLUMN codename text;")
query = "UPDATE suite SET codename = %s WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
codename = Cnf.Find("Suite::%s::CodeName" % (suite))
for suite in Cnf.subtree("Suite").list():
codename = Cnf.find("Suite::%s::CodeName" % (suite))
print "[Codename] Processing suite %s" % (suite)
suite = suite.lower()
c.execute(query, [codename, suite])
c.execute("ALTER TABLE suite ADD COLUMN overridecodename text;")
query = "UPDATE suite SET overridecodename = %s WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
codename = Cnf.Find("Suite::%s::OverrideCodeName" % (suite))
for suite in Cnf.subtree("Suite").list():
codename = Cnf.find("Suite::%s::OverrideCodeName" % (suite))
print "[OverrideCodeName] Processing suite %s" % (suite)
suite = suite.lower()
c.execute(query, [codename, suite])
c.execute("ALTER TABLE suite ADD COLUMN validtime integer NOT NULL DEFAULT 604800;")
query = "UPDATE suite SET validtime = %s WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
validtime = Cnf.Find("Suite::%s::ValidTime" % (suite))
for suite in Cnf.subtree("Suite").list():
validtime = Cnf.find("Suite::%s::ValidTime" % (suite))
print "[ValidTime] Processing suite %s" % (suite)
if not validtime:
validtime = 0
......@@ -94,8 +94,8 @@ def do_update(self):
c.execute("ALTER TABLE suite ADD COLUMN priority integer NOT NULL DEFAULT 0;")
query = "UPDATE suite SET priority = %s WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
priority = Cnf.Find("Suite::%s::Priority" % (suite))
for suite in Cnf.subtree("Suite").list():
priority = Cnf.find("Suite::%s::Priority" % (suite))
print "[Priority] Processing suite %s" % (suite)
if not priority:
priority = 0
......@@ -105,8 +105,8 @@ def do_update(self):
c.execute("ALTER TABLE suite ADD COLUMN notautomatic BOOLEAN NOT NULL DEFAULT FALSE;")
query = "UPDATE suite SET notautomatic = TRUE WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
notautomatic = Cnf.Find("Suite::%s::NotAutomatic" % (suite))
for suite in Cnf.subtree("Suite").list():
notautomatic = Cnf.find("Suite::%s::NotAutomatic" % (suite))
print "[NotAutomatic] Processing suite %s" % (suite)
if not notautomatic:
continue
......
......@@ -47,7 +47,7 @@ def do_update(self):
# Migrate config file values into database
if cnf.has_key("Check-Overrides::OverrideSuites"):
for suitename in cnf.SubTree("Check-Overrides::OverrideSuites").List():
for suitename in cnf.subtree("Check-Overrides::OverrideSuites").list():
if cnf.get("Check-Overrides::OverrideSuites::%s::Process" % suitename, "0") == "1":
print "Marking %s to have overrides processed automatically" % suitename.lower()
c.execute("UPDATE suite SET overrideprocess = TRUE WHERE suite_name = %s", [suitename.lower()])
......
......@@ -48,8 +48,8 @@ def do_update(self):
c.execute("ALTER TABLE suite ADD COLUMN copychanges TEXT;")
query = "UPDATE suite SET copychanges = %s WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
copychanges = Cnf.Find("Suite::%s::CopyChanges" % (suite))
for suite in Cnf.subtree("Suite").list():
copychanges = Cnf.find("Suite::%s::CopyChanges" % (suite))
print "[CopyChanges] Processing suite %s" % (suite)
if not copychanges:
continue
......@@ -58,8 +58,8 @@ def do_update(self):
c.execute("ALTER TABLE suite ADD COLUMN copydotdak TEXT;")
query = "UPDATE suite SET copydotdak = %s WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
copydotdak = Cnf.Find("Suite::%s::CopyDotDak" % (suite))
for suite in Cnf.subtree("Suite").list():
copydotdak = Cnf.find("Suite::%s::CopyDotDak" % (suite))
print "[CopyDotDak] Processing suite %s" % (suite)
if not copydotdak:
continue
......@@ -68,8 +68,8 @@ def do_update(self):
c.execute("ALTER TABLE suite ADD COLUMN commentsdir TEXT;")
query = "UPDATE suite SET commentsdir = %s WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
commentsdir = Cnf.Find("Suite::%s::CommentsDir" % (suite))
for suite in Cnf.subtree("Suite").list():
commentsdir = Cnf.find("Suite::%s::CommentsDir" % (suite))
print "[CommentsDir] Processing suite %s" % (suite)
if not commentsdir:
continue
......@@ -78,8 +78,8 @@ def do_update(self):
c.execute("ALTER TABLE suite ADD COLUMN overridesuite TEXT;")
query = "UPDATE suite SET overridesuite = %s WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
overridesuite = Cnf.Find("Suite::%s::OverrideSuite" % (suite))
for suite in Cnf.subtree("Suite").list():
overridesuite = Cnf.find("Suite::%s::OverrideSuite" % (suite))
print "[OverrideSuite] Processing suite %s" % (suite)
if not overridesuite:
continue
......@@ -88,8 +88,8 @@ def do_update(self):
c.execute("ALTER TABLE suite ADD COLUMN changelogbase TEXT;")
query = "UPDATE suite SET changelogbase = %s WHERE suite_name = %s" #: Update query
for suite in Cnf.SubTree("Suite").List():
changelogbase = Cnf.Find("Suite::%s::ChangeLogBase" % (suite))
for suite in Cnf.subtree("Suite").list():
changelogbase = Cnf.find("Suite::%s::ChangeLogBase" % (suite))
print "[ChangeLogBase] Processing suite %s" % (suite)
if not changelogbase:
continue
......
......@@ -132,8 +132,8 @@ def main():
cnf['Obsolete::Options::Help'] = ''
cnf['Obsolete::Options::No-Action'] = ''
cnf['Obsolete::Options::Force'] = ''
apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
Options = cnf.SubTree("Obsolete::Options")
apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
Options = cnf.subtree("Obsolete::Options")
if Options['Help']:
usage()
Logger = daklog.Logger("dominate")
......
......@@ -238,8 +238,8 @@ def read_control (filename):
deb_file = utils.open_file(filename)
try:
extracts = apt_inst.debExtractControl(deb_file)
control = apt_pkg.ParseSection(extracts)
extracts = utils.deb_extract_control(deb_file)
control = apt_pkg.TagSection(extracts)
except:
print formatted_text("can't parse control info")
deb_file.close()
......@@ -249,17 +249,17 @@ def read_control (filename):
control_keys = control.keys()
if control.has_key("Depends"):
depends_str = control.Find("Depends")
if "Depends" in control:
depends_str = control["Depends"]
# create list of dependancy lists
depends = split_depends(depends_str)
if control.has_key("Recommends"):
recommends_str = control.Find("Recommends")
if "Recommends" in control:
recommends_str = control["Recommends"]
recommends = split_depends(recommends_str)
if control.has_key("Section"):
section_str = control.Find("Section")
if "Section" in control:
section_str = control["Section"]
c_match = re_contrib.search(section_str)
nf_match = re_nonfree.search(section_str)
......@@ -272,12 +272,12 @@ def read_control (filename):
else :
# main
section = colour_output(section_str, 'main')
if control.has_key("Architecture"):
arch_str = control.Find("Architecture")
if "Architecture" in control:
arch_str = control["Architecture"]
arch = colour_output(arch_str, 'arch')
if control.has_key("Maintainer"):
maintainer = control.Find("Maintainer")
if "Maintainer" in control:
maintainer = control["Maintainer"]
localhost = re_localhost.search(maintainer)
if localhost:
#highlight bad email
......@@ -436,13 +436,13 @@ def output_deb_info(suite, filename, packagename, session = None):
field_value = maintainer
elif key == 'Description':
if use_html:
field_value = formatted_text(control.Find(key), strip=True)
field_value = formatted_text(control.find(key), strip=True)
else:
desc = control.Find(key)
desc = control.find(key)
desc = re_newlinespace.sub('\n ', desc)
field_value = escape_if_needed(desc)
else:
field_value = escape_if_needed(control.Find(key))
field_value = escape_if_needed(control.find(key))
to_print += " "+format_field(key,field_value)+'\n'
return to_print
......@@ -598,8 +598,8 @@ def main ():
if not Cnf.has_key("Examine-Package::Options::%s" % (i)):
Cnf["Examine-Package::Options::%s" % (i)] = ""
args = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
Options = Cnf.SubTree("Examine-Package::Options")
args = apt_pkg.parse_commandline(Cnf,Arguments,sys.argv)
Options = Cnf.subtree("Examine-Package::Options")
if Options["Help"]:
usage()
......
......@@ -153,9 +153,9 @@ def main():
Arguments = [('h',"help","External-Overrides::Options::Help"),
('f','force','External-Overrides::Options::Force')]
args = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
args = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
try:
Options = cnf.SubTree("External-Overrides::Options")
Options = cnf.subtree("External-Overrides::Options")
except KeyError:
Options = {}
......
......@@ -53,9 +53,9 @@ def main():
if not cnf.has_key("Find-Null-Maintainers::Options::%s" % (i)):
cnf["Find-Null-Maintainers::Options::%s" % (i)] = ""
apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
Options = cnf.SubTree("Find-Null-Maintainers::Options")
Options = cnf.subtree("Find-Null-Maintainers::Options")
if Options["Help"]:
usage()
......
......@@ -155,8 +155,8 @@ def main():
cnf['Filelist::Options::Architecture'] = ','.join(architectures).encode()
cnf['Filelist::Options::Help'] = ''
cnf['Filelist::Options::Incremental'] = ''
apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
Options = cnf.SubTree("Filelist::Options")
apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
Options = cnf.subtree("Filelist::Options")
if Options['Help']:
usage()
pool = DakProcessPool()
......
......@@ -298,8 +298,8 @@ def main():
('m', "maxdiffs", "Generate-Index-Diffs::Options::MaxDiffs", "hasArg"),
('n', "n-act", "Generate-Index-Diffs::Options::NoAct"),
]
suites = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
Options = Cnf.SubTree("Generate-Index-Diffs::Options")
suites = apt_pkg.parse_commandline(Cnf,Arguments,sys.argv)
Options = Cnf.subtree("Generate-Index-Diffs::Options")
if Options.has_key("Help"): usage()
maxdiffs = Options.get("MaxDiffs::Default", "56")
......@@ -318,11 +318,11 @@ def main():
Cnf["Dir::Root"] = Options["RootDir"]
if not suites:
suites = Cnf.SubTree("Suite").List()
suites = Cnf.subtree("Suite").list()
for suitename in suites:
print "Processing: " + suitename
SuiteBlock = Cnf.SubTree("Suite::" + suitename)
SuiteBlock = Cnf.subtree("Suite::" + suitename)
suiteobj = get_suite(suitename.lower())
......@@ -336,11 +336,11 @@ def main():
architectures = get_suite_architectures(suite, skipall=True)
if SuiteBlock.has_key("Components"):
components = SuiteBlock.ValueList("Components")
components = SuiteBlock.value_list("Components")
else:
components = []
suite_suffix = Cnf.Find("Dinstall::SuiteSuffix")
suite_suffix = Cnf.find("Dinstall::SuiteSuffix")
if components and suite_suffix:
longsuite = suite + "/" + suite_suffix
else:
......
......@@ -396,8 +396,8 @@ def main ():
('s',"suite","Generate-Packages-Sources::Options::Suite"),
('f',"force","Generate-Packages-Sources::Options::Force")]
suite_names = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
Options = cnf.SubTree("Generate-Packages-Sources::Options")
suite_names = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
Options = cnf.subtree("Generate-Packages-Sources::Options")
if Options["Help"]:
usage()
......
......@@ -313,9 +313,9 @@ def main():
('f',"force","Generate-Packages-Sources::Options::Force"),
('o','option','','ArbItem')]
suite_names = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
suite_names = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
try:
Options = cnf.SubTree("Generate-Packages-Sources::Options")
Options = cnf.subtree("Generate-Packages-Sources::Options")
except KeyError:
Options = {}
......
......@@ -145,7 +145,7 @@ class ReleaseWriter(object):
cnf = Config()
suite_suffix = "%s" % (cnf.Find("Dinstall::SuiteSuffix"))
suite_suffix = "%s" % (cnf.find("Dinstall::SuiteSuffix"))
outfile = os.path.join(cnf["Dir::Root"], 'dists', "%s/%s" % (suite.suite_name, suite_suffix), "Release")
out = open(outfile + ".new", "w")
......@@ -301,8 +301,8 @@ def main ():
('f',"force","Generate-Releases::Options::Force"),
('o','option','','ArbItem')]
suite_names = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
Options = cnf.SubTree("Generate-Releases::Options")
suite_names = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
Options = cnf.subtree("Generate-Releases::Options")
if Options["Help"]:
usage()
......
......@@ -175,9 +175,9 @@ def main():
if not Cnf.has_key("Graph::Options::%s" % (i)):
Cnf["Graph::Options::%s" % (i)] = ""
apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
apt_pkg.parse_commandline(Cnf, Arguments, sys.argv)
Options = Cnf.SubTree("Graph::Options")
Options = Cnf.subtree("Graph::Options")
if Options["Help"]:
usage()
......@@ -187,7 +187,7 @@ def main():
for i in Cnf["Graph::Options::Names"].split(","):
names.append(i)
elif Cnf.has_key("Graph::Names"):
names = Cnf.ValueList("Graph::Names")
names = Cnf.value_list("Graph::Names")
else:
names = default_names
......@@ -199,7 +199,7 @@ def main():
extra_rrdtool_args.extend(f.read().strip().split("\n"))
f.close()
elif Cnf.has_key("Graph::Extra-Rrd"):
for i in Cnf.ValueList("Graph::Extra-Rrd"):
for i in Cnf.value_list("Graph::Extra-Rrd"):
f = open(i)
extra_rrdtool_args.extend(f.read().strip().split("\n"))
f.close()
......
......@@ -93,11 +93,11 @@ def main():
if not cnf.has_key("Import-Keyring::Options::%s" % (i)):
cnf["Import-Keyring::Options::%s" % (i)] = ""
keyring_names = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
keyring_names = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
### Parse options
Options = cnf.SubTree("Import-Keyring::Options")
Options = cnf.subtree("Import-Keyring::Options")
if Options["Help"]:
usage()
......
......@@ -321,7 +321,7 @@ def main():
('v',"verbose", "%s::%s" % (options_prefix,"Verbose")),
]
args = apt_pkg.ParseCommandLine(cnf.Cnf, arguments,sys.argv)
args = apt_pkg.parse_commandline(cnf.Cnf, arguments,sys.argv)
num_threads = 1