# The MORE fun part. Ok, udebs need their own contents files, udeb, and udeb-nf (not-free)
# This is HORRIBLY debian specific :-/
- # First off, udeb
- section_id = DBConn().get_section_id('debian-installer') # all udebs should be here)
- if section_id != -1:
- cursor.execute("EXECUTE udeb_contents_q(%d,%d,%d)" % (section_id, suite_id, suite_id))
- self._write_content_file(cursor, "dists/%s/Contents-udeb.gz" % suite)
-
- # Once more, with non-free
- section_id = DBConn().get_section_id('non-free/debian-installer') # all udebs should be here)
+ for section_id, fn_pattern in [("debian-installer","dists/%s/Contents-udeb.gz"),
+ ("non-free/debian-installer", "dists/%s/Contents-udeb-nf.gz")]
+ section_id = DBConn().get_section_id(section_id) # all udebs should be here)
if section_id != -1:
cursor.execute("EXECUTE udeb_contents_q(%d,%d,%d)" % (section_id, suite_id, suite_id))
- self._write_content_file(cursor, "dists/%s/Contents-udeb-nf.gz" % suite)
+ self._write_content_file(cursor, fn_pattern % suite)
################################################################################
c.execute( "CREATE INDEX content_assocaitions_binary ON content_associations(binary_pkg)" )
- c.execute("UPDATE config SET value = '2' WHERE name = 'db_revision'")
+ c.execute("UPDATE config SET value = '6' WHERE name = 'db_revision'")
self.db.commit()
print "REMINDER: Remember to fully regenerate the Contents files before running import-contents"
import tempfile
import traceback
import tarfile
-import apt_inst, apt_pkg
+import apt_inst
+import apt_pkg
from debian_bundle import deb822
from daklib.dbconn import DBConn
from daklib.binary import Binary
import tarfile
import commands
import traceback
+import atexit
from debian_bundle import deb822
from dbconn import DBConn
self.chunks = None
def __del__(self):
- # we need to remove the temporary directory, if we created one
+ """
+ make sure we cleanup when we are garbage collected.
+ """
+ self.cleanup()
+
+ def _cleanup(self):
+ """
+ we need to remove the temporary directory, if we created one
+ """
if self.tmpdir and os.path.exists(self.tmpdir):
+ self.tmpdir = None
shutil.rmtree(self.tmpdir)
def __scan_ar(self):
reject(utils.prefix_multi_line_string(output, " [ar output:] "), "")
else:
self.tmpdir = tmpdir
+ atexit.register( self.cleanup )
finally:
os.chdir( cwd )
os.chdir(self.tmpdir)
if self.chunks[1] == "control.tar.gz":
control = tarfile.open(os.path.join(self.tmpdir, "control.tar.gz" ), "r:gz")
- elif self.chunks[1] == "control.tar.bz2":
- control = tarfile.open(os.path.join(self.tmpdir, "control.tar.bz2" ), "r:bz2")
pkg = deb822.Packages.iter_paragraphs( control.extractfile('./control') ).next()
"""
Generate a list of flies contained in a .deb
- @type filename: string
- @param filename: the path to a data.tar.gz or data.tar.bz2
+ @ptype filename: string
+ @param filename: the path to a .deb
@rtype: list
@return: a list of files in the data.tar.* portion of the .deb