]> err.no Git - dak/commitdiff
Stop using deprecated functions from python-apt
authorAnsgar Burchardt <ansgar@debian.org>
Mon, 20 May 2013 10:19:57 +0000 (12:19 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Mon, 20 May 2013 10:19:57 +0000 (12:19 +0200)
A few deprecated functions from python-apt were still used:

  ParseDepends      -> parse_depends
  ParseSrcDepends   -> parse_src_depends
  ParseTagFile      -> TagFile
  ReadConfigFileISC -> read_config_file_isc

dak/check_archive.py
dak/cruft_report.py
dak/override.py
dak/override_disparity.py
daklib/utils.py

index 68e926bff3f320e51412c9653ef902615358b6f6..d0c71d478c2d3a941670749086e8c6e66bafaf4f 100755 (executable)
@@ -383,14 +383,14 @@ def validate_sources(suite, component):
     """
     filename = "%s/dists/%s/%s/source/Sources.gz" % (Cnf["Dir::Root"], suite, component)
     print "Processing %s..." % (filename)
-    # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
+    # apt_pkg.TagFile needs a real file handle and can't handle a GzipFile instance...
     (fd, temp_filename) = utils.temp_filename()
     (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
     if (result != 0):
         sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output))
         sys.exit(result)
     sources = utils.open_file(temp_filename)
-    Sources = apt_pkg.ParseTagFile(sources)
+    Sources = apt_pkg.TagFile(sources)
     while Sources.Step():
         source = Sources.Section.Find('Package')
         directory = Sources.Section.Find('Directory')
@@ -425,14 +425,14 @@ def validate_packages(suite, component, architecture):
     filename = "%s/dists/%s/%s/binary-%s/Packages.gz" \
                % (Cnf["Dir::Root"], suite, component, architecture)
     print "Processing %s..." % (filename)
-    # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
+    # apt_pkg.TagFile needs a real file handle and can't handle a GzipFile instance...
     (fd, temp_filename) = utils.temp_filename()
     (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
     if (result != 0):
         sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output))
         sys.exit(result)
     packages = utils.open_file(temp_filename)
-    Packages = apt_pkg.ParseTagFile(packages)
+    Packages = apt_pkg.TagFile(packages)
     while Packages.Step():
         filename = "%s/%s" % (Cnf["Dir::Root"], Packages.Section.Find('Filename'))
         if not os.path.exists(filename):
@@ -487,7 +487,7 @@ def chk_bd_process_dir (unused, dirname, filenames):
             field = dsc.get(field_name)
             if field:
                 try:
-                    apt_pkg.ParseSrcDepends(field)
+                    apt_pkg.parse_src_depends(field)
                 except:
                     print "E: [%s] %s: %s" % (filename, field_name, field)
                     pass
index 6d7db38512fe7b2a061a83384ff89fe3d3d9445a..812a39b2db9194f2a8522a864a6f75c70ed5f536 100755 (executable)
@@ -681,14 +681,14 @@ def main ():
     components = get_component_names(session)
     for component in components:
         filename = "%s/dists/%s/%s/source/Sources.gz" % (suite.archive.path, suite_name, component)
-        # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
+        # apt_pkg.TagFile needs a real file handle and can't handle a GzipFile instance...
         (fd, temp_filename) = utils.temp_filename()
         (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
         if (result != 0):
             sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output))
             sys.exit(result)
         sources = utils.open_file(temp_filename)
-        Sources = apt_pkg.ParseTagFile(sources)
+        Sources = apt_pkg.TagFile(sources)
         while Sources.Step():
             source = Sources.Section.Find('Package')
             source_version = Sources.Section.Find('Version')
@@ -730,7 +730,7 @@ def main ():
             if component == 'main/debian-installer' and re.match("kfreebsd", architecture):
                 continue
             filename = "%s/dists/%s/%s/binary-%s/Packages.gz" % (suite.archive.path, suite_name, component, architecture)
-            # apt_pkg.ParseTagFile needs a real file handle
+            # apt_pkg.TagFile needs a real file handle
             (fd, temp_filename) = utils.temp_filename()
             (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
             if (result != 0):
@@ -742,7 +742,7 @@ def main ():
                 nfu_entries = parse_nfu(architecture)
 
             packages = utils.open_file(temp_filename)
-            Packages = apt_pkg.ParseTagFile(packages)
+            Packages = apt_pkg.TagFile(packages)
             while Packages.Step():
                 package = Packages.Section.Find('Package')
                 source = Packages.Section.Find('Source', "")
index 44fc16f412492ee86f05efdbf8e7806b6e2de2fb..d27cf702ebf77b2235ad2a0afa5b133a60f3cac7 100755 (executable)
@@ -72,11 +72,11 @@ def check_override_compliance(package, priority, archive_path, suite_name, cnf,
                 dep_list = Packages.Section.Find("Depends")
                 if dep_list:
                     if package_name == package:
-                        for d in apt_pkg.ParseDepends(dep_list):
+                        for d in apt_pkg.parse_depends(dep_list):
                             for i in d:
                                 depends.add(i[0])
                     else:
-                        for d in apt_pkg.ParseDepends(dep_list):
+                        for d in apt_pkg.parse_depends(dep_list):
                             for i in d:
                                 if i[0] == package:
                                     rdepends.add(package_name)
index 6b0f9da497e517fde6103b9ec89658c2b6edf4f1..d93a8f2bbe5f0f8ac483a41d4fb021d04a7d0fdb 100755 (executable)
@@ -97,7 +97,7 @@ def main():
                 if Options['package'] and package != Options['package']:
                     continue
                 if dep_list:
-                    for d in apt_pkg.ParseDepends(dep_list):
+                    for d in apt_pkg.parse_depends(dep_list):
                         for i in d:
                             if not depends.has_key(package):
                                 depends[package] = set()
index 8a8c69b8425960a8e8ab0da685645de1fd7decbf..899c16f4677e8b2d29a4523d5bed68496e4e2199 100755 (executable)
@@ -779,7 +779,7 @@ def which_conf_file ():
         homedir = os.getenv("HOME")
         confpath = os.path.join(homedir, "/etc/dak.conf")
         if os.path.exists(confpath):
-            apt_pkg.ReadConfigFileISC(Cnf,confpath)
+            apt_pkg.read_config_file_isc(Cnf,confpath)
 
     # We are still in here, so there is no local config file or we do
     # not allow local files. Do the normal stuff.
@@ -1607,7 +1607,7 @@ def get_packages_from_ftp(root, suite, component, architecture):
         if (result != 0):
             fubar("Gunzip invocation failed!\n%s\n" % (output), result)
     packages = open_file(temp_file)
-    Packages = apt_pkg.ParseTagFile(packages)
+    Packages = apt_pkg.TagFile(packages)
     os.unlink(temp_file)
     return Packages
 
@@ -1741,7 +1741,7 @@ def check_reverse_depends(removals, suite, arches=None, session=None, cruft=Fals
             if package in removals: continue
             parsed_dep = []
             try:
-                parsed_dep += apt_pkg.ParseDepends(deps[package])
+                parsed_dep += apt_pkg.parse_depends(deps[package])
             except ValueError as e:
                 print "Error for package %s: %s" % (package, e)
             for dep in parsed_dep:
@@ -1810,7 +1810,7 @@ def check_reverse_depends(removals, suite, arches=None, session=None, cruft=Fals
             # Remove [arch] information since we want to see breakage on all arches
             build_dep = re_build_dep_arch.sub("", build_dep)
             try:
-                parsed_dep += apt_pkg.ParseDepends(build_dep)
+                parsed_dep += apt_pkg.parse_depends(build_dep)
             except ValueError as e:
                 print "Error for source %s: %s" % (source, e)
         for dep in parsed_dep: