]> git.decadent.org.uk Git - dak.git/blobdiff - dak/contents.py
better cleanup of temporary files, consolidate some repeated code
[dak.git] / dak / contents.py
index f423b197cd21523358c5691c881e46cbe0aaa94b..eb9e5c38ca429d6b79db655592f0b8ff6f3e2eaa 100644 (file)
@@ -308,18 +308,13 @@ class Contents(object):
 
             # 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)
 
 
 ################################################################################