diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 0b76ed51..964bfb54 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -3293,6 +3293,8 @@ def anon_handle_list_builds(goptions, session, args): parser.add_option("--type", help=_("List builds of this type.")) parser.add_option("--prefix", help=_("Only builds starting with this prefix")) parser.add_option("--pattern", help=_("Only list builds matching this GLOB pattern")) + parser.add_option("--cg", + help=_("Only list builds imported by matching content generator name")) parser.add_option("--source", help=_("Only builds where the source field matches " "(glob pattern)")) parser.add_option("--owner", help=_("List builds built by this owner")) @@ -3313,6 +3315,8 @@ def anon_handle_list_builds(goptions, session, args): value = getattr(options, key) if value is not None: opts[key] = value + if options.cg: + opts['cgID'] = options.cg if options.package: try: opts['packageID'] = int(options.package) diff --git a/hub/kojihub.py b/hub/kojihub.py index 39d4920c..e486dff8 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -11582,7 +11582,7 @@ class RootExports(object): volumeID=None, source=None, createdBefore=None, createdAfter=None, completeBefore=None, completeAfter=None, type=None, typeInfo=None, - queryOpts=None, pattern=None): + queryOpts=None, pattern=None, cgID=None): """ Return a list of builds that match the given parameters @@ -11596,6 +11596,7 @@ class RootExports(object): :param str prefix: only builds whose package name starts with that prefix :param str pattern: only builds whose nvr matches the glob pattern :param int state: only builds in the given state + :param int|str cgID: only build from given content generator Timestamp filter parameters - these limit the results to builds where the corresponding @@ -11725,6 +11726,12 @@ class RootExports(object): if not isinstance(completeAfter, str): completeAfter = datetime.datetime.fromtimestamp(completeAfter).isoformat(' ') clauses.append('build.completion_time > %(completeAfter)s') + if cgID: + cgID = lookup_name('content_generator', cgID, strict=False) + if not cgID: + return [] + cgID = cgID['id'] + clauses.append('build.cg_id = %(cgID)s') if type is None: pass elif type == 'maven':