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()
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
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"]:
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()
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()
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()
('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()
('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:
('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()
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()
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]
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
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])
#######################################################################################
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()
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()
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:
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()
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()
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()
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:
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:
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
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())
"""
return a list of suites to operate on
"""
- suites = Config().SubTree("Suite").List()
+ suites = Config().subtree("Suite").list()
return suites
def arches(cursor, suite):
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]])
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'")
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)
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
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
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
# 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()])
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
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
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
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
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
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")
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()
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)
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
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
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()
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 = {}
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()
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()
('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")
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())
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:
('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()
('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 = {}
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")
('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()
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()
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
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()
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()
('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
if not cnf.has_key("Import-LDAP-Fingerprints::Options::%s" % (i)):
cnf["Import-LDAP-Fingerprints::Options::%s" % (i)] = ""
- apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
+ apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree("Import-LDAP-Fingerprints::Options")
+ Options = cnf.subtree("Import-LDAP-Fingerprints::Options")
if Options["Help"]:
usage()
print "Assigning %s to 0x%s." % (uid, fingerprint)
else:
extra_keyrings = ""
- for keyring in cnf.ValueList("Import-LDAP-Fingerprints::ExtraKeyrings"):
+ for keyring in cnf.value_list("Import-LDAP-Fingerprints::ExtraKeyrings"):
extra_keyrings += " --keyring=%s" % (keyring)
cmd = "gpg %s %s --list-key %s" \
% (utils.gpg_keyring_args(), extra_keyrings, fingerprint)
('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
if not cnf.has_key("Import-Users-From-Passwd::Options::%s" % (i)):
cnf["Import-Users-From-Passwd::Options::%s" % (i)] = ""
- arguments = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree("Import-Users-From-Passwd::Options")
+ arguments = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
+ Options = cnf.subtree("Import-Users-From-Passwd::Options")
if Options["Help"]:
usage()
def process_tree(config, tree):
"""Create directories for a config tree."""
- for entry in config.SubTree(tree).List():
+ for entry in config.subtree(tree).list():
entry = entry.lower()
config_name = "%s::%s" % (tree, entry)
target = config[config_name]
for subdir in [ "Clean-Queues", "Clean-Suites" ]:
process_morguesubdir(subdir)
- suite_suffix = "%s" % (Cnf.Find("Dinstall::SuiteSuffix"))
+ suite_suffix = "%s" % (Cnf.find("Dinstall::SuiteSuffix"))
# Process secret keyrings
if Cnf.has_key('Dinstall::SigningKeyring'):
d = DBConn()
- arguments = apt_pkg.ParseCommandLine(Cnf, arguments, sys.argv)
+ arguments = apt_pkg.parse_commandline(Cnf, arguments, sys.argv)
- options = Cnf.SubTree("Init-Dirs::Options")
+ options = Cnf.subtree("Init-Dirs::Options")
if options["Help"]:
usage()
elif arguments:
if not cnf.has_key("Ls::Options::%s" % (i)):
cnf["Ls::Options::%s" % (i)] = ""
- packages = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree("Ls::Options")
+ packages = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
+ Options = cnf.subtree("Ls::Options")
if Options["Help"]:
usage()
highver.setdefault(pkg,"")
if not d[pkg].has_key(version):
d[pkg][version] = {}
- if apt_pkg.VersionCompare(version, highver[pkg]) > 0:
+ if apt_pkg.version_compare(version, highver[pkg]) > 0:
highver[pkg] = version
if not d[pkg][version].has_key(suite):
d[pkg][version][suite] = []
packages.sort()
for pkg in packages:
versions = d[pkg].keys()
- versions.sort(apt_pkg.VersionCompare)
+ versions.sort(apt_pkg.version_compare)
for version in versions:
suites = d[pkg][version].keys()
suites.sort()
if not Cnf.has_key('Make-Changelog::Options::%s' % (i)):
Cnf['Make-Changelog::Options::%s' % (i)] = ''
- apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
- Options = Cnf.SubTree('Make-Changelog::Options')
+ apt_pkg.parse_commandline(Cnf, Arguments, sys.argv)
+ Options = Cnf.subtree('Make-Changelog::Options')
suite = Cnf['Make-Changelog::Options::Suite']
base_suite = Cnf['Make-Changelog::Options::Base-Suite']
binnmu = Cnf['Make-Changelog::Options::binNMU']
if not cnf.has_key("Make-Maintainers::Options::Help"):
cnf["Make-Maintainers::Options::Help"] = ""
- extra_files = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree("Make-Maintainers::Options")
+ extra_files = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
+ Options = cnf.subtree("Make-Maintainers::Options")
if Options["Help"]:
usage()
for i in [ "help" ]:
if not cnf.has_key("Make-Overrides::Options::%s" % (i)):
cnf["Make-Overrides::Options::%s" % (i)] = ""
- apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree("Make-Overrides::Options")
+ apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
+ Options = cnf.subtree("Make-Overrides::Options")
if Options["Help"]:
usage()
('n',"no-action","Manage-Build-Queues::Options::No-Action"),
('a',"all","Manage-Build-Queues::Options::All")]
- queue_names = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree("Manage-Build-Queues::Options")
+ queue_names = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
+ Options = cnf.subtree("Manage-Build-Queues::Options")
if Options["Help"]:
usage()
('l', "limit", 'Metadata::Options::Limit', "HasArg"),
('f', "force", 'Metadata::Options::Force'),
]
- args = apt_pkg.ParseCommandLine(cnf.Cnf, arguments, sys.argv)
- options = cnf.SubTree('Metadata::Options')
+ args = apt_pkg.parse_commandline(cnf.Cnf, arguments, sys.argv)
+ options = cnf.subtree('Metadata::Options')
if (len(args) != 1) or options['Help']:
usage()
if not cnf.has_key("Security::Options::%s" % (i)):
cnf["Security::Options::%s" % (i)] = ""
- changes_files = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
+ changes_files = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree("Security::Options")
+ Options = cnf.subtree("Security::Options")
if Options['Help']:
usage()
if not cnf.has_key("Override::Options::Suite"):
cnf["Override::Options::Suite"] = "unstable"
- arguments = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree("Override::Options")
+ arguments = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
+ Options = cnf.subtree("Override::Options")
if Options["Help"]:
usage()
Subst["__OVERRIDE_ADDRESS__"] = cnf["Dinstall::MyEmailAddress"]
Subst["__BUG_SERVER__"] = cnf["Dinstall::BugServer"]
bcc = []
- if cnf.Find("Dinstall::Bcc") != "":
+ if cnf.find("Dinstall::Bcc") != "":
bcc.append(cnf["Dinstall::Bcc"])
if bcc:
Subst["__BCC__"] = "Bcc: " + ", ".join(bcc)
if not cnf.has_key('Override-Disparity::Options::Suite'):
cnf['Override-Disparity::Options::Suite'] = 'unstable'
- apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree('Override-Disparity::Options')
+ apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
+ Options = cnf.subtree('Override-Disparity::Options')
if Options['help']:
usage()
summary = ""
for f in files.keys():
if files[f]["type"] == "deb":
- control = apt_pkg.ParseSection(apt_inst.debExtractControl(utils.open_file(f)))
+ control = apt_pkg.TagSection(utils.deb_extract_control(utils.open_file(f)))
summary += "\n"
- summary += "Package: %s\n" % (control.Find("Package"))
- summary += "Description: %s\n" % (control.Find("Description"))
+ summary += "Package: %s\n" % (control.find("Package"))
+ summary += "Description: %s\n" % (control.find("Description"))
upload.Subst["__BINARY_DESCRIPTIONS__"] = summary
bxa_mail = utils.TemplateSubst(upload.Subst,Config()["Dir::Templates"]+"/process-new.bxa_notification")
utils.send_mail(bxa_mail)
session.commit()
- if Config().FindB("Dinstall::BXANotify"):
+ if Config().find_b("Dinstall::BXANotify"):
do_bxa_notification(upload)
################################################################################
if not cnf.has_key("Process-New::Options::%s" % (i)):
cnf["Process-New::Options::%s" % (i)] = ""
- changes_files = apt_pkg.ParseCommandLine(cnf.Cnf,Arguments,sys.argv)
+ changes_files = apt_pkg.parse_commandline(cnf.Cnf,Arguments,sys.argv)
if len(changes_files) == 0:
new_queue = get_policy_queue('new', session );
changes_paths = [ os.path.join(new_queue.path, j) for j in utils.get_changes_files(new_queue.path) ]
else:
changes_paths = [ os.path.abspath(j) for j in changes_files ]
- Options = cnf.SubTree("Process-New::Options")
+ Options = cnf.subtree("Process-New::Options")
if Options["Help"]:
usage()
if not cnf.has_key("Process-Policy::Options::%s" % (i)):
cnf["Process-Policy::Options::%s" % (i)] = ""
- queue_name = apt_pkg.ParseCommandLine(cnf.Cnf,Arguments,sys.argv)
+ queue_name = apt_pkg.parse_commandline(cnf.Cnf,Arguments,sys.argv)
if len(queue_name) != 1:
print "E: Specify exactly one policy queue"
queue_name = queue_name[0]
- Options = cnf.SubTree("Process-Policy::Options")
+ Options = cnf.subtree("Process-Policy::Options")
if Options["Help"]:
usage()
if not cnf.has_key("Dinstall::Options::%s" % (i)):
cnf["Dinstall::Options::%s" % (i)] = ""
- changes_files = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree("Dinstall::Options")
+ changes_files = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
+ Options = cnf.subtree("Dinstall::Options")
if Options["Help"]:
usage()
if not Cnf.has_key("Queue-Report::Options::%s" % (i)):
Cnf["Queue-Report::Options::%s" % (i)] = ""
- apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
+ apt_pkg.parse_commandline(Cnf, Arguments, sys.argv)
- Options = Cnf.SubTree("Queue-Report::Options")
+ Options = Cnf.subtree("Queue-Report::Options")
if Options["Help"]:
usage()
for i in Cnf["Queue-Report::Options::Directories"].split(","):
queue_names.append(i)
elif Cnf.has_key("Queue-Report::Directories"):
- queue_names = Cnf.ValueList("Queue-Report::Directories")
+ queue_names = Cnf.value_list("Queue-Report::Directories")
else:
queue_names = [ "byhand", "new" ]
if not cnf.has_key("Rm::Options::Suite"):
cnf["Rm::Options::Suite"] = "unstable"
- arguments = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
- Options = cnf.SubTree("Rm::Options")
+ arguments = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
+ Options = cnf.subtree("Rm::Options")
if Options["Help"]:
usage()
q = session.execute("SELECT l.path, f.filename, b.package, b.version, a.arch_string, b.id, b.maintainer FROM binaries b, bin_associations ba, architecture a, suite su, files f, location l, component c WHERE ba.bin = b.id AND ba.suite = su.id AND b.architecture = a.id AND b.file = f.id AND f.location = l.id AND l.component = c.id %s %s %s AND b.package = '%s'" % (con_suites, con_components, con_architectures, package))
for i in q.fetchall():
filename = "/".join(i[:2])
- control = apt_pkg.ParseSection(apt_inst.debExtractControl(utils.open_file(filename)))
- source = control.Find("Source", control.Find("Package"))
+ control = apt_pkg.TagSection(utils.deb_extract_control(utils.open_file(filename)))
+ source = control.find("Source", control.find("Package"))
source = re_strip_source_version.sub('', source)
if source_packages.has_key(source):
to_remove.append(i[2:])
versions = []
for package in removals:
versions = d[package].keys()
- versions.sort(apt_pkg.VersionCompare)
+ versions.sort(apt_pkg.version_compare)
for version in versions:
d[package][version].sort(utils.arch_compare_sw)
summary += "%10s | %10s | %s\n" % (package, version, ", ".join(d[package][version]))
if Options["Done"]:
Subst_close_rm = Subst_common
bcc = []
- if cnf.Find("Dinstall::Bcc") != "":
+ if cnf.find("Dinstall::Bcc") != "":
bcc.append(cnf["Dinstall::Bcc"])
- if cnf.Find("Rm::Bcc") != "":
+ if cnf.find("Rm::Bcc") != "":
bcc.append(cnf["Rm::Bcc"])
if bcc:
Subst_close_rm["__BCC__"] = "Bcc: " + ", ".join(bcc)
("p","link-path","Show-Deferred::LinkPath","HasArg"),
("d","deferred-queue","Show-Deferred::DeferredQueue","HasArg"),
('r',"rrd","Show-Deferred::Options::Rrd", "HasArg")]
- args = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
+ args = apt_pkg.parse_commandline(Cnf,Arguments,sys.argv)
for i in ["help"]:
if not Cnf.has_key("Show-Deferred::Options::%s" % (i)):
Cnf["Show-Deferred::Options::%s" % (i)] = ""
print >> sys.stderr, """Show-Deferred::%s is mandatory.
set via config file or command-line option %s"""%(i,j)
- Options = Cnf.SubTree("Show-Deferred::Options")
+ Options = Cnf.subtree("Show-Deferred::Options")
if Options["help"]:
usage()
if not cnf.has_key("Show-New::Options::%s" % (i)):
cnf["Show-New::Options::%s" % (i)] = ""
- changes_files = apt_pkg.ParseCommandLine(cnf.Cnf,Arguments,sys.argv)
+ changes_files = apt_pkg.parse_commandline(cnf.Cnf,Arguments,sys.argv)
if len(changes_files) == 0:
new_queue = get_policy_queue('new', session );
changes_files = utils.get_changes_files(new_queue.path)
- Options = cnf.SubTree("Show-New::Options")
+ Options = cnf.subtree("Show-New::Options")
if Options["help"]:
usage()
if not Cnf.has_key("Stats::Options::%s" % (i)):
Cnf["Stats::Options::%s" % (i)] = ""
- args = apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
+ args = apt_pkg.parse_commandline(Cnf, Arguments, sys.argv)
- Options = Cnf.SubTree("Stats::Options")
+ Options = Cnf.subtree("Stats::Options")
if Options["Help"]:
usage()
if not Cnf.has_key("Edit-Transitions::Options::%s" % (i)):
Cnf["Edit-Transitions::Options::%s" % (i)] = ""
- apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
+ apt_pkg.parse_commandline(Cnf, Arguments, sys.argv)
- Options = Cnf.SubTree("Edit-Transitions::Options")
+ Options = Cnf.subtree("Edit-Transitions::Options")
if Options["help"]:
usage()
print "Transition source %s not in testing, transition still ongoing." % (source)
else:
current = sourceobj.version
- compare = apt_pkg.VersionCompare(current, expected)
+ compare = apt_pkg.version_compare(current, expected)
if compare < 0:
# This is still valid, the current version in database is older than
# the new version we wait for
# No package in testing
print "Transition source %s not in testing, transition still ongoing." % (source)
else:
- compare = apt_pkg.VersionCompare(sourceobj.version, expected)
+ compare = apt_pkg.version_compare(sourceobj.version, expected)
print "Apt compare says: %s" % (compare)
if compare < 0:
# This is still valid, the current version in database is older than
if not cnf.has_key("Update-DB::Options::%s" % (i)):
cnf["Update-DB::Options::%s" % (i)] = ""
- arguments = apt_pkg.ParseCommandLine(cnf.Cnf, arguments, sys.argv)
+ arguments = apt_pkg.parse_commandline(cnf.Cnf, arguments, sys.argv)
- options = cnf.SubTree("Update-DB::Options")
+ options = cnf.subtree("Update-DB::Options")
if options["Help"]:
self.usage()
elif arguments:
from cPickle import Unpickler, Pickler
from errno import EPERM
-from apt_inst import debExtractControl
-from apt_pkg import ParseSection
+from apt_pkg import TagSection
-from utils import open_file, fubar, poolify
+from utils import open_file, fubar, poolify, deb_extract_control
from config import *
from dbconn import *
if entry["type"] == "deb":
deb_fh = open_file(name)
- summary += ParseSection(debExtractControl(deb_fh))["Description"] + '\n'
+ summary += TagSection(deb_extract_control(deb_fh))["Description"] + '\n'
deb_fh.close()
else:
"""Sort by source name, source, version, 'have source', and
finally by filename."""
# Sort by source version
- q = apt_pkg.VersionCompare(a["version"], b["version"])
+ q = apt_pkg.version_compare(a["version"], b["version"])
if q:
return -q
def _readconf(self):
apt_pkg.init()
- self.Cnf = apt_pkg.newConfiguration()
+ self.Cnf = apt_pkg.Configuration()
- apt_pkg.ReadConfigFileISC(self.Cnf, which_conf_file())
+ apt_pkg.read_config_file_isc(self.Cnf, which_conf_file())
# Check whether our dak.conf was the real one or
# just a pointer to our main one
res = socket.gethostbyaddr(socket.gethostname())
conffile = self.Cnf.get("Config::" + res[0] + "::DakConfig")
if conffile:
- apt_pkg.ReadConfigFileISC(self.Cnf, conffile)
+ apt_pkg.read_config_file_isc(self.Cnf, conffile)
# Rebind some functions
# TODO: Clean this up
self.get = self.Cnf.get
- self.SubTree = self.Cnf.SubTree
- self.ValueList = self.Cnf.ValueList
- self.Find = self.Cnf.Find
- self.FindB = self.Cnf.FindB
+ self.subtree = self.Cnf.subtree
+ self.value_list = self.Cnf.value_list
+ self.find = self.Cnf.find
+ self.find_b = self.Cnf.find_b
def has_key(self, name):
return self.Cnf.has_key(name)
from config import Config
from textutils import fix_maintainer
from dak_exceptions import DBUpdateError, NoSourceFieldError, FileExistsError
+import utils
# suppress some deprecation warnings in squeeze related to sqlalchemy
import warnings
import apt_inst
fullpath = self.poolfile.fullpath
deb_file = open(fullpath, 'r')
- stanza = apt_inst.debExtractControl(deb_file)
+ stanza = utils.deb_extract_control(deb_file)
deb_file.close()
return stanza
Cnf = Config()
# Handle suite mappings
- for m in Cnf.ValueList("SuiteMappings"):
+ for m in Cnf.value_list("SuiteMappings"):
args = m.split()
mtype = args[0]
if mtype == "map" or mtype == "silent-map":
# Extract package control information
deb_file = utils.open_file(f)
try:
- control = apt_pkg.ParseSection(apt_inst.debExtractControl(deb_file))
+ control = apt_pkg.TagSection(utils.deb_extract_control(deb_file))
except:
- self.rejects.append("%s: debExtractControl() raised %s." % (f, sys.exc_info()[0]))
+ self.rejects.append("%s: deb_extract_control() raised %s." % (f, sys.exc_info()[0]))
deb_file.close()
# Can't continue, none of the checks on control would work.
return
# Check for mandatory fields
for field in [ "Package", "Architecture", "Version", "Description" ]:
- if control.Find(field) == None:
+ if field not in control:
# Can't continue
self.rejects.append("%s: No %s field in control." % (f, field))
return
# Ensure the package name matches the one give in the .changes
- if not self.pkg.changes["binary"].has_key(control.Find("Package", "")):
- self.rejects.append("%s: control file lists name as `%s', which isn't in changes file." % (f, control.Find("Package", "")))
+ if not self.pkg.changes["binary"].has_key(control.find("Package", "")):
+ self.rejects.append("%s: control file lists name as `%s', which isn't in changes file." % (f, control.find("Package", "")))
# Validate the package field
- package = control.Find("Package")
+ package = control["Package"]
if not re_valid_pkg_name.match(package):
self.rejects.append("%s: invalid package name '%s'." % (f, package))
# Validate the version field
- version = control.Find("Version")
+ version = control["Version"]
if not re_valid_version.match(version):
self.rejects.append("%s: invalid version number '%s'." % (f, version))
# Ensure the architecture of the .deb is one we know about.
default_suite = cnf.get("Dinstall::DefaultSuite", "unstable")
- architecture = control.Find("Architecture")
+ architecture = control["Architecture"]
upload_suite = self.pkg.changes["distribution"].keys()[0]
if architecture not in [a.arch_string for a in get_suite_architectures(default_suite, session = session)] \
self.rejects.append("%s: control file lists arch as `%s', which isn't in changes file." % (f, architecture))
# Sanity-check the Depends field
- depends = control.Find("Depends")
+ depends = control.find("Depends")
if depends == '':
self.rejects.append("%s: Depends field is empty." % (f))
# Sanity-check the Provides field
- provides = control.Find("Provides")
- if provides:
+ provides = control.find("Provides")
+ if provides is not None:
provide = re_spacestrip.sub('', provides)
if provide == '':
self.rejects.append("%s: Provides field is empty." % (f))
# If there is a Built-Using field, we need to check we can find the
# exact source version
- built_using = control.Find("Built-Using")
- if built_using:
+ built_using = control.find("Built-Using")
+ if built_using is not None:
try:
entry["built-using"] = []
for dep in apt_pkg.parse_depends(built_using):
# Check the section & priority match those given in the .changes (non-fatal)
- if control.Find("Section") and entry["section"] != "" \
- and entry["section"] != control.Find("Section"):
+ if control.find("Section") and entry["section"] != "" \
+ and entry["section"] != control.find("Section"):
self.warnings.append("%s control file lists section as `%s', but changes file has `%s'." % \
- (f, control.Find("Section", ""), entry["section"]))
- if control.Find("Priority") and entry["priority"] != "" \
- and entry["priority"] != control.Find("Priority"):
+ (f, control.find("Section", ""), entry["section"]))
+ if control.find("Priority") and entry["priority"] != "" \
+ and entry["priority"] != control.find("Priority"):
self.warnings.append("%s control file lists priority as `%s', but changes file has `%s'." % \
- (f, control.Find("Priority", ""), entry["priority"]))
+ (f, control.find("Priority", ""), entry["priority"]))
entry["package"] = package
entry["architecture"] = architecture
entry["version"] = version
- entry["maintainer"] = control.Find("Maintainer", "")
+ entry["maintainer"] = control.find("Maintainer", "")
if f.endswith(".udeb"):
self.pkg.files[f]["dbtype"] = "udeb"
else:
self.rejects.append("%s is neither a .deb or a .udeb." % (f))
- entry["source"] = control.Find("Source", entry["package"])
+ entry["source"] = control.find("Source", entry["package"])
# Get the source version
source = entry["source"]
if entry["package"] != file_package:
self.rejects.append("%s: package part of filename (%s) does not match package name in the %s (%s)." % \
(f, file_package, entry["dbtype"], entry["package"]))
- epochless_version = re_no_epoch.sub('', control.Find("Version"))
+ epochless_version = re_no_epoch.sub('', control.find("Version"))
# version
file_version = m.group(2)
return
# Handle component mappings
- for m in cnf.ValueList("ComponentMappings"):
+ for m in cnf.value_list("ComponentMappings"):
(source, dest) = m.split()
if entry["component"] == source:
entry["original component"] = source
if not has_source:
self.rejects.append("no source found and Architecture line in changes mention source.")
- if (not has_binaries) and (not cnf.FindB("Dinstall::AllowSourceOnlyUploads")):
+ if (not has_binaries) and (not cnf.find_b("Dinstall::AllowSourceOnlyUploads")):
self.rejects.append("source only uploads are not supported.")
###########################################################################
if field:
# Have apt try to parse them...
try:
- apt_pkg.ParseSrcDepends(field)
+ apt_pkg.parse_src_depends(field)
except:
self.rejects.append("%s: invalid %s field (can not be parsed by apt)." % (dsc_filename, field_name.title()))
self.rejects.append("'dpkg-source -x' failed for %s. (%s)" % (dsc_filename, str(e)))
return
- if not cnf.Find("Dir::BTSVersionTrack"):
+ if not cnf.find("Dir::BTSVersionTrack"):
return
# Get the upstream version
if not self.pkg.changes.has_key("urgency"):
self.pkg.changes["urgency"] = cnf["Urgency::Default"]
self.pkg.changes["urgency"] = self.pkg.changes["urgency"].lower()
- if self.pkg.changes["urgency"] not in cnf.ValueList("Urgency::Valid"):
+ if self.pkg.changes["urgency"] not in cnf.value_list("Urgency::Valid"):
self.warnings.append("%s is not a valid urgency; it will be treated as %s by testing." % \
(self.pkg.changes["urgency"], cnf["Urgency::Default"]))
self.pkg.changes["urgency"] = cnf["Urgency::Default"]
# Will be None if nothing is in testing.
current = get_source_in_suite(source, "testing", session)
if current is not None:
- compare = apt_pkg.VersionCompare(current.version, expected)
+ compare = apt_pkg.version_compare(current.version, expected)
if current is None or compare < 0:
# This is still valid, the current version in testing is older than
del self.Subst["__ANNOUNCE_LIST_ADDRESS__"]
- if cnf.FindB("Dinstall::CloseBugs") and cnf.has_key("Dinstall::BugServer"):
+ if cnf.find_b("Dinstall::CloseBugs") and cnf.has_key("Dinstall::BugServer"):
summary = self.close_bugs(summary, action)
del self.Subst["__SHORT_SUMMARY__"]
self.announce(short_summary, 1)
## Helper stuff for DebBugs Version Tracking
- if cnf.Find("Dir::BTSVersionTrack"):
+ if cnf.find("Dir::BTSVersionTrack"):
if self.pkg.changes["architecture"].has_key("source"):
(fd, temp_filename) = utils.temp_filename(cnf["Dir::BTSVersionTrack"], prefix=".")
version_history = os.fdopen(fd, 'w')
cnf = Config()
# Abandon the check if override disparity checks have been disabled
- if not cnf.FindB("Dinstall::OverrideDisparityCheck"):
+ if not cnf.find_b("Dinstall::OverrideDisparityCheck"):
return
summary = self.pkg.check_override()
anysuite = [suite] + [ vc.reference.suite_name for vc in get_version_checks(suite, "Enhances") ]
for (s, v) in sv_list:
if s in [ x.lower() for x in anysuite ]:
- if not anyversion or apt_pkg.VersionCompare(anyversion, v) <= 0:
+ if not anyversion or apt_pkg.version_compare(anyversion, v) <= 0:
anyversion = v
return anyversion
must_be_newer_than.append(target_suite)
for (suite, existent_version) in sv_list:
- vercmp = apt_pkg.VersionCompare(new_version, existent_version)
+ vercmp = apt_pkg.version_compare(new_version, existent_version)
if suite in must_be_newer_than and sourceful and vercmp < 1:
self.rejects.append("%s: old version (%s) in %s >= new version (%s) targeted at %s." % (filename, existent_version, suite, new_version, target_suite))
# we could just stick with the "...old version..." REJECT
# for this, I think.
self.rejects.append("Won't propogate NEW packages.")
- elif apt_pkg.VersionCompare(new_version, add_version) < 0:
+ elif apt_pkg.version_compare(new_version, add_version) < 0:
# propogation would be redundant. no need to reject though.
self.warnings.append("ignoring versionconflict: %s: old version (%s) in %s <= new version (%s) targeted at %s." % (filename, existent_version, suite, new_version, target_suite))
cansave = 1
- elif apt_pkg.VersionCompare(new_version, add_version) > 0 and \
- apt_pkg.VersionCompare(add_version, target_version) >= 0:
+ elif apt_pkg.version_compare(new_version, add_version) > 0 and \
+ apt_pkg.version_compare(add_version, target_version) >= 0:
# propogate!!
self.warnings.append("Propogating upload to %s" % (addsuite))
self.pkg.changes.setdefault("propdistribution", {})
all_auto = 0
continue
- ABH = cnf.SubTree("AutomaticByHandPackages")
+ ABH = cnf.subtree("AutomaticByHandPackages")
if not ABH.has_key(pckg) or \
ABH["%s::Source" % (pckg)] != u.pkg.changes["source"]:
print "not match %s %s" % (pckg, u.pkg.changes["source"])
res = socket.getfqdn()
# In case we allow local config files per user, try if one exists
- if Cnf.FindB("Config::" + res + "::AllowLocalConfig"):
+ if Cnf.find_b("Config::" + res + "::AllowLocalConfig"):
homedir = os.getenv("HOME")
confpath = os.path.join(homedir, "/etc/dak.conf")
if os.path.exists(confpath):
def which_apt_conf_file ():
res = socket.getfqdn()
# In case we allow local config files per user, try if one exists
- if Cnf.FindB("Config::" + res + "::AllowLocalConfig"):
+ if Cnf.find_b("Config::" + res + "::AllowLocalConfig"):
homedir = os.getenv("HOME")
confpath = os.path.join(homedir, "/etc/dak.conf")
if os.path.exists(confpath):
# Sort by source version
a_version = a_changes.get("version", "0")
b_version = b_changes.get("version", "0")
- q = apt_pkg.VersionCompare(a_version, b_version)
+ q = apt_pkg.version_compare(a_version, b_version)
if q:
return q
apt_pkg.init()
-Cnf = apt_pkg.newConfiguration()
+Cnf = apt_pkg.Configuration()
if not os.getenv("DAK_TEST"):
- apt_pkg.ReadConfigFileISC(Cnf,default_config)
+ apt_pkg.read_config_file_isc(Cnf,default_config)
if which_conf_file() != default_config:
- apt_pkg.ReadConfigFileISC(Cnf,which_conf_file())
+ apt_pkg.read_config_file_isc(Cnf,which_conf_file())
################################################################################