#765 search build by source
Merged 4 years ago by mikem. Opened 4 years ago by tkopecek.
tkopecek/koji issue701  into  master

file modified
+3 -2
@@ -6819,8 +6819,6 @@ 

                      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 @@ 

                  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")

file modified
+7 -1
@@ -9480,7 +9480,7 @@ 

          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 @@ 

          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 @@ 

            - owner_name

            - volume_id

            - volume_name

+           - source

            - creation_event_id

            - creation_time

            - creation_ts
@@ -9568,6 +9571,9 @@ 

                  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:

Interesting. I'd expected this would be added to the listBuilds call instead.

Does it make sense to add it to both or would you prefer listBuilds? When I'm looking to it now, I think both calls could support it, but maybe listBuilds is a little bit more appropriate.

I think, for now at least, it fits best in listBuilds. So far, the search call is for finding things by their name or primary descriptor, whereas listBuilds is for finding builds that match some conditions. We might expand the scope of the search call in the future, but I think i'd leave this out of it for now.

rebased onto 4b142dfe206709843a543a0501417d5059a7c2ce

4 years ago

rebased onto 59abc82

4 years ago

I started to tweak the docstring addition and ended up cleaning up the whole thing:

https://github.com/mikem23/koji-playground/commits/pagure/pr/765

Commit 50d02cd fixes this pull-request

Pull-Request has been merged by mikem

4 years ago