From: Ansgar Burchardt Date: Sun, 12 Aug 2012 09:06:40 +0000 (+0200) Subject: dak/contents.py, daklib/contents.py: add archive option X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cb93d121639db839caead146d0d68dd390b3624;p=dak dak/contents.py, daklib/contents.py: add archive option --- diff --git a/dak/contents.py b/dak/contents.py index f36e96dc..407b3c06 100755 --- a/dak/contents.py +++ b/dak/contents.py @@ -67,6 +67,9 @@ OPTIONS show this help and exit OPTIONS for generate + -a, --archive=ARCHIVE + only operate on suites in the specified archive + -s, --suite={stable,testing,unstable,...} only operate on specified suite names @@ -84,9 +87,9 @@ OPTIONS for scan-source and scan-binary ################################################################################ -def write_all(cnf, suite_names = [], component_names = [], force = None): +def write_all(cnf, archive_names = [], suite_names = [], component_names = [], force = None): Logger = daklog.Logger('contents generate') - ContentsWriter.write_all(Logger, suite_names, component_names, force) + ContentsWriter.write_all(Logger, archive_names, suite_names, component_names, force) Logger.close() ################################################################################ @@ -119,6 +122,7 @@ def main(): cnf['Contents::Options::Limit'] = '' cnf['Contents::Options::Force'] = '' arguments = [('h', "help", 'Contents::Options::Help'), + ('a', 'archive', 'Contents::Options::Archive', 'HasArg'), ('s', "suite", 'Contents::Options::Suite', "HasArg"), ('c', "component", 'Contents::Options::Component', "HasArg"), ('l', "limit", 'Contents::Options::Limit', "HasArg"), @@ -142,13 +146,14 @@ def main(): binary_scan_all(cnf, limit) return + archive_names = utils.split_args(options['Archive']) suite_names = utils.split_args(options['Suite']) component_names = utils.split_args(options['Component']) force = bool(options['Force']) if args[0] == 'generate': - write_all(cnf, suite_names, component_names, force) + write_all(cnf, archive_names, suite_names, component_names, force) return usage() diff --git a/daklib/contents.py b/daklib/contents.py index 2fb7dfcd..aedeb83d 100644 --- a/daklib/contents.py +++ b/daklib/contents.py @@ -284,7 +284,7 @@ class ContentsWriter(object): class_.logger.log(result) @classmethod - def write_all(class_, logger, suite_names = [], component_names = [], force = False): + def write_all(class_, logger, archive_names = [], suite_names = [], component_names = [], force = False): ''' Writes all Contents files for suites in list suite_names which defaults to all 'touchable' suites if not specified explicitely. Untouchable @@ -293,6 +293,8 @@ class ContentsWriter(object): class_.logger = logger session = DBConn().session() suite_query = session.query(Suite) + if len(archive_names) > 0: + suite_query = suite_query.join(Suite.archive).filter(Archive.archive_name.in_(archive_names)) if len(suite_names) > 0: suite_query = suite_query.filter(Suite.suite_name.in_(suite_names)) component_query = session.query(Component)