Skip to content

Commit

Permalink
support package search with project results needed for maintained sea…
Browse files Browse the repository at this point in the history
…rch.

This is for sure not nice, but fixes #583570 for now. (we need really to re-think
the osc search implementation)
  • Loading branch information
adrianschroeter committed Mar 2, 2010
1 parent 8e7a171 commit f9aa6c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NEWS
Expand Up @@ -7,6 +7,8 @@
- Allow --prefer-pkgs to parse repodata
- new "osc build --no-service" option to skip source service update
- fix linktobranch apiurl usage
- "maintained package" search is telling relevant projects now
* requires OBS 1.7.2 or 2.0

0.125
- add "osc pull" command to fetch and merge changes in the link target
Expand Down
16 changes: 13 additions & 3 deletions osc/commandline.py
Expand Up @@ -4108,17 +4108,18 @@ def do_search(self, subcmd, opts, *args):
if subcmd == 'sm' or opts.maintained:
opts.bugowner = True
opts.package = True
opts.project = True
opts.limit_to_attribute = conf.config['maintained_attribute']
if opts.title:
search_list.append('title')
if opts.description:
search_list.append('description')
if opts.package:
search_list.append('@name')
search_for.append('package')
if opts.project:
search_list.append('@name')
search_for.append('project')
if opts.package:
search_list.append('@name')
search_for.append('package')
if opts.limit_to_attribute:
extra_limiter='attribute/@name="%s"' % (opts.limit_to_attribute)
if not opts.substring:
Expand All @@ -4138,7 +4139,16 @@ def do_search(self, subcmd, opts, *args):
search_list = ['title', 'description', '@name']
if not search_for:
search_for = [ 'project', 'package' ]

for kind in search_for:
# special mode only for maintainted search, search for projects based on package names
if subcmd == 'sm' or opts.maintained:
if kind == 'project':
search_list.append('package/@name')
else:
search_list.remove('package/@name')
search_list.append('@name')

result = search(conf.config['apiurl'], set(search_list), kind, search_term, opts.verbose, opts.exact, opts.repos_baseurl, role_filter, extra_limiter)

if not result:
Expand Down

0 comments on commit f9aa6c7

Please sign in to comment.