mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-09 22:36:14 +01:00
Complete rewrite of the internal commandline handling, using cmdln.py.
Bump version to 0.95. New features: - implement "rebuild all failed packages", via --failed option in rebuildpac subcommand (new api route) - status -v shows all files, including unmodified ones - suppress the legend in prjresults by default (show with -l) - add global options to override config - can use arbitrary api server via global -A option - -H enables HTTP traffic debugging - --version Bugfixes: - fix typo in delete_project() (the line building up the URL got lost) - fix the commit subcommand's arguments. This works correctly now: osc ci ../test/onlyinwc `pwd` fstab ../test/f2 - fix buildinfo subcommand, if no specfile is posted. Broke with the recent URL handling rewrite, but didn't seem to bother because the build subcommand always sends the specfile. - try to fix buildhistory route, but it might be gone actually (need to pursue) - add --clean/--noinit to osc build help output
This commit is contained in:
parent
637dec8e83
commit
2f5b52e92c
10
TODO
10
TODO
@ -14,8 +14,6 @@
|
||||
- prefer-rpms support for osc build
|
||||
- plugin-ize subcommand implementation
|
||||
- look at Susannes extensions
|
||||
- add --clean/--noinit to osc build help output
|
||||
- https://api.opensuse.org/build/GNOME:UNSTABLE?cmd=rebuild&code=failed
|
||||
- Allow the package owners/users to signal an abort build.
|
||||
Message-ID: <20070214120205.GA9629@suse.de>
|
||||
- implement wipe command
|
||||
@ -165,8 +163,6 @@ put the current release number into the spec file before sending it
|
||||
show request body of 400 responses (bad request)
|
||||
|
||||
|
||||
geht print self.USAGE % self.__dict__ ?
|
||||
|
||||
|
||||
a merge issues:
|
||||
if I mark a file as "to be added" ("A"), and someone else alread adds (and
|
||||
@ -175,10 +171,6 @@ D apr_dbd_mysql.c
|
||||
M libapr-util1.spec
|
||||
|
||||
|
||||
build command:
|
||||
> "You need to call the command inside a package directory, which should be a
|
||||
> buildsystem checkout. (Local modifications are fine.)"
|
||||
|
||||
|
||||
in the unusual event that a log file should be there (due to status "building"), but there is none, fail gracefully.
|
||||
% osc log openSUSE_10.2 i586
|
||||
@ -199,8 +191,6 @@ Traceback (most recent call last):
|
||||
for node in root.find('packstatuslist'):
|
||||
TypeError: 'NoneType' object is not iterable
|
||||
|
||||
put the prjresults Legend into the help text instead of showing it each time?
|
||||
also, we could add the option to configure it away
|
||||
|
||||
|
||||
19:08 < Beineri> DuDE: can you add an option to "up" which moves instead overwriting a file if it has changed in the repository?
|
||||
|
@ -3,6 +3,10 @@
|
||||
# this wrapper exists so it can be put into /usr/bin, but still allows the
|
||||
# python module to be called within the source directory during development
|
||||
|
||||
import sys
|
||||
from osc import commandline
|
||||
commandline.main()
|
||||
|
||||
osc = commandline.Osc()
|
||||
sys.exit( osc.main() )
|
||||
|
||||
|
||||
|
1461
osc/cmdln.py
Normal file
1461
osc/cmdln.py
Normal file
File diff suppressed because it is too large
Load Diff
2004
osc/commandline.py
2004
osc/commandline.py
File diff suppressed because it is too large
Load Diff
14
osc/conf.py
14
osc/conf.py
@ -63,6 +63,7 @@ DEFAULTS = { 'apisrv': 'api.opensuse.org',
|
||||
# switched off for now (testing)
|
||||
'do_commits': '0',
|
||||
}
|
||||
boolean_opts = ['http_debug', 'do_commits']
|
||||
|
||||
new_conf_template = """
|
||||
[general]
|
||||
@ -120,7 +121,7 @@ def init_basicauth(config):
|
||||
|
||||
global cookiejar
|
||||
|
||||
if config['http_debug'] == '1':
|
||||
if config['http_debug']:
|
||||
# brute force
|
||||
def urllib2_debug_init(self, debuglevel=0):
|
||||
self._debuglevel = 1
|
||||
@ -215,6 +216,15 @@ def get_config():
|
||||
|
||||
config = dict(cp.items('general', raw=1))
|
||||
|
||||
for i in boolean_opts:
|
||||
try:
|
||||
if int(config.get(i)):
|
||||
config[i] = True
|
||||
else:
|
||||
config[i] = False
|
||||
except:
|
||||
sys.exit('option %s requires an integer value' % i)
|
||||
|
||||
# transform 'url1, url2, url3' form into a list
|
||||
if type(config['urllist']) == str:
|
||||
config['urllist'] = [ i.strip() for i in config['urllist'].split(',') ]
|
||||
@ -226,6 +236,4 @@ def get_config():
|
||||
config['user'] = config['auth_dict'][config['apisrv']]['user']
|
||||
config['pass'] = config['auth_dict'][config['apisrv']]['pass']
|
||||
|
||||
# finally, initialize urllib2 for to use the credentials for Basic Authentication
|
||||
init_basicauth(config)
|
||||
|
||||
|
50
osc/core.py
50
osc/core.py
@ -5,7 +5,7 @@
|
||||
# and distributed under the terms of the GNU General Public Licence,
|
||||
# either version 2, or (at your option) any later version.
|
||||
|
||||
__version__ = '0.9'
|
||||
__version__ = '0.95'
|
||||
|
||||
import os
|
||||
import sys
|
||||
@ -605,25 +605,12 @@ def filedir_to_pac(f):
|
||||
wd = f
|
||||
p = Package(wd)
|
||||
|
||||
elif os.path.isfile(f):
|
||||
wd = os.path.dirname(f)
|
||||
if wd == '':
|
||||
wd = os.curdir
|
||||
p = Package(wd)
|
||||
p.todo = [ os.path.basename(f) ]
|
||||
|
||||
else:
|
||||
wd = os.path.dirname(f)
|
||||
if wd == '':
|
||||
wd = os.curdir
|
||||
p = Package(wd)
|
||||
p.todo = [ os.path.basename(f) ]
|
||||
|
||||
|
||||
#else:
|
||||
# print
|
||||
# print 'error: %s is neither a valid file or directory' % f
|
||||
# sys.exit(1)
|
||||
|
||||
return p
|
||||
|
||||
@ -651,7 +638,7 @@ def http_request(method, url, data=None, file=None):
|
||||
|
||||
filefd = None
|
||||
|
||||
if conf.config['http_debug'] == '1':
|
||||
if conf.config['http_debug']:
|
||||
print
|
||||
print
|
||||
print '--', method, url
|
||||
@ -743,7 +730,7 @@ def check_store_version(dir):
|
||||
sys.exit(1)
|
||||
|
||||
if v != __version__:
|
||||
if v in ['0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8']:
|
||||
if v in ['0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9']:
|
||||
# version is fine, no migration needed
|
||||
f = open(versionfile, 'w')
|
||||
f.write(__version__ + '\n')
|
||||
@ -1141,6 +1128,7 @@ def delete_package(prj, pac):
|
||||
|
||||
def delete_project(prj):
|
||||
|
||||
u = makeurl(['source', prj])
|
||||
http_DELETE(u)
|
||||
|
||||
|
||||
@ -1212,7 +1200,7 @@ def get_results(prj, package):
|
||||
r.append(result_line_templ % rmap)
|
||||
return r
|
||||
|
||||
def get_prj_results(prj):
|
||||
def get_prj_results(prj, show_legend=False):
|
||||
#print '----------------------------------------'
|
||||
|
||||
r = []
|
||||
@ -1261,9 +1249,10 @@ def get_prj_results(prj):
|
||||
|
||||
r.append('')
|
||||
|
||||
r.append(' Legend:')
|
||||
for i, j in buildstatus_symbols.items():
|
||||
r.append(' %s %s' % (j, i))
|
||||
if show_legend:
|
||||
r.append(' Legend:')
|
||||
for i, j in buildstatus_symbols.items():
|
||||
r.append(' %s %s' % (j, i))
|
||||
|
||||
return r
|
||||
|
||||
@ -1277,7 +1266,10 @@ def get_log(prj, package, platform, arch, offset):
|
||||
def get_buildinfo(prj, package, platform, arch, specfile=None):
|
||||
# http://api.opensuse.org/rpm/Subversion/Apache_SuSE_Linux_10.1/i586/subversion/buildinfo
|
||||
u = makeurl(['rpm', prj, platform, arch, package, 'buildinfo'])
|
||||
f = http_POST(u, data=specfile)
|
||||
if specfile:
|
||||
f = http_POST(u, data=specfile)
|
||||
else:
|
||||
f = http_GET(u)
|
||||
return f.read()
|
||||
|
||||
|
||||
@ -1311,15 +1303,20 @@ def get_buildhistory(prj, package, platform, arch):
|
||||
return r
|
||||
|
||||
|
||||
def cmd_rebuild(prj, package, repo, arch):
|
||||
cmd = '?cmd=rebuild'
|
||||
def cmd_rebuild(prj, package, repo, arch, code=None):
|
||||
cmd = prj
|
||||
cmd += '?cmd=rebuild'
|
||||
if package:
|
||||
cmd += '&package=%s' % package
|
||||
if repo:
|
||||
cmd += '&repo=%s' % repo
|
||||
if arch:
|
||||
cmd += '&arch=%s' % arch
|
||||
u = makeurl(['source', prj, package, cmd])
|
||||
if code:
|
||||
cmd += '&code=%s' % code
|
||||
|
||||
u = makeurl(['build', cmd])
|
||||
try:
|
||||
# adding data to the request makes it a POST
|
||||
f = http_POST(u)
|
||||
except urllib2.HTTPError, e:
|
||||
print >>sys.stderr, 'could not trigger rebuild for project \'%s\' package \'%s\'' % (prj, package)
|
||||
@ -1328,8 +1325,7 @@ def cmd_rebuild(prj, package, repo, arch):
|
||||
sys.exit(1)
|
||||
|
||||
root = ET.parse(f).getroot()
|
||||
#code = root.get('code')
|
||||
return root.find('summary').text
|
||||
return root.get('code')
|
||||
|
||||
|
||||
def store_read_project(dir):
|
||||
|
Loading…
Reference in New Issue
Block a user