From 59abc829f19c8e134f231a8ce7cf80f0d61cb744 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Dec 21 2017 11:05:00 +0000 Subject: extend listBuilds for search by source Fixes: https://pagure.io/koji/issue/701 --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index c3a66d7..72f4eca 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -6819,8 +6819,6 @@ def anon_handle_wait_repo(options, session, args): print("Successfully waited %s for a new %s repo" % (koji.util.duration(start), tag)) return -_search_types = ('package', 'build', 'tag', 'target', 'user', 'host', 'rpm', 'maven', 'win') - def handle_regen_repo(options, session, args): "[admin] Force a repo to be regenerated" @@ -6996,6 +6994,9 @@ def handle_dist_repo(options, session, args): poll_interval=options.poll_interval) +_search_types = ('package', 'build', 'tag', 'target', 'user', 'host', 'rpm', + 'maven', 'win') + def anon_handle_search(options, session, args): "[search] Search the system" usage = _("usage: %prog search [options] search_type pattern") diff --git a/hub/kojihub.py b/hub/kojihub.py index 7e664af..213f31c 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -9480,7 +9480,7 @@ class RootExports(object): return readTaggedArchives(tag, event=event, inherit=inherit, latest=latest, package=package, type=type) def listBuilds(self, packageID=None, userID=None, taskID=None, prefix=None, state=None, - volumeID=None, + volumeID=None, source=None, createdBefore=None, createdAfter=None, completeBefore=None, completeAfter=None, type=None, typeInfo=None, queryOpts=None): """List package builds. @@ -9489,6 +9489,8 @@ class RootExports(object): If taskID is specfied, restrict the results to builds with the given task ID. If taskID is -1, restrict the results to builds with a non-null taskID. If volumeID is specified, restrict the results to builds stored on that volume + If source is specified, restrict the results to builds with given + CVS source. Source could be given as 'glob' string. One or more of packageID, userID, volumeID, and taskID may be specified. If prefix is specified, restrict the results to builds whose package name starts with that prefix. @@ -9520,6 +9522,7 @@ class RootExports(object): - owner_name - volume_id - volume_name + - source - creation_event_id - creation_time - creation_ts @@ -9568,6 +9571,9 @@ class RootExports(object): clauses.append('build.task_id IS NOT NULL') else: clauses.append('build.task_id = %(taskID)i') + if source is not None: + source = self._prepareSearchTerms(source, 'glob') + clauses.append('build.source ilike %(source)s') if prefix: clauses.append("package.name ilike %(prefix)s || '%%'") if state != None: