Skip to content

Commit

Permalink
add --lastsucceeded option also for buildlog command
Browse files Browse the repository at this point in the history
introduce --last-succeeded alias
  • Loading branch information
adrianschroeter committed Jan 18, 2021
1 parent 9ad555e commit ca080d2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -5553,6 +5553,8 @@ def do_rpmlintlog(self, subcmd, opts, *args):
@cmdln.alias('buildlogtail')
@cmdln.option('-l', '--last', action='store_true',
help='Show the last finished log file')
@cmdln.option('--lastsucceeded', '--last-succeeded', action='store_true',
help='Show the last succeeded log file')
@cmdln.option('-M', '--multibuild-package', metavar='MPAC',
help='get log of the specified multibuild package')
@cmdln.option('-o', '--offset', metavar='OFFSET',
Expand Down Expand Up @@ -5610,6 +5612,8 @@ def do_buildlog(self, subcmd, opts, *args):
query = { 'view': 'entry' }
if opts.last:
query['last'] = 1
if opts.lastsucceeded:
query['lastsucceeded'] = 1
u = makeurl(self.get_api_url(), ['build', quote_plus(project), quote_plus(repository), quote_plus(arch), quote_plus(package), '_log'], query=query)
f = http_GET(u)
root = ET.parse(f).getroot()
Expand All @@ -5623,7 +5627,7 @@ def do_buildlog(self, subcmd, opts, *args):
elif opts.offset:
offset = int(opts.offset)
strip_time = opts.strip_time or conf.config['buildlog_strip_time']
print_buildlog(apiurl, quote_plus(project), quote_plus(package), quote_plus(repository), quote_plus(arch), offset, strip_time, opts.last)
print_buildlog(apiurl, quote_plus(project), quote_plus(package), quote_plus(repository), quote_plus(arch), offset, strip_time, opts.last, opts.lastsucceeded)


def print_repos(self, repos_only=False, exc_class=oscerr.WrongArgs, exc_msg='Missing arguments', project=None):
Expand Down Expand Up @@ -5658,7 +5662,7 @@ def print_repos(self, repos_only=False, exc_class=oscerr.WrongArgs, exc_msg='Mis
@cmdln.alias('remotebuildlogtail')
@cmdln.option('-l', '--last', action='store_true',
help='Show the last finished log file')
@cmdln.option('--lastsucceeded', action='store_true',
@cmdln.option('--lastsucceeded', '--last-succeeded', 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')
Expand Down Expand Up @@ -5702,6 +5706,8 @@ def do_remotebuildlog(self, subcmd, opts, *args):
query = { 'view': 'entry' }
if opts.last:
query['last'] = 1
if opts.lastsucceeded:
query['lastsucceeded'] = 1
u = makeurl(self.get_api_url(), ['build', quote_plus(project), quote_plus(repository), quote_plus(arch), quote_plus(package), '_log'], query=query)
f = http_GET(u)
root = ET.parse(f).getroot()
Expand Down

0 comments on commit ca080d2

Please sign in to comment.