]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/utils.py
Contents generation should be working now
[dak.git] / daklib / utils.py
index 5e3627969f9b1f69cd8a216afe3b4dd49a5495c3..5cb502d6d3b51a15fc08fba8843ce9530637bda6 100755 (executable)
@@ -37,6 +37,7 @@ import stat
 import apt_pkg
 import database
 import time
+import tarfile
 from dak_exceptions import *
 from regexes import re_html_escaping, html_escaping, re_single_line_field, \
                     re_multi_line_field, re_srchasver, re_verwithext, \
@@ -1442,7 +1443,7 @@ def generate_contents_information(filename):
     Generate a list of flies contained in a .deb
 
     @type filename: string
-    @param filename: the path to a .deb
+    @param filename: the path to a data.tar.gz or data.tar.bz2
 
     @rtype: list
     @return: a list of files in the data.tar.* portion of the .deb
@@ -1468,7 +1469,7 @@ def generate_contents_information(filename):
         # and pieces the deb had ...
         if chunks[2] == "data.tar.gz":
             data = tarfile.open("data.tar.gz", "r:gz")
-        elif data_tar == "data.tar.bz2":
+        elif chunks[2] == "data.tar.bz2":
             data = tarfile.open("data.tar.bz2", "r:bz2")
         else:
             os.remove(chunks[2])
@@ -1480,6 +1481,7 @@ def generate_contents_information(filename):
 
     finally:
         if os.path.exists( chunks[2] ):
+            shutil.rmtree( chunks[2] )
             os.remove( chunks[2] )
 
     return contents