1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00
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).
This commit is contained in:
Marcus Huewe 2021-01-18 18:59:22 +01:00
commit 0f5bdc9ad5
2 changed files with 9 additions and 3 deletions

View File

@ -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)

View File

@ -5553,6 +5553,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@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',
@ -5610,6 +5612,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
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()
@ -5623,7 +5627,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, 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):
@ -5658,7 +5662,7 @@ 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',
@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')
@ -5702,6 +5706,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
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()