extend listBuilds for search by source

Fixes: https://pagure.io/koji/issue/701
This commit is contained in:
Tomas Kopecek 2017-12-19 14:38:06 +01:00 committed by Mike McLean
parent 12b9af57c7
commit f468aeb19a
2 changed files with 10 additions and 3 deletions

View file

@ -6825,8 +6825,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"
@ -7002,6 +7000,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")

View file

@ -9509,7 +9509,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.
@ -9518,6 +9518,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.
@ -9549,6 +9551,7 @@ class RootExports(object):
- owner_name
- volume_id
- volume_name
- source
- creation_event_id
- creation_time
- creation_ts
@ -9597,6 +9600,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: