1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-12 02:04:04 +02: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:
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 0.167
- osc shell/chroot/wipe is now handled via build script (working for chroot and KVM only atm) - 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/shell features:
- osc build is reading debug packages from prjconf now * --vm-type=qemu support for cross architecture builds
(extra-pkgs definition is therefore by default empty) * additional debug packages are read from build config now
- osc build --vm-disk-size= switch support (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 0.166.2
- Don't enforce password reuse (boo#1156501) - Don't enforce password reuse (boo#1156501)

View File

@@ -705,7 +705,7 @@ def main(apiurl, opts, argv):
# check for source services # check for source services
if not opts.offline and not opts.noservice: if not opts.offline and not opts.noservice:
p = Package('.') p = osc.core.Package(os.curdir)
r = p.run_source_services(verbose=True) r = p.run_source_services(verbose=True)
if r: if r:
raise oscerr.ServiceRuntimeError('Source service run failed!') 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: if hostarch != bi.buildarch and bi.buildarch in change_personality:
cmd = [ change_personality[bi.buildarch] ] + cmd 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: try:
rc = run_external(cmd[0], *cmd[1:]) rc = run_external(cmd[0], *cmd[1:])
if rc: 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 # it seems to be an architecture in general
arg_arch = arg arg_arch = arg
if not (arg == osc.build.hostarch or arg in osc.build.can_also_build.get(osc.build.hostarch, [])): 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: elif not arg_repository:
arg_repository = arg arg_repository = arg
else: else:
@@ -6439,6 +6440,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if project == opts.alternative_project: if project == opts.alternative_project:
opts.alternative_project = None 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) 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: if not opts.local_package:

View File

@@ -1140,7 +1140,7 @@ class Package:
REQ_STOREFILES = ('_project', '_package', '_apiurl', '_files', '_osclib_version') REQ_STOREFILES = ('_project', '_package', '_apiurl', '_files', '_osclib_version')
OPT_STOREFILES = ('_to_be_added', '_to_be_deleted', '_in_conflict', '_in_update', OPT_STOREFILES = ('_to_be_added', '_to_be_deleted', '_in_conflict', '_in_update',
'_in_commit', '_meta', '_meta_mode', '_frozenlink', '_pulled', '_linkrepair', '_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): def __init__(self, workingdir, progress_obj=None, size_limit=None, wc_check=True):
global store global store
@@ -6508,6 +6508,17 @@ def store_read_apiurl(dir, defaulturl=True):
apiurl = conf.config['apiurl'] apiurl = conf.config['apiurl']
return 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=''): def store_write_string(dir, file, string, subdir=''):
global store global store
@@ -6532,6 +6543,9 @@ def store_write_project(dir, project):
def store_write_apiurl(dir, apiurl): def store_write_apiurl(dir, apiurl):
store_write_string(dir, '_apiurl', apiurl + '\n') 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): def store_unlink_file(dir, file):
global store global store