- cursor.execute("EXECUTE contents_q(%d,%d,%d,%d)" % (suite_id, debtype_id, arch_all_id, arch_id[0] ))
- self._write_content_file(cursor, "dists/%s/Contents-%s.gz" % (suite, arch_id[1]))
+ file_writers[arch_id] = GzippedContentWriter(suite, arch_id[1])
+
+
+ print("EXECUTE contents_q(%d,%d,'%s')" % (suite_id, debtype_id, 'deb'))
+# cursor.execute("EXECUTE contents_q(%d,%d,'%s');" % (suite_id, debtype_id, 'deb'))
+ cursor.execute("""SELECT (p.path||'/'||n.file) AS fn,
+ s.section,
+ b.package,
+ b.architecture
+ from content_associations c join content_file_paths p ON (c.filepath=p.id)
+ JOIN content_file_names n ON (c.filename=n.id)
+ JOIN binaries b ON (b.id=c.binary_pkg)
+ JOIN override o ON (o.package=b.package)
+ JOIN section s ON (s.id=o.section)
+ WHERE o.suite = %d AND o.type = %d
+ and b.type='deb'
+ ORDER BY fn""" % (suite_id, debtype_id))
+
+ while True:
+ r = cursor.fetchone()
+ print( "got contents: %s" % r )
+ if not r:
+ print( "STU:END" );
+ break
+
+ print( "STU:NOT END" );
+ filename, section, package, arch = r
+
+ if arch == arch_all_id:
+ ## its arch all, so all contents files get it
+ for writer in file_writers.values():
+ writer.write(filename, section, package)
+
+ else:
+ file_writers[arch].write(filename, section, package)
+
+ # close all the files
+ for writer in file_writers.values():
+ writer.close()
+
+
+# self._write_content_file(cursor, "dists/%s/Contents-%s.gz" % (suite, arch_id[1]))