1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 09:56:13 +01:00

print valid repos if buildlog, buildhist or jobhist are called with

wrong arguments for convenience
This commit is contained in:
Ludwig Nussel 2009-11-23 10:13:19 +00:00
parent 989d7fa5d0
commit f1e67f1479

View File

@ -2658,7 +2658,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.alias('bl')
@cmdln.option('-s', '--start', metavar='START',
help='get log starting from the offset')
def do_buildlog(self, subcmd, opts, repository, arch):
def do_buildlog(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build log of a package
Shows the log file of the build of a package. Can be used to follow the
@ -2668,7 +2668,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
The arguments REPOSITORY and ARCH are the first two columns in the 'osc
results' output.
${cmd_usage}
${cmd_usage} REPOSITORY ARCH
${cmd_option_list}
"""
@ -2681,9 +2681,32 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.start:
offset = int(opts.start)
if args is None or len(args) < 2:
self.print_repos()
repository = args[0]
arch = args[1]
print_buildlog(apiurl, project, package, repository, arch, offset)
def print_repos(self):
wd = os.curdir
doprint = False
if is_package_dir(wd):
str = "package"
doprint = True
elif is_project_dir(wd):
str = "project"
doprint = True
if doprint:
print 'Valid arguments for this %s are:' % str
print
self.do_repos(None, None)
print
raise oscerr.WrongArgs('Missing arguments')
@cmdln.alias('rbl')
@cmdln.alias('rbuildlog')
def do_remotebuildlog(self, subcmd, opts, *args):
@ -2737,12 +2760,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
wd = os.curdir
args = slash_split(args)
if args is None or len(args) < 2:
print 'Valid arguments for this package are:'
print
self.do_repos(None, None)
print
raise oscerr.WrongArgs('Missing argument.')
if ( args is None or len(args) < 2) and is_package_dir('.'):
self.print_repos()
if len(args) > 5:
raise oscerr.WrongArgs('Too many arguments.')
@ -2802,12 +2821,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
wd = os.curdir
args = slash_split(args)
if args is None or len(args) < 2:
print 'Valid arguments for this package are:'
print
self.do_repos(None, None)
print
raise oscerr.WrongArgs('Missing argument.')
if ( args is None or len(args) < 2) and is_package_dir('.'):
self.print_repos()
if len(args) > 4:
raise oscerr.WrongArgs('Too many arguments.')
@ -3048,6 +3063,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
${cmd_option_list}
"""
if ( args is None or len(args) < 2) and is_package_dir('.'):
self.print_repos()
if len(args) == 4:
apiurl = conf.config['apiurl']
project = args[0]
@ -3089,6 +3107,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
wd = os.curdir
args = slash_split(args)
if (args is None or len(args) < 2) \
and (is_project_dir('.') or is_package_dir('.')):
self.print_repos()
if len(args) == 4:
apiurl = conf.config['apiurl']
project = args[0]
@ -3337,6 +3359,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
args = slash_split(args)
apiurl = conf.config['apiurl']
if ( args is None or len(args) < 2) and is_package_dir('.'):
self.print_repos()
if len(args) == 4:
project = args[0]
package = args[1]
@ -3353,10 +3378,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else:
sys.exit('Local directory is no checkout package, neither it is specified. ' )
else:
print 'Valid arguments for this package are:'
print
self.do_repos(None, None)
print
raise oscerr.WrongArgs('Need either 2 or 4 arguments')
# Get package list