mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
Merge branch 'multibuild' of https://github.com/lethliel/osc
Adds a "--multibuild-package" option to the following commands: buildlog, remotebuildlog, buildinfo, build, buildhistory, jobhistory, rebuild, restartbuild/abortbuild, wipebinaries, getbinaries
This commit is contained in:
commit
74e397b12c
@ -5140,6 +5140,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('-M', '--multibuild-package', metavar='MPAC',
|
||||
help='get log of the specified multibuild package')
|
||||
@cmdln.option('-o', '--offset', metavar='OFFSET',
|
||||
help='get log start or end from the offset')
|
||||
@cmdln.option('-s', '--strip-time', action='store_true',
|
||||
@ -5187,6 +5189,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
repository = args[0]
|
||||
arch = args[1]
|
||||
|
||||
if opts.multibuild_package:
|
||||
package = package + ":" + opts.multibuild_package
|
||||
|
||||
offset = 0
|
||||
if subcmd == "blt" or subcmd == "buildlogtail":
|
||||
query = { 'view': 'entry' }
|
||||
@ -5234,6 +5239,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('-M', '--multibuild-package', metavar='MPAC',
|
||||
help='show log file for specified multibuild package')
|
||||
@cmdln.option('-o', '--offset', metavar='OFFSET',
|
||||
help='get log starting or ending from the offset')
|
||||
@cmdln.option('-s', '--strip-time', action='store_true',
|
||||
@ -5266,6 +5273,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
else:
|
||||
project, package, repository, arch = args
|
||||
|
||||
if opts.multibuild_package:
|
||||
package = package + ":" + opts.multibuild_package
|
||||
|
||||
offset = 0
|
||||
if subcmd == "rblt" or subcmd == "rbuildlogtail" or subcmd == "remotebuildlogtail":
|
||||
query = { 'view': 'entry' }
|
||||
@ -5494,6 +5504,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
@cmdln.option('-d', '--debug', action='store_true',
|
||||
help='verbose output of build dependencies')
|
||||
@cmdln.option('-M', '--multibuild-package', metavar='MPAC',
|
||||
help='Show the buildinfo of the specified multibuild package')
|
||||
@cmdln.option('-x', '--extra-pkgs', metavar='PAC', action='append',
|
||||
help='Add this package when computing the buildinfo')
|
||||
@cmdln.option('-p', '--prefer-pkgs', metavar='DIR', action='append',
|
||||
@ -5541,7 +5553,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
raise oscerr.WrongArgs('Incorrect number of arguments (Note: \'.\' is no package wc)')
|
||||
project = store_read_project('.')
|
||||
package = store_read_package('.')
|
||||
repository, arch, build_descr = self.parse_repoarchdescr(args, ignore_descr=True)
|
||||
repository, arch, build_descr = self.parse_repoarchdescr(args, ignore_descr=True, multibuild_package=opts.multibuild_package)
|
||||
elif len(args) == 4 or len(args) == 5:
|
||||
project = args[0]
|
||||
package = args[1]
|
||||
@ -5570,6 +5582,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
cpiodata.add(os.path.basename(build_descr), build_descr_data)
|
||||
build_descr_data = cpiodata.get()
|
||||
|
||||
if opts.multibuild_package:
|
||||
package = package + ":" + opts.multibuild_package
|
||||
|
||||
print(''.join(get_buildinfo(apiurl,
|
||||
project, package, repository, arch,
|
||||
specfile=build_descr_data,
|
||||
@ -5740,7 +5755,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
print(row)
|
||||
|
||||
|
||||
def parse_repoarchdescr(self, args, noinit = False, alternative_project = None, ignore_descr = False, vm_type = None):
|
||||
def parse_repoarchdescr(self, args, noinit = False, alternative_project = None, ignore_descr = False, vm_type = None, multibuild_package = None):
|
||||
"""helper to parse the repo, arch and build description from args"""
|
||||
import osc.build
|
||||
import glob
|
||||
@ -5839,6 +5854,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
pac = os.path.basename(os.getcwd())
|
||||
if is_package_dir(os.getcwd()):
|
||||
pac = store_read_package(os.getcwd())
|
||||
if multibuild_package:
|
||||
pac = multibuild_package
|
||||
if recipe == 'PKGBUILD':
|
||||
cands = [d for d in descr if d.startswith(recipe)]
|
||||
else:
|
||||
@ -5895,6 +5912,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='Prefer packages from this directory when installing the build-root')
|
||||
@cmdln.option('-k', '--keep-pkgs', metavar='DIR',
|
||||
help='Save built packages into this directory')
|
||||
@cmdln.option('-M', '--multibuild-package', metavar='MPAC',
|
||||
help='Build the specified multibuild package')
|
||||
@cmdln.option('-x', '--extra-pkgs', metavar='PAC', action='append',
|
||||
help='Add this package when installing the build-root')
|
||||
@cmdln.option('--root', metavar='ROOT',
|
||||
@ -6013,7 +6032,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if len(args) > 3:
|
||||
raise oscerr.WrongArgs('Too many arguments')
|
||||
|
||||
args = self.parse_repoarchdescr(args, opts.noinit or opts.offline, opts.alternative_project, False, opts.vm_type)
|
||||
args = self.parse_repoarchdescr(args, opts.noinit or opts.offline, opts.alternative_project, False, opts.vm_type, opts.multibuild_package)
|
||||
|
||||
# check for source services
|
||||
r = None
|
||||
@ -6291,6 +6310,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='generate output in CSV (separated by |)')
|
||||
@cmdln.option('-l', '--limit', metavar='limit',
|
||||
help='for setting the number of results')
|
||||
@cmdln.option('-M', '--multibuild-package', metavar= 'MPAC',
|
||||
help='Show the buildhistory of the specified multibuild package')
|
||||
@cmdln.alias('buildhist')
|
||||
def do_buildhistory(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Shows the build history of a package
|
||||
@ -6325,6 +6346,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
else:
|
||||
raise oscerr.WrongArgs('Wrong number of arguments')
|
||||
|
||||
if opts.multibuild_package:
|
||||
package = package + ":" + opts.multibuild_package
|
||||
|
||||
format = 'text'
|
||||
if opts.csv:
|
||||
format = 'csv'
|
||||
@ -6335,6 +6359,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='generate output in CSV (separated by |)')
|
||||
@cmdln.option('-l', '--limit', metavar='limit',
|
||||
help='for setting the number of results')
|
||||
@cmdln.option('-M', '--multibuild-package', metavar='MPAC',
|
||||
help='get jobhistory for the specified multibuild package')
|
||||
@cmdln.alias('jobhist')
|
||||
def do_jobhistory(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Shows the job history of a project
|
||||
@ -6377,6 +6403,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
else:
|
||||
raise oscerr.WrongArgs('Wrong number of arguments')
|
||||
|
||||
if opts.multibuild_package and package is not None:
|
||||
package = package + ":" + opts.multibuild_package
|
||||
|
||||
format = 'text'
|
||||
if opts.csv:
|
||||
format = 'csv'
|
||||
@ -6539,6 +6568,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='trigger rebuilds for a specific repository')
|
||||
@cmdln.option('-f', '--failed', action='store_true',
|
||||
help='rebuild all failed packages')
|
||||
@cmdln.option('-M', '--multibuild-package', action='append',
|
||||
help='rebuild specified multibuild package')
|
||||
@cmdln.option('--all', action='store_true',
|
||||
help='Rebuild all packages of entire project')
|
||||
@cmdln.alias('rebuildpac')
|
||||
@ -6595,6 +6626,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if not (opts.all or package or repo or arch or code):
|
||||
raise oscerr.WrongOptions('No option has been provided. If you want to rebuild all packages of the entire project, use --all option.')
|
||||
|
||||
packages = []
|
||||
if opts.multibuild_package:
|
||||
for subpackage in opts.multibuild_package:
|
||||
packages.append(package + ":" + subpackage)
|
||||
else:
|
||||
packages.append(package)
|
||||
|
||||
for package in packages:
|
||||
print(rebuild(apiurl, project, package, repo, arch, code))
|
||||
|
||||
|
||||
@ -6617,6 +6656,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
@cmdln.option('-a', '--arch', metavar='ARCH',
|
||||
help='Restart builds for a specific architecture')
|
||||
@cmdln.option('-M', '--multibuild-package', action='append',
|
||||
help='Restart builds for specified multibuild package')
|
||||
@cmdln.option('-r', '--repo', metavar='REPO',
|
||||
help='Restart builds for a specific repository')
|
||||
@cmdln.option('--all', action='store_true',
|
||||
@ -6663,11 +6704,21 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if not (opts.all or package or repo or arch):
|
||||
raise oscerr.WrongOptions('No option has been provided. If you want to restart all packages of the entire project, use --all option.')
|
||||
|
||||
packages = []
|
||||
if opts.multibuild_package:
|
||||
for subpackage in opts.multibuild_package:
|
||||
packages.append(package + ":" + subpackage)
|
||||
else:
|
||||
packages.append(package)
|
||||
|
||||
for package in packages:
|
||||
print(cmdbuild(apiurl, subcmd, project, package, arch, repo))
|
||||
|
||||
|
||||
@cmdln.option('-a', '--arch', metavar='ARCH',
|
||||
help='Delete all binary packages for a specific architecture')
|
||||
@cmdln.option('-M', '--multibuild-package', action='append',
|
||||
help='Delete all binary packages for specified multibuild package')
|
||||
@cmdln.option('-r', '--repo', metavar='REPO',
|
||||
help='Delete all binary packages for a specific repository')
|
||||
@cmdln.option('--build-disabled', action='store_true',
|
||||
@ -6734,7 +6785,15 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if len(codes) == 0:
|
||||
raise oscerr.WrongOptions('No option has been provided. If you want to delete all binaries, use --all option.')
|
||||
|
||||
# make a new request for each code= parameter
|
||||
packages = []
|
||||
if opts.multibuild_package:
|
||||
for subpackage in opts.multibuild_package:
|
||||
packages.append(package + ":" + subpackage)
|
||||
else:
|
||||
packages.append(package)
|
||||
|
||||
# make a new request for each code= parameter and for each package in packages
|
||||
for package in packages:
|
||||
for code in codes:
|
||||
if subcmd == 'unpublish':
|
||||
print(unpublish(apiurl, project, package, opts.arch, opts.repo, code))
|
||||
@ -6746,6 +6805,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='do not show downloading progress')
|
||||
@cmdln.option('-d', '--destdir', default='./binaries', metavar='DIR',
|
||||
help='destination directory')
|
||||
@cmdln.option('-M', '--multibuild-package', action='append',
|
||||
help='get binaries from specified multibuild package')
|
||||
@cmdln.option('--sources', action="store_true",
|
||||
help='also fetch source packages')
|
||||
@cmdln.option('--debug', action="store_true",
|
||||
@ -6809,8 +6870,15 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if architecture is None:
|
||||
arches = [i.arch for i in repos if repository == i.name]
|
||||
|
||||
|
||||
if package is None:
|
||||
package = meta_get_packagelist(apiurl, project)
|
||||
else:
|
||||
if opts.multibuild_package:
|
||||
packages = []
|
||||
for subpackage in opts.multibuild_package:
|
||||
packages.append(package + ":" + subpackage)
|
||||
package = packages
|
||||
else:
|
||||
package = [package]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user