1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-13 17:16:23 +01:00

- added new command "remotebuildlog" to show the buildlog of a package

(you don't have to checkout the package to view the buildlog)
- renamed "get_log()" to "get_buildlog" to avoid any confusion with
  "get_commitlog()"
- added new method "print_buildlog()" which prints out the buildlog on the
  standard output
This commit is contained in:
Marcus Hüwe 2008-01-03 22:10:16 +00:00
parent 5242289d3d
commit 53e1640b1e
2 changed files with 38 additions and 14 deletions

View File

@ -1178,21 +1178,31 @@ class Osc(cmdln.Cmdln):
project = store_read_project(wd)
apiurl = store_read_apiurl(wd)
offset = 0
try:
while True:
log_chunk = get_log(apiurl, project, package, platform, arch, offset)
if len(log_chunk) == 0:
break
offset += len(log_chunk)
print log_chunk.strip()
print_buildlog(apiurl, project, package, platform, arch)
except urllib2.HTTPError, e:
print >>sys.stderr, 'Can\'t get logfile'
print >>sys.stderr, e
except KeyboardInterrupt:
pass
@cmdln.alias('rbl')
def do_remotebuildlog(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build log of a package
Shows the log file of the build of a package. Can be used to follow the
log while it is being written.
usage:
osc remotebuildlog project package platform arch
or
osc remotebuildlog project/package/platform/arch
${cmd_option_list}
"""
args = slash_split(args)
if len(args) < 4:
print >>sys.stderr, "too few arguments"
sys.exit(1)
elif len(args) > 4:
print >>sys.stderr, "too many arguments"
sys.exit(1)
print_buildlog(conf.config['apiurl'], *args)
@cmdln.option('-x', '--extra-pkgs', metavar='PAC', action='append',

View File

@ -1805,11 +1805,25 @@ def get_prj_results(apiurl, prj, show_legend=False):
return r
def get_log(apiurl, prj, package, platform, arch, offset):
def get_buildlog(apiurl, prj, package, platform, arch, offset):
u = makeurl(apiurl, ['build', prj, platform, arch, package, '_log?nostream=1&start=%s' % offset])
f = http_GET(u)
return f.read()
def print_buildlog(apiurl, prj, package, platform, arch, offset = 0):
"""prints out the buildlog on stdout"""
try:
while True:
log_chunk = get_buildlog(apiurl, prj, package, platform, arch, offset)
if len(log_chunk) == 0:
break
offset += len(log_chunk)
print log_chunk.strip()
except urllib2.HTTPError, e:
print >>sys.stderr, 'Can\'t get logfile'
print >>sys.stderr, e
except KeyboardInterrupt:
pass
def get_buildinfo(apiurl, prj, package, platform, arch, specfile=None, addlist=None):
query = []