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

* add the new "dist" command to NEWS file.

* disable the "DISCONTINUED" support for now, because this is just a hack
  which only works with one instance. We need a server side supported approach
  in case we need this.
* Show repository to be used and the suggested reponame for own project
This commit is contained in:
Adrian Schröter 2010-07-29 07:37:54 +02:00
parent 553ed13518
commit b4a1f83e01
3 changed files with 15 additions and 9 deletions

1
NEWS
View File

@ -1,4 +1,5 @@
0.129
- "dists" command to show the configured default base repos from the server.
#
# Feature which requires OBS 2.1
#

View File

@ -3175,13 +3175,15 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.alias('dists')
@cmdln.option('-d', '--discontinued', action='store_true',
help='show discontinued distributions')
# 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
# @cmdln.option('-d', '--discontinued', action='store_true',
# help='show discontinued distributions')
def do_distributions(self, subcmd, opts, *args):
"""${cmd_name}: Shows all available distributions
This command shows the available distributions. For active distributions
it shows the name, project and name of the repository.
it shows the name, project and name of the repository and a suggested default repository name.
usage:
osc distributions
@ -3190,7 +3192,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
"""
apiurl = self.get_api_url()
print '\n'.join(get_distibutions(apiurl, opts.discontinued))
print '\n'.join(get_distibutions(apiurl))#FIXME:, opts.discontinued))
@cmdln.hide(1)
def do_results_meta(self, subcmd, opts, *args):

View File

@ -3650,6 +3650,7 @@ def get_repositories(apiurl):
def get_distibutions(apiurl, discon=False):
r = []
# FIXME: this is just a naming convention on api.opensuse.org, but not a general valid apparoach
if discon:
result_line_templ = '%(name)-25s %(project)s'
f = http_GET(makeurl(apiurl, ['build']))
@ -3666,7 +3667,7 @@ def get_distibutions(apiurl, discon=False):
r.insert(1,'------------ -------')
else:
result_line_templ = '%(name)-25s %(project)-25s %(reponame)s'
result_line_templ = '%(name)-25s %(project)-25s %(repository)-25s %(reponame)s'
f = http_GET(makeurl(apiurl, ['distributions']))
root = ET.fromstring(''.join(f))
@ -3676,12 +3677,14 @@ def get_distibutions(apiurl, discon=False):
rmap['name'] = node2.text
for node3 in node.findall('project'):
rmap['project'] = node3.text
for node4 in node.findall('reponame'):
rmap['reponame'] = node4.text
for node4 in node.findall('repository'):
rmap['repository'] = node4.text
for node5 in node.findall('reponame'):
rmap['reponame'] = node5.text
r.append(result_line_templ % rmap)
r.insert(0,'distribution project reponame')
r.insert(1,'------------ ------- --------')
r.insert(0,'distribution project repository reponame')
r.insert(1,'------------ ------- ---------- --------')
return r