1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

build environement parameter caching

repository, architecture and vm_type from last build is automatically
reused if not specified otherwise.
This commit is contained in:
Adrian Schröter 2019-12-04 09:45:17 +01:00
parent 47e346dde8
commit b329b74816
4 changed files with 36 additions and 7 deletions

11
NEWS
View File

@ -1,9 +1,12 @@
0.167
- 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
- osc build is reading debug packages from prjconf now
(extra-pkgs definition is therefore by default empty)
- osc build --vm-disk-size= switch support
- osc build/shell features:
* --vm-type=qemu support for cross architecture builds
* additional debug packages are read from build config now
(extra-pkgs definition is therefore by default empty now)
* --vm-disk-size= switch supported (has only an effect on clean builds)
* repository, architecture and vm_type from last build is automatically
reused if not specified otherwise.
0.166.2
- Don't enforce password reuse (boo#1156501)

View File

@ -705,7 +705,7 @@ def main(apiurl, opts, argv):
# check for source services
if not opts.offline and not opts.noservice:
p = Package('.')
p = osc.core.Package(os.curdir)
r = p.run_source_services(verbose=True)
if r:
raise oscerr.ServiceRuntimeError('Source service run failed!')
@ -1275,6 +1275,9 @@ def main(apiurl, opts, argv):
if hostarch != bi.buildarch and bi.buildarch in change_personality:
cmd = [ change_personality[bi.buildarch] ] + cmd
# record our settings for later builds
osc.core.store_write_last_buildroot(os.curdir, repo, arch, vm_type)
try:
rc = run_external(cmd[0], *cmd[1:])
if rc:

View File

@ -6115,7 +6115,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
# it seems to be an architecture in general
arg_arch = arg
if not (arg == osc.build.hostarch or arg in osc.build.can_also_build.get(osc.build.hostarch, [])):
print("WARNING: native compile is not possible, an emulator must be configured!")
if not (vm_type == 'qemu' or vm_type == 'emulator'):
print("WARNING: native compile is not possible, a emulator via binfmt misc handler must be configured!")
elif not arg_repository:
arg_repository = arg
else:
@ -6439,6 +6440,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if project == opts.alternative_project:
opts.alternative_project = None
if len(args) == 0:
# build env not specified, just read from last build attempt
lastbuildroot = store_read_last_buildroot(os.curdir)
if lastbuildroot:
args = [ lastbuildroot[0], lastbuildroot[1] ]
if not opts.vm_type:
opts.vm_type = lastbuildroot[2]
args = self.parse_repoarchdescr(args, opts.noinit or opts.offline, opts.alternative_project, False, opts.vm_type, opts.multibuild_package)
if not opts.local_package:

View File

@ -1140,7 +1140,7 @@ class Package:
REQ_STOREFILES = ('_project', '_package', '_apiurl', '_files', '_osclib_version')
OPT_STOREFILES = ('_to_be_added', '_to_be_deleted', '_in_conflict', '_in_update',
'_in_commit', '_meta', '_meta_mode', '_frozenlink', '_pulled', '_linkrepair',
'_size_limit', '_commit_msg')
'_size_limit', '_commit_msg', '_last_buildroot')
def __init__(self, workingdir, progress_obj=None, size_limit=None, wc_check=True):
global store
@ -6508,6 +6508,17 @@ def store_read_apiurl(dir, defaulturl=True):
apiurl = conf.config['apiurl']
return apiurl
def store_read_last_buildroot(dir):
global store
fname = os.path.join(dir, store, '_last_buildroot')
if os.path.exists(fname):
lines = open(fname).read().splitlines()
if len(lines) == 3:
return lines
return
def store_write_string(dir, file, string, subdir=''):
global store
@ -6532,6 +6543,9 @@ def store_write_project(dir, project):
def store_write_apiurl(dir, apiurl):
store_write_string(dir, '_apiurl', apiurl + '\n')
def store_write_last_buildroot(dir, repo, arch, vm_type):
store_write_string(dir, '_last_buildroot', repo + '\n' + arch + '\n' + vm_type + '\n')
def store_unlink_file(dir, file):
global store