From: Ansgar Burchardt Date: Mon, 20 May 2013 10:19:57 +0000 (+0200) Subject: Stop using deprecated functions from python-apt X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=b1aa56396abf360a72459602056d68c503396f8d;p=dak.git Stop using deprecated functions from python-apt A few deprecated functions from python-apt were still used: ParseDepends -> parse_depends ParseSrcDepends -> parse_src_depends ParseTagFile -> TagFile ReadConfigFileISC -> read_config_file_isc --- diff --git a/dak/check_archive.py b/dak/check_archive.py index 68e926bf..d0c71d47 100755 --- a/dak/check_archive.py +++ b/dak/check_archive.py @@ -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 diff --git a/dak/cruft_report.py b/dak/cruft_report.py index 6d7db385..812a39b2 100755 --- a/dak/cruft_report.py +++ b/dak/cruft_report.py @@ -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', "") diff --git a/dak/override.py b/dak/override.py index 44fc16f4..d27cf702 100755 --- a/dak/override.py +++ b/dak/override.py @@ -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) diff --git a/dak/override_disparity.py b/dak/override_disparity.py index 6b0f9da4..d93a8f2b 100755 --- a/dak/override_disparity.py +++ b/dak/override_disparity.py @@ -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() diff --git a/daklib/utils.py b/daklib/utils.py index 8a8c69b8..899c16f4 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -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: