From 1f89b5a538f1aa1476998da8bba49ac3dce716a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Thu, 14 Nov 2019 10:50:41 +0100 Subject: [PATCH] add --lastsucceeded option for logfile display no single option since it is really a special usecase IMHO jsc#OBS-40 --- NEWS | 1 + osc/commandline.py | 4 +++- osc/core.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 983154b7..b5d0bb9f 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ 0.167 + - Added --lastsucceeded option for logfile display (requires OBS 2.11) - osc shell/chroot/wipe is now handled via build script (working for chroot and KVM only atm) - osc build --vm-type=qemu support for cross architecture builds diff --git a/osc/commandline.py b/osc/commandline.py index 81c72de4..2044f370 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -5544,6 +5544,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. @cmdln.alias('remotebuildlogtail') @cmdln.option('-l', '--last', action='store_true', help='Show the last finished log file') + @cmdln.option('--lastsucceeded', action='store_true', + help='Show the last succeeded log file') @cmdln.option('-M', '--multibuild-package', metavar='MPAC', help='show log file for specified multibuild package') @cmdln.option('-o', '--offset', metavar='OFFSET', @@ -5599,7 +5601,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. elif opts.offset: offset = int(opts.offset) strip_time = opts.strip_time or conf.config['buildlog_strip_time'] - print_buildlog(apiurl, project, package, repository, arch, offset, strip_time, opts.last) + print_buildlog(apiurl, project, package, repository, arch, offset, strip_time, opts.last, opts.lastsucceeded) def _find_last_repo_arch(self, repo=None, fatal=True): import glob diff --git a/osc/core.py b/osc/core.py index b1289e48..b67da01d 100644 --- a/osc/core.py +++ b/osc/core.py @@ -6118,7 +6118,7 @@ def buildlog_strip_time(data): return time_regex.sub(b'', data) -def print_buildlog(apiurl, prj, package, repository, arch, offset=0, strip_time=False, last=False): +def print_buildlog(apiurl, prj, package, repository, arch, offset=0, strip_time=False, last=False, lastsucceeded=False): """prints out the buildlog on stdout""" def print_data(data, strip_time=False): @@ -6137,6 +6137,8 @@ def print_buildlog(apiurl, prj, package, repository, arch, offset=0, strip_time= query = {'nostream' : '1', 'start' : '%s' % offset} if last: query['last'] = 1 + if lastsucceeded: + query['lastsucceeded'] = 1 retry_count = 0 while True: query['start'] = offset