mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-06 11:20:57 +01:00
Merge branch 'fix_kvm_build_as_root' of https://github.com/adrianschroeter/osc
Remove "build as user" heuristic in case of a KVM build. A user build can be explicitly performed by unsetting the su-wrapper config option.
This commit is contained in:
commit
66440bea94
1
NEWS
1
NEWS
@ -5,6 +5,7 @@
|
|||||||
running the install section to see the result of it (use --stage=i=).
|
running the install section to see the result of it (use --stage=i=).
|
||||||
Check the help for more details.
|
Check the help for more details.
|
||||||
- allow to run build script as non-root, by setting su-wrapper empty
|
- allow to run build script as non-root, by setting su-wrapper empty
|
||||||
|
=> osc is not guessing anymore if user builds are wanted
|
||||||
|
|
||||||
0.172.0
|
0.172.0
|
||||||
- support --lastsucceeded/--last-succeeded in "osc buildlog", "osc
|
- support --lastsucceeded/--last-succeeded in "osc buildlog", "osc
|
||||||
|
21
osc/build.py
21
osc/build.py
@ -1291,7 +1291,6 @@ def main(apiurl, opts, argv):
|
|||||||
# before
|
# before
|
||||||
my_build_device = build_root + '/img'
|
my_build_device = build_root + '/img'
|
||||||
|
|
||||||
need_root = True
|
|
||||||
if vm_type:
|
if vm_type:
|
||||||
if config['build-swap']:
|
if config['build-swap']:
|
||||||
my_build_swap = config['build-swap'] % subst
|
my_build_swap = config['build-swap'] % subst
|
||||||
@ -1308,9 +1307,6 @@ def main(apiurl, opts, argv):
|
|||||||
vm_options += [ '--vm-swap=' + my_build_swap ]
|
vm_options += [ '--vm-swap=' + my_build_swap ]
|
||||||
vm_options += [ '--logfile=%s/.build.log' % build_root ]
|
vm_options += [ '--logfile=%s/.build.log' % build_root ]
|
||||||
if vm_type == 'kvm':
|
if vm_type == 'kvm':
|
||||||
if os.access(build_root, os.W_OK) and os.access('/dev/kvm', os.W_OK):
|
|
||||||
# so let's hope there's also an fstab entry
|
|
||||||
need_root = False
|
|
||||||
if config['build-kernel']:
|
if config['build-kernel']:
|
||||||
vm_options += [ '--vm-kernel=' + config['build-kernel'] ]
|
vm_options += [ '--vm-kernel=' + config['build-kernel'] ]
|
||||||
if config['build-initrd']:
|
if config['build-initrd']:
|
||||||
@ -1340,15 +1336,14 @@ def main(apiurl, opts, argv):
|
|||||||
cmd += specialcmdopts + vm_options + buildargs
|
cmd += specialcmdopts + vm_options + buildargs
|
||||||
cmd += [ build_descr ]
|
cmd += [ build_descr ]
|
||||||
|
|
||||||
if need_root:
|
sucmd = config['su-wrapper'].split()
|
||||||
sucmd = config['su-wrapper'].split()
|
if sucmd:
|
||||||
if sucmd:
|
if sucmd[0] == 'su':
|
||||||
if sucmd[0] == 'su':
|
if sucmd[-1] == '-c':
|
||||||
if sucmd[-1] == '-c':
|
sucmd.pop()
|
||||||
sucmd.pop()
|
cmd = sucmd + ['-s', cmd[0], 'root', '--' ] + cmd[1:]
|
||||||
cmd = sucmd + ['-s', cmd[0], 'root', '--' ] + cmd[1:]
|
else:
|
||||||
else:
|
cmd = sucmd + cmd
|
||||||
cmd = sucmd + cmd
|
|
||||||
|
|
||||||
# change personality, if needed
|
# change personality, if needed
|
||||||
if hostarch != bi.buildarch and bi.buildarch in change_personality:
|
if hostarch != bi.buildarch and bi.buildarch in change_personality:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user