Skip to content

Commit

Permalink
Merge branch 'lastsucceeded' of https://github.com/adrianschroeter/osc
Browse files Browse the repository at this point in the history
Add --lastsucceeded/--last-succeeded option to "osc buildlog" (the latter
option is also added to "osc remotebuildlog").
Also take the --lastsucceeded option into account when computing the
file offset (for the corresponding *tail commands).
Moreover, improve the error message in case of an unknown build type (now,
it also includes flatpak* filenames).
  • Loading branch information
marcus-h committed Jan 18, 2021
2 parents a6012b9 + ca080d2 commit 0f5bdc9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion osc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def main(apiurl, opts, argv):
build_type = 'flatpak'
if build_type not in ['spec', 'dsc', 'kiwi', 'arch', 'collax', 'livebuild', 'simpleimage', 'snapcraft', 'appimage', 'docker', 'podman', 'fissile', 'flatpak']:
raise oscerr.WrongArgs(
'Unknown build type: \'%s\'. Build description should end in .spec, .dsc, .kiwi, or .livebuild. Or being named PKGBUILD, build.collax, simpleimage, appimage.yml, snapcraft.yaml or Dockerfile' \
'Unknown build type: \'%s\'. Build description should end in .spec, .dsc, .kiwi, or .livebuild. Or being named PKGBUILD, build.collax, simpleimage, appimage.yml, snapcraft.yaml, flatpak.json, flatpak.yml, flatpak.yaml or Dockerfile' \
% build_type)
if not os.path.isfile(build_descr):
raise oscerr.WrongArgs('Error: build description file named \'%s\' does not exist.' % build_descr)
Expand Down
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 0f5bdc9

Please sign in to comment.