X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fgenerate_packages_sources2.py;h=eea799f5b38c7e20f062d1a82ce913527b5b42a2;hb=3be5bc9fca7a4721d0f60563bf2545541c685adb;hp=ea3c0e53b21866ab40dcff27f75171121d6fb341;hpb=b4787f88ef10799017b6fbebd94119b127b5d683;p=dak.git diff --git a/dak/generate_packages_sources2.py b/dak/generate_packages_sources2.py index ea3c0e53..eea799f5 100755 --- a/dak/generate_packages_sources2.py +++ b/dak/generate_packages_sources2.py @@ -89,7 +89,7 @@ JOIN priority pri ON o.priority = pri.id WHERE sa.suite = :suite - AND o.suite = :suite AND o.component = :component AND o.type = :dsc_type + AND o.suite = :overridesuite AND o.component = :component AND o.type = :dsc_type ORDER BY s.source, s.version @@ -104,11 +104,13 @@ def generate_sources(suite_id, component_id): suite = session.query(Suite).get(suite_id) component = session.query(Component).get(component_id) + overridesuite_id = suite.get_overridesuite().suite_id + writer = SourcesFileWriter(suite=suite.suite_name, component=component.component_name) output = writer.open() # run query and write Sources - r = session.execute(_sources_query, {"suite": suite_id, "component": component_id, "dsc_type": dsc_type}) + r = session.execute(_sources_query, {"suite": suite_id, "component": component_id, "dsc_type": dsc_type, "overridesuite": overridesuite_id}) for (stanza,) in r: print >>output, stanza print >>output, "" @@ -160,6 +162,11 @@ SELECT bm.bin_id = tmp.binary_id AND key != 'Section' AND key != 'Priority' ) + || COALESCE(E'\n' || (SELECT + STRING_AGG(key || '\: ' || value, E'\n' ORDER BY key) + FROM external_overrides eo + WHERE eo.package = tmp.package + ), '') || E'\nSection\: ' || sec.section || E'\nPriority\: ' || pri.priority || E'\nFilename\: pool/' || tmp.filename @@ -183,7 +190,7 @@ WHERE (architecture = :arch_all AND source NOT IN (SELECT DISTINCT source FROM tmp WHERE architecture <> :arch_all)) ) AND - o.type = :type_id AND o.suite = :suite AND o.component = :component + o.type = :type_id AND o.suite = :overridesuite AND o.component = :component ORDER BY tmp.package, tmp.version """ @@ -199,12 +206,15 @@ def generate_packages(suite_id, component_id, architecture_id, type_name): component = session.query(Component).get(component_id) architecture = session.query(Architecture).get(architecture_id) + overridesuite_id = suite.get_overridesuite().suite_id + writer = PackagesFileWriter(suite=suite.suite_name, component=component.component_name, architecture=architecture.arch_string, debtype=type_name) output = writer.open() r = session.execute(_packages_query, {"suite": suite_id, "component": component_id, - "arch": architecture_id, "type_id": type_id, "type_name": type_name, "arch_all": arch_all_id}) + "arch": architecture_id, "type_id": type_id, "type_name": type_name, "arch_all": arch_all_id, + "overridesuite": overridesuite_id}) for (stanza,) in r: print >>output, stanza print >>output, "" @@ -256,20 +266,25 @@ def main(): def log(details): logger.log(details) - pool = Pool() + #pool = Pool() for s in suites: if s.untouchable and not force: utils.fubar("Refusing to touch %s (untouchable and not forced)" % s.suite_name) for c in component_ids: - pool.apply_async(generate_sources, [s.suite_id, c], callback=log) + logger.log(generate_sources(s.suite_id, c)) + #pool.apply_async(generate_sources, [s.suite_id, c], callback=log) for a in s.architectures: - pool.apply_async(generate_packages, [s.suite_id, c, a.arch_id, 'deb'], callback=log) - pool.apply_async(generate_packages, [s.suite_id, c, a.arch_id, 'udeb'], callback=log) + logger.log(generate_packages(s.suite_id, c, a.arch_id, 'deb')) + #pool.apply_async(generate_packages, [s.suite_id, c, a.arch_id, 'deb'], callback=log) + logger.log(generate_packages(s.suite_id, c, a.arch_id, 'udeb')) + #pool.apply_async(generate_packages, [s.suite_id, c, a.arch_id, 'udeb'], callback=log) - pool.close() - pool.join() + #pool.close() + #pool.join() # this script doesn't change the database session.close() + logger.close() + if __name__ == '__main__': main()