]> git.decadent.org.uk Git - dak.git/commitdiff
stop using deprecated python-apt functions
authorAnsgar Burchardt <ansgar@debian.org>
Sun, 6 May 2012 15:16:52 +0000 (17:16 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Thu, 10 May 2012 08:27:13 +0000 (10:27 +0200)
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).

62 files changed:
dak/add_user.py
dak/admin.py
dak/bts_categorize.py
dak/check_archive.py
dak/check_overrides.py
dak/clean_queues.py
dak/clean_suites.py
dak/contents.py
dak/control_overrides.py
dak/control_suite.py
dak/copy_installer.py
dak/cruft_report.py
dak/dakdb/update20.py
dak/dakdb/update21.py
dak/dakdb/update28.py
dak/dakdb/update4.py
dak/dakdb/update52.py
dak/dakdb/update7.py
dak/dakdb/update70.py
dak/dakdb/update8.py
dak/dominate.py
dak/examine_package.py
dak/external_overrides.py
dak/find_null_maintainers.py
dak/generate_filelist.py
dak/generate_index_diffs.py
dak/generate_packages_sources.py
dak/generate_packages_sources2.py
dak/generate_releases.py
dak/graph.py
dak/import_keyring.py
dak/import_known_changes.py
dak/import_ldap_fingerprints.py
dak/import_new_files.py
dak/import_users_from_passwd.py
dak/init_dirs.py
dak/ls.py
dak/make_changelog.py
dak/make_maintainers.py
dak/make_overrides.py
dak/manage_build_queues.py
dak/metadata.py
dak/new_security_install.py
dak/override.py
dak/override_disparity.py
dak/process_new.py
dak/process_policy.py
dak/process_upload.py
dak/queue_report.py
dak/rm.py
dak/show_deferred.py
dak/show_new.py
dak/stats.py
dak/transitions.py
dak/update_db.py
daklib/changes.py
daklib/changesutils.py
daklib/config.py
daklib/dbconn.py
daklib/queue.py
daklib/queue_install.py
daklib/utils.py

index 8ab4d2302077e41a69487b15203652bcad2cbac9..aaab5c8028fa9f6949b57be6965f59eb7b4cf4cd 100755 (executable)
@@ -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
index de324bfd084fdd4445358278a23391e92dc91641..23b4c2d8e1a05ff17e1d7f8aecb51dab9e75c24c 100755 (executable)
@@ -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"]:
index b2cb3d40c465836d623b0a98a8a70ffc53ae5187..c8739af65618fa16ff2c569306f61a45e94dc975 100755 (executable)
@@ -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()
index e54252266f808f6119b240495882cd80ef736805..a47febbd229768a952812e5537061f35cc243893 100755 (executable)
@@ -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()
 
index e833aa75ff4a479b420ac6b82e97554c12e1877c..aed0a6475677e3e03d1a634910a0a0435f3ff0bb 100755 (executable)
@@ -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()
index e6e4f76cb32b23b77da55885e8d9022d95e10bb6..d947818c4612fef26f4e5d0c246b1c2cc0d8a66c 100755 (executable)
@@ -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()
index 7419b83b5496e9b3ecca15e19d71326b8e449be0..66bda62df6351665934fa7256cc7ea55a4ebc815 100755 (executable)
@@ -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:
index 76effc1d91306069203f498cd4169488c3643862..f36e96dcaf0449749bef146ae19fe5f4995b5e5c 100755 (executable)
@@ -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()
index 803c8951d07e65b5f9f9ed5a8f7d6b3bf9fcf940..f9258d524e5e5416d997f2760773f495a8b5e4e1 100755 (executable)
@@ -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()
index 4216a2ab44f68adb6d6eaa39c8ebd8475c93308c..2d8a295a7fa0f8e3805d8e5fb7b5d54230732d1c 100755 (executable)
@@ -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()
index 34ae3215ef4a9834078f2f99aee697757a89b6b4..c70b048dfe22bc9d8c24a76a747a9230df5f556e 100755 (executable)
@@ -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()
index 93410620ac4f25545423a6cf70b910e4ede28b78..73f51025152d4dc19970402bc54b82553d2aff21 100755 (executable)
@@ -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:
index c1424ab2da502aa8c236dcfb4dc2d0f8ba1ad912..0e8ac9d81d8f380b4eb116a2af977bb4696e28b8 100755 (executable)
@@ -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
index c91b6f1410e4cd486fd6fd4737a84d710326bd45..41cef6dc8c47d70093aa7af54a1e73b08cc887ec 100755 (executable)
@@ -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())
index 1455ee3110284d3cdd4d48effd237f1d0a1fc2d0..f0c62e0e8176ba26c027943f6adde5b36bcf9739 100755 (executable)
@@ -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):
index 938522ccd83cddacc7d9765cd360c2c6d034f1c5..a6456bea8095c7dd557f0a92854fa1ea5df42cb5 100755 (executable)
@@ -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]])
index aa7a10d16fa62e95650ab1cf10c48fc886aee2fb..8bfaba30bda9790c5c74333c6e17a7cfbe1dc7ab 100755 (executable)
@@ -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'")
index 9c3dd1ed6662f4faa8eb2ea5cb5f9515297f0c18..bfd8867072be1681d49341ad98c4921039247a02 100755 (executable)
@@ -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
index 333c5d6b5ec16d66b5516a4eb3e137d67dc538d7..72421b49155433e8f8b2029f9cb8dc9ad0d579ac 100755 (executable)
@@ -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()])
index 98e0f088048e06c2981c80ac7ad8d33f57844b7e..6bacd4ed1e79613cb0297e2d9a53b227ead91f70 100755 (executable)
@@ -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
index 5d1bafdf7562092cec8c63ab450f9275917736d2..5c919ab89b05a74f1082c78159c10df843e79805 100755 (executable)
@@ -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")
index edb9384b6c5be92b0e20ff23544ba1a031922ef4..87c7ea9fbb14ed959fe7308be787f6971278312f 100755 (executable)
@@ -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()
index 5bc098c7b1828e376a98b2901897f0fa2e5c7faa..40bdb80e67ac5ac7ff158d6daf422b68455f2cb5 100755 (executable)
@@ -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 = {}
 
index 730b277008a976f09af12a343b99cd555193ac5a..3894f574bfabcb907ef74001520452ba9ff5e357 100755 (executable)
@@ -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()
 
index 7823295f5344b9874ef934e7e13c1eb6008c8595..faf08bd7a8680e59802d4bdf8c12d4ec0a68a21b 100755 (executable)
@@ -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()
index e3699a461515f4f1ba12b111d72833e400493c7b..db4837617008e815ea2d7bc2c6f519a47b5e920d 100755 (executable)
@@ -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:
index 9b4526fedc60085e6ab16d9fc7c67c6097fd7abe..39b2486da32dd31bee410fc350cec2a7ff62275a 100755 (executable)
@@ -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()
index 151920c1fda001a37733c78f9a5214b1c2694671..f0e08654525c5debb9e2a86bc650f5c2c46de95c 100755 (executable)
@@ -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 = {}
 
index f4672d2b4b5e92843bdc2dc4a953aafcd27918ea..3801132db5b72298c32f2a6fdfbc51916002183b 100755 (executable)
@@ -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()
index 8d94b6b2c512a40b5760a279e04fc81b450677c8..0566130bb29168e4846ca4ed3bf8c89cedcb66c6 100755 (executable)
@@ -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()
index 6f366d859548e357da70716169c11d6e10080c52..89c2b755dc5942f56e8b28d42afa530a0ab73ea9 100755 (executable)
@@ -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()
index 7b182d6f199123908f02b5406ea9ae580ea14c3c..4e8068f609a8a00b29cfdce45462477c75ea648c 100755 (executable)
@@ -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
 
index 337edb61303991879de5bc6a9f7e9827bc49b9c0..0c2a7bd8442dde01d14f78d3f3939b78ba45273d 100755 (executable)
@@ -84,9 +84,9 @@ def main():
         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()
 
@@ -173,7 +173,7 @@ SELECT f.fingerprint, f.id, u.uid FROM fingerprint f, uid u WHERE f.uid = u.id
                 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)
index 5b132c82d7ee2a09f2283e9da1c5272cd2274467..7a29467a18be52a488ee2f2b00f272a83e2c0364 100755 (executable)
@@ -158,7 +158,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
 
index a9dacd349a99966f19af0d88faaccc1169abca50..ae99ef9094db7d8601202a79d47a2e09debd7471 100755 (executable)
@@ -63,8 +63,8 @@ def main ():
         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()
index fc5efd3206948cdca6ece9c2b03b7fe394633429..fdd7da9676fb92ac8e80ffd84597f5c1bf0fe7c5 100755 (executable)
@@ -63,7 +63,7 @@ def process_file(config, config_name):
 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]
@@ -121,7 +121,7 @@ def create_directories():
     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'):
@@ -179,9 +179,9 @@ def main ():
 
     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:
index 66e8d42751eba2714779610939a05f7a4704800d..79f417fd3cb53874d8845368414e21e3b48553a1 100755 (executable)
--- a/dak/ls.py
+++ b/dak/ls.py
@@ -80,8 +80,8 @@ def main ():
         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()
@@ -166,7 +166,7 @@ SELECT s.source, s.version, 'source', su.suite_name, c.name, m.name
             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] = []
@@ -176,7 +176,7 @@ SELECT s.source, s.version, 'source', su.suite_name, c.name, m.name
         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()
index ad6dbab1a80173857072918b0da7fd03fe6366a5..2fe77fe6af1987e59359c8ca142c40ed1f1a47d8 100755 (executable)
@@ -263,8 +263,8 @@ def main():
         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']
index 8e93f8af920e0a03d8810e29f6b490a535f35ec3..b7f729857d20b47baa66f69df544024a09ffe72b 100755 (executable)
@@ -71,8 +71,8 @@ def main():
     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()
index 1d8f9c02ca7fc7a6b3fcf6636f0d72e4cffa2b94..140ada9f8854a8f1e32857810c3ad8ace863e799 100755 (executable)
@@ -104,8 +104,8 @@ def main ():
     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()
 
index a292b4ae752afb73bd9e24f823588db1966c987e..b6342b1e420567eb2dd7f37b05254cda436d31f4 100755 (executable)
@@ -67,8 +67,8 @@ def main ():
                  ('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()
index 1fe32110752e65b385dcfad91c1f7d170b56d12b..b4c1d585fcbe4b056da6f0505d1d86f2fc92ddd5 100755 (executable)
@@ -86,8 +86,8 @@ def main():
                  ('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()
index fb2d5ccff58e40b90486301e29868722569011a0..026dcced053bff432a4038ece86c0ed13ee6101a 100755 (executable)
@@ -142,9 +142,9 @@ def main():
         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()
 
index de888e55380115358c842cd94ae0d0392df57b6f..ce5d12ff41348c1f4c929fd7f5374554eafd13e3 100755 (executable)
@@ -124,8 +124,8 @@ def main ():
     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()
@@ -295,7 +295,7 @@ def main ():
         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)
index 3ec6ff1f96d20832cf6a549e5fa3abb3efbb39f5..6cb392df7f3ff673c1f9d89d0e0a1001e8d341dd 100755 (executable)
@@ -73,8 +73,8 @@ def main():
     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()
index 1c2231a305709baf6ff7379fd55fbbe9868ce1d0..11950f14429e41a654167b110822de96fd70e6e7 100755 (executable)
@@ -368,10 +368,10 @@ def do_bxa_notification(upload):
     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)
@@ -400,7 +400,7 @@ def add_overrides (new, upload, session):
 
     session.commit()
 
-    if Config().FindB("Dinstall::BXANotify"):
+    if Config().find_b("Dinstall::BXANotify"):
         do_bxa_notification(upload)
 
 ################################################################################
@@ -774,14 +774,14 @@ def main():
         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()
index 3f237f626b506b5cb929c4fc4ede505530cc748f..e401a3bd630956f1c1397adc8b6d0fbda2297fb5 100755 (executable)
@@ -126,7 +126,7 @@ def main():
         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"
@@ -134,7 +134,7 @@ def main():
 
     queue_name = queue_name[0]
 
-    Options = cnf.SubTree("Process-Policy::Options")
+    Options = cnf.subtree("Process-Policy::Options")
 
     if Options["Help"]:
         usage()
index 4d9f3b00b768071363bd9ac74c72cefe19de7e74..53ab7cc98f7be1553e050449c181e238c97a3275 100755 (executable)
@@ -439,8 +439,8 @@ def main():
         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()
index 862a6d20ebb8a431ebc4bfc8288c721f852cde65..a3b59738df18c7c7d5b9e04d3719463b0582b15a 100755 (executable)
@@ -619,9 +619,9 @@ def main():
         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()
 
@@ -637,7 +637,7 @@ def main():
         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" ]
 
index 03d12f0f8108012b459d835b4dd0c63e0523b031..bbd4b45854adce9f3a56fae89e26cc107095815a 100755 (executable)
--- a/dak/rm.py
+++ b/dak/rm.py
@@ -289,8 +289,8 @@ def main ():
     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()
@@ -441,8 +441,8 @@ def main ():
                 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:])
@@ -490,7 +490,7 @@ def main ():
     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]))
@@ -623,9 +623,9 @@ def main ():
     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)
index f9f24d6f217e0dcca74e3d292ab59b6ecc7c5bc5..e7dded0f92393f846e88fad9f8aeebac4eabe84b 100755 (executable)
@@ -269,7 +269,7 @@ def init():
                  ("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)] = ""
@@ -278,7 +278,7 @@ def init():
             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()
 
index 5d45c8440c765da6dcbfdbb0b4c34801217d2bde..eac91d8a419201e970a132afab11ab3a680482c5 100755 (executable)
@@ -258,12 +258,12 @@ def init(session):
         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()
index bbd58881f0b66883bf71557510b09ec980179d29..f33873475029ff701fdd2509ee57275fbf28b6f6 100755 (executable)
@@ -198,9 +198,9 @@ def main ():
         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()
 
index a5eb6b6cd1e5338861b27cfb61e15a7644ca9d2d..7409f6f95a0b18154639cf25b62d952d1879cba7 100755 (executable)
@@ -76,9 +76,9 @@ def init():
         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()
@@ -415,7 +415,7 @@ def check_transitions(transitions):
             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
@@ -540,7 +540,7 @@ def transition_info(transitions):
             # 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
index 2a9468222439b839d150865bf571641fd906b8ce..36ba93aa5ca6e1cd3b69ab78433fd735dc9f5cfc 100755 (executable)
@@ -190,9 +190,9 @@ Updates dak's database schema to the lastest version. You should disable crontab
             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:
index 1214b03bffb06e9843dcdcc2cdf64b893ba35448..d6ccaa0095d01cad07780be8d57d1bdda57507d9 100644 (file)
@@ -34,10 +34,9 @@ import datetime
 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 *
 
@@ -127,7 +126,7 @@ class Changes(object):
 
                 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:
index 3a4c6dd77a292582592a51072df8688d07fcf589..d1dbad84a8149c1dc7cc3bf40fbc4e31062c3c07 100755 (executable)
@@ -45,7 +45,7 @@ def indiv_sg_compare (a, b):
     """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
 
index dc90d49a5edd435aeb6a54fa2968310a5bb18912..7e3c8bac582baf895a8a3b7f2b08d39d5619566c 100755 (executable)
@@ -65,24 +65,24 @@ class Config(object):
     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)
index c0295e17273cc02f3d1911ceeafdd9d35c6e4bc7..80a1f233ad29341a3e13972372811c466c25ff4c 100755 (executable)
@@ -75,6 +75,7 @@ from sqlalchemy.orm.exc import NoResultFound
 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
@@ -561,7 +562,7 @@ class DBBinary(ORMObject):
         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
index 2f347f478e60120bbfc450d11fbd7c148dd14c33..d0772276f20158f9ce3206d319ad3857222c5c8d 100755 (executable)
@@ -655,7 +655,7 @@ class Upload(object):
         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":
@@ -713,9 +713,9 @@ class Upload(object):
         # 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
@@ -724,28 +724,28 @@ class Upload(object):
 
         # 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)] \
@@ -758,13 +758,13 @@ class Upload(object):
             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))
@@ -775,8 +775,8 @@ class Upload(object):
 
         # 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):
@@ -798,19 +798,19 @@ class Upload(object):
 
 
         # 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"
@@ -819,7 +819,7 @@ class Upload(object):
         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"]
@@ -844,7 +844,7 @@ class Upload(object):
         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)
@@ -954,7 +954,7 @@ class Upload(object):
             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
@@ -1108,7 +1108,7 @@ class Upload(object):
             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.")
 
     ###########################################################################
@@ -1235,7 +1235,7 @@ class Upload(object):
             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()))
 
@@ -1322,7 +1322,7 @@ class Upload(object):
             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
@@ -1606,7 +1606,7 @@ class Upload(object):
             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"]
@@ -1880,7 +1880,7 @@ class Upload(object):
             # 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
@@ -2047,7 +2047,7 @@ distribution."""
 
                 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__"]
@@ -2211,7 +2211,7 @@ distribution."""
         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')
@@ -2264,7 +2264,7 @@ distribution."""
         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()
@@ -2540,7 +2540,7 @@ distribution."""
         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
@@ -2581,7 +2581,7 @@ distribution."""
                 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))
@@ -2615,12 +2615,12 @@ distribution."""
                             # 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", {})
index fac21f9981cc7b1b2d90c6093e2f1d6486b6cf22..8f05e7bf2ce6e8de7e1627e4db87bb972a7b0173 100755 (executable)
@@ -178,7 +178,7 @@ def is_autobyhand(u):
                 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"])
index 0b8a08d5700a67951d2d6c297d810b2373b0c3b1..83f556b27d0f2c8f5010b346f6c7eed0aedeacdb 100755 (executable)
@@ -762,7 +762,7 @@ def which_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):
@@ -778,7 +778,7 @@ def which_conf_file ():
 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):
@@ -874,7 +874,7 @@ def changes_compare (a, b):
     # 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
 
@@ -1547,12 +1547,12 @@ def get_changes_files(from_dir):
 
 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())
 
 ################################################################################