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

do not crash via using not anymore supported /platform controller (unsupported since OBS 1.0)

Unify "repos" and "repositories" command. Make the command working at all as specified.
This commit is contained in:
Adrian Schröter 2010-07-29 16:59:54 +02:00
parent 753893222a
commit cb18807622

View File

@ -3153,37 +3153,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
p.clear_from_conflictlist(filename) p.clear_from_conflictlist(filename)
@cmdln.alias('platforms')
def do_repositories(self, subcmd, opts, *args):
"""${cmd_name}: Shows available repositories
Examples:
1. osc repositories
Shows all available repositories/build targets
2. osc repositories <project>
Shows the configured repositories/build targets of a project
usage:
osc repositories # works in checked out project/package
osc repositories PROJECT
${cmd_option_list}
"""
apiurl = self.get_api_url()
if args:
project = args[0]
print '\n'.join(get_repositories_of_project(apiurl, project))
else:
if is_package_dir('.') or is_project_dir('.'):
project = store_read_project(os.curdir)
print '\n'.join(get_repositories_of_project(apiurl, project))
else:
print '\n'.join(get_repositories(apiurl))
@cmdln.alias('dists') @cmdln.alias('dists')
# FIXME: using just ^DISCONTINUED as match is not a general approach and only valid for one instance # FIXME: using just ^DISCONTINUED as match is not a general approach and only valid for one instance
# we need to discuss an api call for that, if we need this # we need to discuss an api call for that, if we need this
@ -3423,7 +3392,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print_buildlog(apiurl, project, package, repository, arch, offset) print_buildlog(apiurl, project, package, repository, arch, offset)
def print_repos(self, repos_only=False): def print_repos(self):
wd = os.curdir wd = os.curdir
doprint = False doprint = False
if is_package_dir(wd): if is_package_dir(wd):
@ -3436,10 +3405,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if doprint: if doprint:
print 'Valid arguments for this %s are:' % str print 'Valid arguments for this %s are:' % str
print print
if repos_only:
self.do_repositories(None, None) self.do_repositories(None, None)
else:
self.do_repos(None, None)
raise oscerr.WrongArgs('Missing arguments') raise oscerr.WrongArgs('Missing arguments')
@cmdln.alias('rbl') @cmdln.alias('rbl')
@ -3762,7 +3728,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
args = slash_split(args) args = slash_split(args)
if len(args) < 1 and (is_package_dir('.') or is_project_dir('.')): if len(args) < 1 and (is_package_dir('.') or is_project_dir('.')):
self.print_repos(True) self.print_repos()
if len(args) > 2: if len(args) > 2:
raise oscerr.WrongArgs('Too many arguments.') raise oscerr.WrongArgs('Too many arguments.')
@ -3781,8 +3747,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print ''.join(get_buildconfig(apiurl, project, repository)) print ''.join(get_buildconfig(apiurl, project, repository))
def do_repos(self, subcmd, opts, *args): @cmdln.alias('repos')
"""${cmd_name}: shows repositories configured for a project or package @cmdln.alias('platforms')
def do_repositories(self, subcmd, opts, *args):
"""${cmd_name}: shows repositories configured for a project.
It skips repositories by default which are disabled for a given package.
usage: usage:
osc repos osc repos
@ -3792,12 +3761,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
""" """
apiurl = self.get_api_url() apiurl = self.get_api_url()
project = None
package = None package = None
disabled = None disabled = None
if len(args) == 1: if len(args) == 1:
project = args[0] project = args[0]
elif len(args) == 1: elif len(args) == 2:
project = args[0] project = args[0]
package = args[1] package = args[1]
elif len(args) == 0: elif len(args) == 0:
@ -3809,6 +3779,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else: else:
raise oscerr.WrongArgs('Wrong number of arguments') raise oscerr.WrongArgs('Wrong number of arguments')
if project is None:
raise oscerr.WrongArgs('No project specified')
if package is not None: if package is not None:
disabled = show_package_disabled_repos(apiurl, project, package) disabled = show_package_disabled_repos(apiurl, project, package)