mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
added new command 'osc distributions'
added new command 'osc distributions' to get info about active and discontinued distributions.
This commit is contained in:
parent
f338e36158
commit
290a3f0f90
@ -3173,6 +3173,24 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
print '\n'.join(get_repositories(apiurl))
|
||||
|
||||
|
||||
@cmdln.alias('dists')
|
||||
@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.
|
||||
|
||||
usage:
|
||||
osc distributions
|
||||
|
||||
${cmd_option_list}
|
||||
"""
|
||||
apiurl = self.get_api_url()
|
||||
|
||||
print '\n'.join(get_distibutions(apiurl, opts.discontinued))
|
||||
|
||||
@cmdln.hide(1)
|
||||
def do_results_meta(self, subcmd, opts, *args):
|
||||
print "Command results_meta is obsolete. Please use: osc results --xml"
|
||||
|
39
osc/core.py
39
osc/core.py
@ -3647,6 +3647,45 @@ def get_repositories(apiurl):
|
||||
return r
|
||||
|
||||
|
||||
def get_distibutions(apiurl, discon=False):
|
||||
r = []
|
||||
|
||||
if discon:
|
||||
result_line_templ = '%(name)-25s %(project)s'
|
||||
f = http_GET(makeurl(apiurl, ['build']))
|
||||
root = ET.fromstring(''.join(f))
|
||||
|
||||
for node in root.findall('entry'):
|
||||
if node.get('name').startswith('DISCONTINUED:'):
|
||||
rmap = {}
|
||||
rmap['name'] = node.get('name').replace('DISCONTINUED:','').replace(':', ' ')
|
||||
rmap['project'] = node.get('name')
|
||||
r.append (result_line_templ % rmap)
|
||||
|
||||
r.insert(0,'distribution project')
|
||||
r.insert(1,'------------ -------')
|
||||
|
||||
else:
|
||||
result_line_templ = '%(name)-25s %(project)-25s %(reponame)s'
|
||||
f = http_GET(makeurl(apiurl, ['distributions']))
|
||||
root = ET.fromstring(''.join(f))
|
||||
|
||||
for node in root.findall('distribution'):
|
||||
rmap = {}
|
||||
for node2 in node.findall('name'):
|
||||
rmap['name'] = node2.text
|
||||
for node3 in node.findall('project'):
|
||||
rmap['project'] = node3.text
|
||||
for node4 in node.findall('reponame'):
|
||||
rmap['reponame'] = node4.text
|
||||
r.append(result_line_templ % rmap)
|
||||
|
||||
r.insert(0,'distribution project reponame')
|
||||
r.insert(1,'------------ ------- --------')
|
||||
|
||||
return r
|
||||
|
||||
|
||||
# old compat lib call
|
||||
def get_platforms_of_project(apiurl, prj):
|
||||
return get_repositories_of_project(apiurl, prj)
|
||||
|
Loading…
Reference in New Issue
Block a user