From: Luca Falavigna Date: Sun, 12 Dec 2010 17:08:54 +0000 (+0000) Subject: Move more objects into get_packages_from_ftp() X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44c0790b82f4c0a3be95fff9f1475bebe4118650;p=dak Move more objects into get_packages_from_ftp() Signed-off-by: Luca Falavigna --- diff --git a/dak/override.py b/dak/override.py index ddb829b6..75edbb58 100755 --- a/dak/override.py +++ b/dak/override.py @@ -66,9 +66,7 @@ def check_override_compliance(package, priority, suite, cnf, session): arches -= set(["source", "all"]) for arch in arches: for component in components: - temp_filename = utils.get_packages_from_ftp(cnf['Dir::Root'], suite, component, arch) - packages = utils.open_file(temp_filename) - Packages = apt_pkg.ParseTagFile(packages) + Packages = utils.get_packages_from_ftp(cnf['Dir::Root'], suite, component, arch) while Packages.Step(): package_name = Packages.Section.Find("Package") dep_list = Packages.Section.Find("Depends") @@ -82,7 +80,6 @@ def check_override_compliance(package, priority, suite, cnf, session): for i in d: if i[0] == package: rdepends.add(package_name) - os.unlink(temp_filename) query = """SELECT o.package, p.level, p.priority FROM override o diff --git a/dak/override_disparity.py b/dak/override_disparity.py index 383766ef..fd3bc503 100755 --- a/dak/override_disparity.py +++ b/dak/override_disparity.py @@ -87,9 +87,7 @@ def main(): arches -= set(['source', 'all']) for arch in arches: for component in components: - temp_filename = utils.get_packages_from_ftp(cnf['Dir::Root'], suite, component, arch) - packages_file = utils.open_file(temp_filename) - Packages = apt_pkg.ParseTagFile(packages_file) + Packages = utils.get_packages_from_ftp(cnf['Dir::Root'], suite, component, arch) while Packages.Step(): package = Packages.Section.Find('Package') dep_list = Packages.Section.Find('Depends') @@ -101,7 +99,6 @@ def main(): if not depends.has_key(package): depends[package] = set() depends[package].add(i[0]) - os.unlink(temp_filename) priorities = {} query = """SELECT DISTINCT o.package, p.level, p.priority, m.name @@ -115,7 +112,6 @@ def main(): AND ba.suite = s.id AND p.level <> 0""" % suite packages = session.execute(query) - session.commit() out = {} if Options.has_key('file'): diff --git a/daklib/utils.py b/daklib/utils.py index dffad274..b5e090da 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -1576,10 +1576,24 @@ def parse_wnpp_bug_file(file = "/srv/ftp-master.debian.org/scripts/masterfiles/w def get_packages_from_ftp(root, suite, component, architecture): """ - Returns a filename containing data collected by aggregating Packages.gz files - gathered for each architecture. + Returns an object containing apt_pkg-parseable data collected by + aggregating Packages.gz files gathered for each architecture. + + @type root: string + @param root: path to ftp archive root directory + + @type suite: string + @param suite: suite to extract files from + + @type component: string + @param component: component to extract files from + + @type architecture: string + @param architecture: architecture to extract files from + + @rtype: TagFile + @return: apt_pkg class containing package data - Returned file has to be manually deleted afterwards. """ filename = "%s/dists/%s/%s/binary-%s/Packages.gz" % (root, suite, component, architecture) (fd, temp_file) = temp_filename() @@ -1591,4 +1605,7 @@ def get_packages_from_ftp(root, suite, component, architecture): (result, output) = commands.getstatusoutput("gunzip -c %s >> %s" % (filename, temp_file)) if (result != 0): fubar("Gunzip invocation failed!\n%s\n" % (output), result) - return temp_file + packages = open_file(temp_file) + Packages = apt_pkg.ParseTagFile(packages) + os.unlink(temp_file) + return Packages