[opensuse-buildservice] [PATCH] Add support for searching binary packages
This adds the software.o.o search to osc. Usage: osc search --binary <package> osc search --baseproject=<distribution> <package> The output lists the filepaths below download.o.o/repositories, which is good enough for my use case, but improvements are welcome :). --- osc/commandline.py | 19 +++++++++++++++---- osc/core.py | 17 ++++++++++++++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 23cfbe1..08eb871 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -4064,6 +4064,10 @@ Please submit there instead, or use --nodevelproject to force direct submission. help='shorthand for --bugowner --package') @cmdln.option('--csv', action='store_true', help='generate output in CSV (separated by |)') + @cmdln.option('--binary', action='store_true', + help='search binary packages') + @cmdln.option('-B', '--baseproject', metavar='PROJECT', + help='search packages built for PROJECT (implies --binary)') @cmdln.alias('sm') @cmdln.alias('se') def do_search(self, subcmd, opts, *args): @@ -4078,15 +4082,15 @@ Please submit there instead, or use --nodevelproject to force direct submission. osc maintained \'source package name\' osc se ... ${cmd_option_list} - - osc search does not find binary rpm names. Use - http://software.opensuse.org/search?q=binaryname """ if opts.mine: opts.bugowner = True opts.package = True + if opts.baseproject: + opts.binary = True + for_user = False if opts.involved or opts.bugowner or opts.maintainer: for_user = True @@ -4120,6 +4124,11 @@ Please submit there instead, or use --nodevelproject to force direct submission. if opts.package: search_list.append('@name') search_for.append('package') + if opts.binary: + search_for = [ 'published/binary/id' ] + search_list = [ '@name' ] + if opts.baseproject: + extra_limiter='path/project="%s"' % opts.baseproject if opts.limit_to_attribute: extra_limiter='attribute/@name="%s"' % (opts.limit_to_attribute) if not opts.substring: @@ -4176,8 +4185,10 @@ Please submit there instead, or use --nodevelproject to force direct submission. if kind == 'package': headline = [ '# Project', '# Package' ] - else: + if kind == 'project': headline = [ '# Project' ] + if kind == 'published/binary/id': + headline = [ '# Path' ] if opts.verbose: headline.append('# Title') if opts.repos_baseurl: diff --git a/osc/core.py b/osc/core.py index 4dc3657..d27f1a5 100644 --- a/osc/core.py +++ b/osc/core.py @@ -4142,11 +4142,18 @@ def search(apiurl, search_list, kind, search_term, verbose = False, exact_matche role_filter = role_filter.split(':') predicate = build_xpath_predicate(search_list, search_term, exact_matches, extra_limiter) + element = kind + if kind == 'published/binary/id': + element = 'binary' + # hack: remove the surrounding [ ... ], the api does not like it in + # /search/published/binary/id + predicate.pop() + predicate.pop(0) u = makeurl(apiurl, ['search', kind], ['match=%s' % quote_plus(''.join(predicate))]) f = http_GET(u) root = ET.parse(f).getroot() result = [] - for node in root.findall(kind): + for node in root.findall(element): if role_filter: skip = 1 for p in node.findall('person'): @@ -4161,9 +4168,13 @@ def search(apiurl, search_list, kind, search_term, verbose = False, exact_matche project = node.get('project') package = node.get('name') result.append(package) - else: + result.append(project) + if kind == 'project': project = node.get('name') - result.append(project) + result.append(project) + if kind == 'published/binary/id': + filepath = node.get('filepath') + result.append(filepath) if verbose: title = node.findtext('title').strip() if len(title) > 60: -- 1.6.3.2 -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
On 2010-03-02 21:49:56 +0100, Michal Marek wrote:
This adds the software.o.o search to osc. Usage:
osc search --binary <package> osc search --baseproject=<distribution> <package>
The output lists the filepaths below download.o.o/repositories, which is good enough for my use case, but improvements are welcome :). Looks good to me - feel free to push it to git master:) Btw this another good example that osc's internal search methods are quite cumbersome... so it's time for a restructuring.
Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
On 2.3.2010 23:54, Marcus Hüwe wrote:
On 2010-03-02 21:49:56 +0100, Michal Marek wrote:
This adds the software.o.o search to osc. Usage:
osc search --binary <package> osc search --baseproject=<distribution> <package>
The output lists the filepaths below download.o.o/repositories, which is good enough for my use case, but improvements are welcome :). Looks good to me - feel free to push it to git master:)
I don't have push access to osc.git. Could you please git am and git push it? Thanks! Michal -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
Am Mittwoch, 3. März 2010 16:15:51 schrieb Michal Marek:
On 2.3.2010 23:54, Marcus Hüwe wrote:
On 2010-03-02 21:49:56 +0100, Michal Marek wrote:
This adds the software.o.o search to osc. Usage:
osc search --binary <package> osc search --baseproject=<distribution> <package>
The output lists the filepaths below download.o.o/repositories, which is good enough for my use case, but improvements are welcome :). Looks good to me - feel free to push it to git master:)
I don't have push access to osc.git. Could you please git am and git push it? Thanks!
Just tell me your gitorious account and I will add you. -- Adrian Schroeter SUSE Linux Products GmbH email: adrian@suse.de -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
Hi, On 2010-03-03 16:15:51 +0100, Michal Marek wrote:
On 2.3.2010 23:54, Marcus Hüwe wrote:
On 2010-03-02 21:49:56 +0100, Michal Marek wrote:
This adds the software.o.o search to osc. Usage:
osc search --binary <package> osc search --baseproject=<distribution> <package>
The output lists the filepaths below download.o.o/repositories, which is good enough for my use case, but improvements are welcome :). Looks good to me - feel free to push it to git master:)
I don't have push access to osc.git. Could you please git am and git push it? Thanks!
I just committed a slightly modified version of your patch (in the meantime osc's search interface changed a bit). Thanks! Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
On Tuesday 02 March 2010 21:49:56 Michal Marek wrote:
This adds the software.o.o search to osc. Usage:
osc search --binary <package> osc search --baseproject=<distribution> <package>
The output lists the filepaths below download.o.o/repositories, which is good enough for my use case, but improvements are welcome :). --- osc/commandline.py | 19 +++++++++++++++---- osc/core.py | 17 ++++++++++++++--- 2 files changed, 29 insertions(+), 7 deletions(-)
Having that in zypper would be just great :) Greetings, Stephan -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (4)
-
Adrian Schröter
-
Marcus Hüwe
-
Michal Marek
-
Stephan Kulow