]> err.no Git - dak/commitdiff
Revert "Use gzip.open(.., 'rb')" as this version of python-apt is olde
authorChris Lamb <lamby@debian.org>
Mon, 26 Oct 2009 14:54:42 +0000 (14:54 +0000)
committerChris Lamb <lamby@debian.org>
Mon, 26 Oct 2009 14:54:42 +0000 (14:54 +0000)
This reverts commit 91cd6acebec69854074c594bf917561001f57ef4.

Signed-off-by: Chris Lamb <lamby@debian.org>
dak/rm.py

index 8dff809ef30c5289368e22870ec831212803bae1..8ed03412293f1d946976daa06b855bc394a7f7c4 100755 (executable)
--- a/dak/rm.py
+++ b/dak/rm.py
@@ -43,7 +43,6 @@ import commands
 import os
 import re
 import sys
-import gzip
 import apt_pkg
 import apt_inst
 
@@ -116,7 +115,11 @@ def reverse_depends_check(removals, suites, arches=None):
         for component in components:
             filename = "%s/dists/%s/%s/binary-%s/Packages.gz" % (cnf["Dir::Root"], suites[0], component, architecture)
             # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
-            packages = gzip.open(filename, 'rb')
+            (fd, temp_filename) = utils.temp_filename()
+            (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
+            if (result != 0):
+                utils.fubar("Gunzip invocation failed!\n%s\n" % (output), result)
+            packages = utils.open_file(temp_filename)
             Packages = apt_pkg.ParseTagFile(packages)
             while Packages.Step():
                 package = Packages.Section.Find("Package")
@@ -146,6 +149,7 @@ def reverse_depends_check(removals, suites, arches=None):
                             virtual_packages[virtual_pkg] += 1
                 p2c[package] = component
             packages.close()
+            os.unlink(temp_filename)
 
         # If a virtual package is only provided by the to-be-removed
         # packages, treat the virtual package as to-be-removed too.
@@ -196,7 +200,12 @@ def reverse_depends_check(removals, suites, arches=None):
     for component in components:
         filename = "%s/dists/%s/%s/source/Sources.gz" % (cnf["Dir::Root"], suites[0], component)
         # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
-        sources = gzip.open(filename, 'rb')
+        (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, "r")
         Sources = apt_pkg.ParseTagFile(sources)
         while Sources.Step():
             source = Sources.Section.Find("Package")