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

- add blt and rblt commands, aka "buildlogtail" and "remotebuildlogtail" to show

just the end of a build log (for getting the fail reason faster).
   CHANGE: the --start parameter is now called --offset
This commit is contained in:
Adrian Schröter 2011-01-07 23:05:44 +01:00
parent a828b0be2e
commit db9e7c7974
2 changed files with 46 additions and 10 deletions

3
NEWS
View File

@ -1,4 +1,7 @@
0.131 0.131
- add blt and rblt commands, aka "buildlogtail" and "remotebuildlogtail" to show
just the end of a build log (for getting the fail reason faster).
CHANGE: the --start parameter is now called --offset
0.130 0.130
- new "revert" command to restore the original working copy file (without - new "revert" command to restore the original working copy file (without

View File

@ -3612,8 +3612,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
sys.exit(1) sys.exit(1)
@cmdln.alias('bl') @cmdln.alias('bl')
@cmdln.option('-s', '--start', metavar='START', @cmdln.alias('blt')
help='get log starting from the offset') @cmdln.alias('buildlogtail')
@cmdln.option('-o', '--offset', metavar='OFFSET',
help='get log start or end from the offset')
def do_buildlog(self, subcmd, opts, *args): def do_buildlog(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build log of a package """${cmd_name}: Shows the build log of a package
@ -3621,6 +3623,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
log while it is being written. log while it is being written.
Needs to be called from within a package directory. Needs to be called from within a package directory.
When called as buildlogtail (or blt) it just shows the end of the logfile.
This is usefull to see just a build failure reasons.
The arguments REPOSITORY and ARCH are the first two columns in the 'osc The arguments REPOSITORY and ARCH are the first two columns in the 'osc
results' output. If the buildlog url is used buildlog command has the results' output. If the buildlog url is used buildlog command has the
same behavior as remotebuildlog. same behavior as remotebuildlog.
@ -3647,8 +3652,20 @@ Please submit there instead, or use --nodevelproject to force direct submission.
arch = args[1] arch = args[1]
offset=0 offset=0
if opts.start: if subcmd == "blt" or subcmd == "buildlogtail":
offset = int(opts.start) query = { 'view': 'entry' }
u = makeurl(self.get_api_url(), ['build', project, repository, arch, package, '_log'], query=query)
f = http_GET(u)
root = ET.parse(f).getroot()
offset = int(root.find('entry').get('size'))
if opts.offset:
offset = offset - int(opts.offset)
else:
offset = offset - ( 4 * 1024 )
if offset < 0:
offset=0
elif opts.offset:
offset = int(opts.offset)
print_buildlog(apiurl, project, package, repository, arch, offset) print_buildlog(apiurl, project, package, repository, arch, offset)
@ -3674,14 +3691,19 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.alias('rbl') @cmdln.alias('rbl')
@cmdln.alias('rbuildlog') @cmdln.alias('rbuildlog')
@cmdln.option('-s', '--start', metavar='START', @cmdln.alias('rblt')
help='get log starting from the offset') @cmdln.alias('rbuildlogtail')
@cmdln.alias('remotebuildlogtail')
@cmdln.option('-o', '--offset', metavar='OFFSET',
help='get log starting or ending from the offset')
def do_remotebuildlog(self, subcmd, opts, *args): def do_remotebuildlog(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build log of a package """${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 Shows the log file of the build of a package. Can be used to follow the
log while it is being written. log while it is being written.
remotebuildlogtail shows just the tail of the log file.
usage: usage:
osc remotebuildlog project package repository arch osc remotebuildlog project package repository arch
or or
@ -3702,14 +3724,25 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else: else:
project, package, repository, arch = args project, package, repository, arch = args
if subcmd == "rblt" or subcmd == "rbuildlogtail" or subcmd == "remotebuildlogtail":
query = { 'view': 'entry' }
u = makeurl(self.get_api_url(), ['build', project, repository, arch, package, '_log'], query=query)
f = http_GET(u)
root = ET.parse(f).getroot()
offset = int(root.find('entry').get('size'))
if opts.offset:
offset = offset - int(opts.offset)
else:
offset = offset - ( 4 * 1024 )
if offset < 0:
offset=0 offset=0
if opts.start: elif opts.offset:
offset = int(opts.start) offset = int(opts.offset)
print_buildlog(apiurl, project, package, repository, arch, offset) print_buildlog(apiurl, project, package, repository, arch, offset)
@cmdln.alias('lbl') @cmdln.alias('lbl')
@cmdln.option('-s', '--start', metavar='START', @cmdln.option('-o', '--offset', metavar='OFFSET',
help='get log starting from offset') help='get log starting from offset')
def do_localbuildlog(self, subcmd, opts, *args): def do_localbuildlog(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build log of a local buildchroot """${cmd_name}: Shows the build log of a local buildchroot