mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +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:
parent
753893222a
commit
cb18807622
@ -3153,37 +3153,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
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')
|
||||
# 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
|
||||
@ -3423,7 +3392,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
print_buildlog(apiurl, project, package, repository, arch, offset)
|
||||
|
||||
|
||||
def print_repos(self, repos_only=False):
|
||||
def print_repos(self):
|
||||
wd = os.curdir
|
||||
doprint = False
|
||||
if is_package_dir(wd):
|
||||
@ -3436,10 +3405,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if doprint:
|
||||
print 'Valid arguments for this %s are:' % str
|
||||
print
|
||||
if repos_only:
|
||||
self.do_repositories(None, None)
|
||||
else:
|
||||
self.do_repos(None, None)
|
||||
self.do_repositories(None, None)
|
||||
raise oscerr.WrongArgs('Missing arguments')
|
||||
|
||||
@cmdln.alias('rbl')
|
||||
@ -3762,7 +3728,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
args = slash_split(args)
|
||||
|
||||
if len(args) < 1 and (is_package_dir('.') or is_project_dir('.')):
|
||||
self.print_repos(True)
|
||||
self.print_repos()
|
||||
|
||||
if len(args) > 2:
|
||||
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))
|
||||
|
||||
|
||||
def do_repos(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: shows repositories configured for a project or package
|
||||
@cmdln.alias('repos')
|
||||
@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:
|
||||
osc repos
|
||||
@ -3792,12 +3761,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
"""
|
||||
|
||||
apiurl = self.get_api_url()
|
||||
project = None
|
||||
package = None
|
||||
disabled = None
|
||||
|
||||
if len(args) == 1:
|
||||
project = args[0]
|
||||
elif len(args) == 1:
|
||||
elif len(args) == 2:
|
||||
project = args[0]
|
||||
package = args[1]
|
||||
elif len(args) == 0:
|
||||
@ -3809,6 +3779,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
else:
|
||||
raise oscerr.WrongArgs('Wrong number of arguments')
|
||||
|
||||
if project is None:
|
||||
raise oscerr.WrongArgs('No project specified')
|
||||
|
||||
if package is not None:
|
||||
disabled = show_package_disabled_repos(apiurl, project, package)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user