mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 01:46:13 +01:00
add new subcommands buildconfig, buildinfo, repos
This commit is contained in:
parent
1145aa0d3e
commit
5d86b595b9
@ -544,6 +544,52 @@ To find out <platform> and <arch>, you can use 'osc results'
|
||||
pass
|
||||
|
||||
|
||||
def buildinfo(args):
|
||||
"""buildinfo: Shows the buildinfo which is used in building a package (you need to be inside a package directory)
|
||||
|
||||
usage: osc buildinfo <platform> <arch>
|
||||
"""
|
||||
wd = os.curdir
|
||||
package = store_read_package(wd)
|
||||
project = store_read_project(wd)
|
||||
|
||||
platform = args[0]
|
||||
arch = args[1]
|
||||
print ''.join(get_buildinfo(project, package, platform, arch))
|
||||
|
||||
|
||||
def buildconfig(args):
|
||||
"""buildconfig: Shows the buildconfig which is used in building a package (you need to be inside a package directory)
|
||||
|
||||
usage: osc buildconfig <platform> <arch>
|
||||
"""
|
||||
wd = os.curdir
|
||||
package = store_read_package(wd)
|
||||
project = store_read_project(wd)
|
||||
|
||||
platform = args[0]
|
||||
arch = args[1]
|
||||
print ''.join(get_buildconfig(project, package, platform, arch))
|
||||
|
||||
|
||||
def repos(args):
|
||||
"""repos: Shows the repositories which are defined for a package
|
||||
|
||||
usage: 1. osc repos # package = current dir
|
||||
2. osc repos <packagedir>
|
||||
"""
|
||||
args = parseargs(args)
|
||||
pacs = findpacs(args)
|
||||
|
||||
for p in pacs:
|
||||
#print p.name + ':', cmd_rebuild(p.prjname, p.name)
|
||||
|
||||
#print ''.join(get_buildinfo(project, package, platform, arch))
|
||||
for platform in get_repos_of_project(p.prjname):
|
||||
print platform
|
||||
#print '\n'.join(get_results(project, package, platform))
|
||||
|
||||
|
||||
def history(args):
|
||||
"""history: Shows the build history of a package (NOT IMPLEMENTED YET)
|
||||
|
||||
@ -603,6 +649,8 @@ usage: osc help [SUBCOMMAND...]
|
||||
cmd_dict = {
|
||||
add: ['add'],
|
||||
addremove: ['addremove'],
|
||||
buildconfig: ['buildconfig'],
|
||||
buildinfo: ['buildinfo'],
|
||||
commit: ['commit', 'ci', 'checkin'],
|
||||
checkout: ['checkout', 'co'],
|
||||
updatepacmetafromspec: ['updatepacmetafromspec'],
|
||||
@ -617,6 +665,7 @@ cmd_dict = {
|
||||
meta: ['meta'],
|
||||
platforms: ['platforms'],
|
||||
delete: ['delete', 'del', 'rm', 'remove'],
|
||||
repos: ['repos'],
|
||||
repourls: ['repourls'],
|
||||
resolved: ['resolved'],
|
||||
results: ['results'],
|
||||
|
26
osc/core.py
26
osc/core.py
@ -964,6 +964,18 @@ def get_platforms_of_project(prj):
|
||||
return r
|
||||
|
||||
|
||||
def get_repos_of_project(prj):
|
||||
f = show_project_meta(prj)
|
||||
tree = ET.parse(StringIO(''.join(f)))
|
||||
|
||||
repo_line_templ = '%-15s %-10s'
|
||||
r = []
|
||||
for node in tree.findall('repository'):
|
||||
for node2 in node.findall('arch'):
|
||||
r.append(repo_line_templ % (node.get('name'), node2.text))
|
||||
return r
|
||||
|
||||
|
||||
def show_results_meta(prj, package, platform):
|
||||
u = makeurl(['result', prj, platform, package, 'result'])
|
||||
f = urllib2.urlopen(u)
|
||||
@ -1010,6 +1022,20 @@ def get_log(prj, package, platform, arch, offset):
|
||||
return f.read()
|
||||
|
||||
|
||||
def get_buildinfo(prj, package, platform, arch):
|
||||
# http://api.opensuse.org/rpm/Subversion/Apache_SuSE_Linux_10.1/i586/subversion/buildinfo
|
||||
u = makeurl(['rpm', prj, platform, arch, package, 'buildinfo'])
|
||||
f = urllib2.urlopen(u)
|
||||
return f.read()
|
||||
|
||||
|
||||
def get_buildconfig(prj, package, platform, arch):
|
||||
# http://api.opensuse.org/rpm/<proj>/<repo>/_repository/<arch>/_buildconfig
|
||||
u = makeurl(['rpm', prj, platform, '_repository', arch, '_buildconfig'])
|
||||
f = urllib2.urlopen(u)
|
||||
return f.read()
|
||||
|
||||
|
||||
def get_history(prj, package):
|
||||
# http://api.opensuse.org/rpm/Apache/factory/i586/apache2/history ?
|
||||
# http://api.opensuse.org/package/Apache/apache2/history ?
|
||||
|
Loading…
Reference in New Issue
Block a user