print """Usage: dak generate-packages-sources2 [OPTIONS]
Generate the Packages/Sources files
+ -a, --archive=ARCHIVE process suites in ARCHIVE
-s, --suite=SUITE process this suite
Default: All suites not marked 'untouchable'
-f, --force Allow processing of untouchable suites
CAREFUL: Only to be used at point release time!
- -5, --description-md5 Allow to use Description-md5 instead of
- Description for Packages index and generate
- Translation-en
- NOTE: suite.include_long_descriptions needs to
- be set to false for this.
-h, --help show this help and exit
SUITE can be a space seperated list, e.g.
(SELECT
STRING_AGG(
CASE
- WHEN key = 'Source' THEN 'Package\: '
+ WHEN key = 'Source' THEN E'Package\: '
WHEN key = 'Files' THEN E'Files\:\n ' || f.md5sum || ' ' || f.size || ' ' || SUBSTRING(f.filename FROM E'/([^/]*)\\Z')
WHEN key = 'Checksums-Sha1' THEN E'Checksums-Sha1\:\n ' || f.sha1sum || ' ' || f.size || ' ' || SUBSTRING(f.filename FROM E'/([^/]*)\\Z')
WHEN key = 'Checksums-Sha256' THEN E'Checksums-Sha256\:\n ' || f.sha256sum || ' ' || f.size || ' ' || SUBSTRING(f.filename FROM E'/([^/]*)\\Z')
- ELSE key || '\: '
+ ELSE key || E'\: '
END || value, E'\n' ORDER BY mk.ordering, mk.key)
FROM
source_metadata sm
WHERE s.id=sm.src_id
)
||
- E'\nDirectory\: pool/' || SUBSTRING(f.filename FROM E'\\A(.*)/[^/]*\\Z')
+ E'\nDirectory\: pool/' || :component_name || '/' || SUBSTRING(f.filename FROM E'\\A(.*)/[^/]*\\Z')
||
E'\nPriority\: ' || pri.priority
||
source s
JOIN src_associations sa ON s.id = sa.source
JOIN files f ON s.file=f.id
+JOIN files_archive_map fam
+ ON fam.file_id = f.id
+ AND fam.archive_id = (SELECT archive_id FROM suite WHERE id = :suite)
+ AND fam.component_id = :component
JOIN override o ON o.package = s.source
JOIN section sec ON o.section = sec.id
JOIN priority pri ON o.priority = pri.id
overridesuite_id = suite.get_overridesuite().suite_id
- writer = SourcesFileWriter(suite=suite.suite_name, component=component.component_name)
+ writer = SourcesFileWriter(archive=suite.archive.path, 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, "overridesuite": overridesuite_id})
+ r = session.execute(_sources_query, {"suite": suite_id, "component": component_id, "component_name": component.component_name, "dsc_type": dsc_type, "overridesuite": overridesuite_id})
for (stanza,) in r:
print >>output, stanza
print >>output, ""
binaries b
JOIN bin_associations ba ON b.id = ba.bin
JOIN files f ON f.id = b.file
- JOIN location l ON l.id = f.location
+ JOIN files_archive_map fam ON f.id = fam.file_id AND fam.archive_id = :archive_id
JOIN source s ON b.source = s.id
WHERE
(b.architecture = :arch_all OR b.architecture = :arch) AND b.type = :type_name
AND ba.suite = :suite
- AND l.component = :component
+ AND fam.component_id = :component
)
SELECT
(SELECT
- STRING_AGG(key || '\: ' || value, E'\n' ORDER BY ordering, key)
+ STRING_AGG(key || E'\: ' || value, E'\n' ORDER BY ordering, key)
FROM
(SELECT key, ordering,
CASE WHEN :include_long_description = 'false' AND key = 'Description'
) AS metadata
)
|| COALESCE(E'\n' || (SELECT
- STRING_AGG(key || '\: ' || value, E'\n' ORDER BY key)
+ STRING_AGG(key || E'\: ' || 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
+ || E'\nFilename\: pool/' || :component_name || '/' || tmp.filename
|| E'\nSize\: ' || tmp.size
|| E'\nMD5sum\: ' || tmp.md5sum
|| E'\nSHA1\: ' || tmp.sha1sum
ORDER BY tmp.source, tmp.package, tmp.version
"""
-def generate_packages(suite_id, component_id, architecture_id, type_name, use_description_md5):
+def generate_packages(suite_id, component_id, architecture_id, type_name):
global _packages_query
from daklib.filewriter import PackagesFileWriter
from daklib.dbconn import Architecture, Component, DBConn, OverrideType, Suite
architecture = session.query(Architecture).get(architecture_id)
overridesuite_id = suite.get_overridesuite().suite_id
- include_long_description = suite.include_long_description or not use_description_md5
+ include_long_description = suite.include_long_description
# We currently filter out the "Tag" line. They are set by external
# overrides and NOT by the maintainer. And actually having it set by
if include_long_description:
metadata_skip.append("Description-md5")
- writer = PackagesFileWriter(suite=suite.suite_name, component=component.component_name,
+ writer = PackagesFileWriter(archive=suite.archive.path, 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,
+ r = session.execute(_packages_query, {"archive_id": suite.archive.archive_id,
+ "suite": suite_id, "component": component_id, 'component_name': component.component_name,
"arch": architecture_id, "type_id": type_id, "type_name": type_name, "arch_all": arch_all_id,
"overridesuite": overridesuite_id, "metadata_skip": metadata_skip,
"include_long_description": 'true' if include_long_description else 'false'})
FROM suite AS s LEFT JOIN suite AS os ON s.overridesuite = os.suite_name)
SELECT
- 'Package\: ' || b.package
+ E'Package\: ' || b.package
|| E'\nDescription-md5\: ' || bm_description_md5.value
|| E'\nDescription-en\: ' || bm_description.value
|| E'\n'
JOIN source s ON b.source = s.id
WHERE ba.suite = :suite AND o.component = :component
-GROUP BY s.source, b.package, bm_description_md5.value, bm_description.value
-ORDER BY s.source, b.package, bm_description_md5.value
+GROUP BY b.package, bm_description_md5.value, bm_description.value
+ORDER BY MIN(s.source), b.package, bm_description_md5.value
"""
def generate_translations(suite_id, component_id):
suite = session.query(Suite).get(suite_id)
component = session.query(Component).get(component_id)
- writer = TranslationFileWriter(suite=suite.suite_name, component=component.component_name, language="en")
+ writer = TranslationFileWriter(archive=suite.archive.path, suite=suite.suite_name, component=component.component_name, language="en")
output = writer.open()
r = session.execute(_translations_query, {"suite": suite_id, "component": component_id})
cnf = Config()
Arguments = [('h',"help","Generate-Packages-Sources::Options::Help"),
- ('5','description-md5',"Generate-Packages-Sources::Options::Description-md5"),
+ ('a','archive','Generate-Packages-Sources::Options::Archive','HasArg'),
('s',"suite","Generate-Packages-Sources::Options::Suite"),
('f',"force","Generate-Packages-Sources::Options::Force"),
('o','option','','ArbItem')]
- suite_names = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
+ suite_names = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
try:
- Options = cnf.SubTree("Generate-Packages-Sources::Options")
+ Options = cnf.subtree("Generate-Packages-Sources::Options")
except KeyError:
Options = {}
logger = daklog.Logger('generate-packages-sources2')
- from daklib.dbconn import Component, DBConn, get_suite, Suite
+ from daklib.dbconn import Component, DBConn, get_suite, Suite, Archive
session = DBConn().session()
session.execute("SELECT add_missing_description_md5()")
session.commit()
print "I: Cannot find suite %s" % s
logger.log(['Cannot find suite %s' % s])
else:
- suites = session.query(Suite).filter(Suite.untouchable == False).all()
+ query = session.query(Suite).filter(Suite.untouchable == False)
+ if 'Archive' in Options:
+ query = query.join(Suite.archive).filter(Archive.archive_name==Options['Archive'])
+ suites = query.all()
- use_description_md5 = Options.has_key("Description-md5") and Options["Description-md5"]
force = Options.has_key("Force") and Options["Force"]
component_ids = [ c.component_id for c in session.query(Component).all() ]
for s in suites:
if s.untouchable and not force:
+ import utils
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 use_description_md5 and not s.include_long_description:
+ if not s.include_long_description:
pool.apply_async(generate_translations, [s.suite_id, c], callback=parse_results)
for a in s.architectures:
if a == 'source':
continue
- pool.apply_async(generate_packages, [s.suite_id, c, a.arch_id, 'deb', use_description_md5], callback=parse_results)
- pool.apply_async(generate_packages, [s.suite_id, c, a.arch_id, 'udeb', use_description_md5], callback=parse_results)
+ pool.apply_async(generate_packages, [s.suite_id, c, a.arch_id, 'deb'], callback=parse_results)
+ pool.apply_async(generate_packages, [s.suite_id, c, a.arch_id, 'udeb'], callback=parse_results)
pool.close()
pool.join()