1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-22 21:16:16 +01:00

add --binaryversion option

This commit is contained in:
Michael Schroeder 2012-01-13 15:18:33 +01:00
parent e0683d074c
commit 754897d905

View File

@ -5860,6 +5860,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='search binary packages') help='search binary packages')
@cmdln.option('-B', '--baseproject', metavar='PROJECT', @cmdln.option('-B', '--baseproject', metavar='PROJECT',
help='search packages built for PROJECT (implies --binary)') help='search packages built for PROJECT (implies --binary)')
@cmdln.option('--binaryversion', metavar='VERSION',
help='search for binary with specified version (implies --binary)')
@cmdln.alias('se') @cmdln.alias('se')
@cmdln.alias('bse') @cmdln.alias('bse')
def do_search(self, subcmd, opts, *args): def do_search(self, subcmd, opts, *args):
@ -5944,6 +5946,15 @@ Please submit there instead, or use --nodevelproject to force direct submission.
xpath = xpath_join(xpath, 'attribute/@name=\'%s\'' % opts.limit_to_attribute, op='and') xpath = xpath_join(xpath, 'attribute/@name=\'%s\'' % opts.limit_to_attribute, op='and')
if opts.baseproject: if opts.baseproject:
xpath = xpath_join(xpath, 'path/@project=\'%s\'' % opts.baseproject, op='and') xpath = xpath_join(xpath, 'path/@project=\'%s\'' % opts.baseproject, op='and')
if opts.binaryversion:
m = re.match(r'(.+)-(.*?)$', opts.binaryversion)
if m:
if m.group(2) != '':
xpath = xpath_join(xpath, '@versrel=\'%s\'' % opts.binaryversion, op='and')
else:
xpath = xpath_join(xpath, '@version=\'%s\'' % m.group(1), op='and')
else:
xpath = xpath_join(xpath, '@version=\'%s\'' % opts.binaryversion, op='and')
if not xpath: if not xpath:
xpath = xpath_join(xpath, build_xpath('@name', search_term, opts.substring), inner=True) xpath = xpath_join(xpath, build_xpath('@name', search_term, opts.substring), inner=True)