]> git.decadent.org.uk Git - dak.git/commitdiff
Move more objects into get_packages_from_ftp()
authorLuca Falavigna <dktrkranz@debian.org>
Sun, 12 Dec 2010 17:08:54 +0000 (17:08 +0000)
committerLuca Falavigna <dktrkranz@debian.org>
Mon, 10 Jan 2011 20:14:29 +0000 (20:14 +0000)
Signed-off-by: Luca Falavigna <dktrkranz@debian.org>
dak/override.py
dak/override_disparity.py
daklib/utils.py

index ddb829b621a2bdb5beb95db1b56bed38504d7b6a..75edbb580f88d11cef0e5022821b41c023c42a76 100755 (executable)
@@ -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
index 383766ef4ae61ad2fc12904da710b359138f41d6..fd3bc503e72124ccd055b607359bba12a8a77914 100755 (executable)
@@ -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'):
index dffad274c508c9c06dccc9143c5be4c6c0490fc0..b5e090da3eb24324f89307fedff7920928115d4c 100755 (executable)
@@ -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