X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fgenerate_packages_sources2.py;h=ed12e9f14a0fa2eefc968e4597c4b71b62ba3960;hb=519c1dbf89c13557afc15a429164616ac563d379;hp=2c69afce73c60108914a454ba197bd0ff921287c;hpb=36f2e4eed512ab916efac0dc2ecb6dc0d503397b;p=dak.git diff --git a/dak/generate_packages_sources2.py b/dak/generate_packages_sources2.py index 2c69afce..ed12e9f1 100755 --- a/dak/generate_packages_sources2.py +++ b/dak/generate_packages_sources2.py @@ -94,9 +94,6 @@ LEFT JOIN override o ON o.package = s.source LEFT JOIN section sec ON o.section = sec.id LEFT JOIN priority pri ON o.priority = pri.id -WHERE - (src_associations_full.extra_source OR o.suite IS NOT NULL) - ORDER BY s.source, s.version """ @@ -115,7 +112,14 @@ def generate_sources(suite_id, component_id): overridesuite_id = suite.get_overridesuite().suite_id - writer = SourcesFileWriter(archive=suite.archive.path, suite=suite.suite_name, component=component.component_name) + writer_args = { + 'archive': suite.archive.path, + 'suite': suite.suite_name, + 'component': component.component_name + } + if suite.indices_compression is not None: + writer_args['compression'] = suite.indices_compression + writer = SourcesFileWriter(**writer_args) output = writer.open() # run query and write Sources @@ -148,7 +152,15 @@ WITH f.size AS size, f.md5sum AS md5sum, f.sha1sum AS sha1sum, - f.sha256sum AS sha256sum + f.sha256sum AS sha256sum, + (SELECT value FROM binaries_metadata + WHERE bin_id = b.id + AND key_id = (SELECT key_id FROM metadata_keys WHERE key = 'Priority')) + AS fallback_priority, + (SELECT value FROM binaries_metadata + WHERE bin_id = b.id + AND key_id = (SELECT key_id FROM metadata_keys WHERE key = 'Section')) + AS fallback_section FROM binaries b JOIN bin_associations ba ON b.id = ba.bin @@ -185,8 +197,8 @@ SELECT eo.package = tmp.package AND eo.suite = :overridesuite AND eo.component = :component ), '') - || E'\nSection\: ' || sec.section - || E'\nPriority\: ' || pri.priority + || E'\nSection\: ' || COALESCE(sec.section, tmp.fallback_section) + || E'\nPriority\: ' || COALESCE(pri.priority, tmp.fallback_priority) || E'\nFilename\: pool/' || :component_name || '/' || tmp.filename || E'\nSize\: ' || tmp.size || E'\nMD5sum\: ' || tmp.md5sum @@ -195,9 +207,12 @@ SELECT FROM tmp - JOIN override o ON o.package = tmp.package - JOIN section sec ON sec.id = o.section - JOIN priority pri ON pri.id = o.priority + LEFT JOIN override o ON o.package = tmp.package + AND o.type = :type_id + AND o.suite = :overridesuite + AND o.component = :component + LEFT JOIN section sec ON sec.id = o.section + LEFT JOIN priority pri ON pri.id = o.priority WHERE ( @@ -207,8 +222,6 @@ WHERE OR (architecture = :arch_all AND source NOT IN (SELECT DISTINCT source FROM tmp WHERE architecture <> :arch_all)) ) - AND - o.type = :type_id AND o.suite = :overridesuite AND o.component = :component ORDER BY tmp.source, tmp.package, tmp.version """ @@ -238,9 +251,16 @@ def generate_packages(suite_id, component_id, architecture_id, type_name): if include_long_description: metadata_skip.append("Description-md5") - writer = PackagesFileWriter(archive=suite.archive.path, suite=suite.suite_name, - component=component.component_name, - architecture=architecture.arch_string, debtype=type_name) + writer_args = { + 'archive': suite.archive.path, + 'suite': suite.suite_name, + 'component': component.component_name, + 'architecture': architecture.arch_string, + 'debtype': type_name + } + if suite.indices_compression is not None: + writer_args['compression'] = suite.indices_compression + writer = PackagesFileWriter(**writer_args) output = writer.open() r = session.execute(_packages_query, {"archive_id": suite.archive.archive_id, @@ -301,7 +321,15 @@ def generate_translations(suite_id, component_id): suite = session.query(Suite).get(suite_id) component = session.query(Component).get(component_id) - writer = TranslationFileWriter(archive=suite.archive.path, suite=suite.suite_name, component=component.component_name, language="en") + writer_args = { + 'archive': suite.archive.path, + 'suite': suite.suite_name, + 'component': component.component_name, + 'language': 'en', + } + if suite.i18n_compression is not None: + writer_args['compression'] = suite.i18n_compression + writer = TranslationFileWriter(**writer_args) output = writer.open() r = session.execute(_translations_query, {"suite": suite_id, "component": component_id}) @@ -375,11 +403,15 @@ def main(): else: logger.log(['E: ', msg]) + # Lock tables so that nobody can change things underneath us + session.execute("LOCK TABLE src_associations IN SHARE MODE") + session.execute("LOCK TABLE bin_associations IN SHARE MODE") + for s in suites: component_ids = [ c.component_id for c in s.components ] if s.untouchable and not force: - import utils - utils.fubar("Refusing to touch %s (untouchable and not forced)" % s.suite_name) + import daklib.utils + daklib.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=parse_results) if not s.include_long_description: