Replace subprocess.call() with subprocess.check_call().
Using check_call(), a non-zero return value from the subprocess will cause the desired behavior of an aborted build with a stack trace.
This commit is contained in:
parent
e8cbbb09d3
commit
846e8a0795
|
@ -72,8 +72,8 @@ def main():
|
|||
|
||||
os.makedirs('binary/live-build/config', exist_ok=True)
|
||||
|
||||
mount = subprocess.call('mount -o bind config binary/live-build/config', shell=True)
|
||||
remount = subprocess.call('mount -o remount,ro,bind binary/live-build/config', shell=True)
|
||||
mount = subprocess.check_call('mount -o bind config binary/live-build/config', shell=True)
|
||||
remount = subprocess.check_call('mount -o remount,ro,bind binary/live-build/config', shell=True)
|
||||
|
||||
# process hooks
|
||||
os.makedirs('binary/live-build', exist_ok=True)
|
||||
|
@ -90,11 +90,11 @@ def main():
|
|||
print('I: Executing \' ' + hook + '\'')
|
||||
|
||||
os.chmod(hook, 0o755)
|
||||
exec_hook = subprocess.call('cd binary && live-build/' + os.path.basename(hook), shell=True)
|
||||
exec_hook = subprocess.check_call('cd binary && live-build/' + os.path.basename(hook), shell=True)
|
||||
os.remove('binary/live-build/' + os.path.basename(hook))
|
||||
|
||||
# unmount coniguration directory
|
||||
umount = subprocess.call('umount binary/live-build/config', shell=True)
|
||||
umount = subprocess.check_call('umount binary/live-build/config', shell=True)
|
||||
|
||||
os.rmdir('binary/live-build/config')
|
||||
os.rmdir('binary/live-build')
|
||||
|
|
|
@ -84,13 +84,13 @@ def main():
|
|||
if verbose:
|
||||
print('I: Copying config/includes to binary')
|
||||
|
||||
cpio = subprocess.call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../binary', shell=True)
|
||||
cpio = subprocess.check_call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../binary', shell=True)
|
||||
|
||||
if glob.glob('config/includes.binary/*') or glob.glob('config/includes.binary/.*'):
|
||||
if verbose:
|
||||
print('I: Copying config/includes.binary to binary')
|
||||
|
||||
cpio = subprocess.call('cd config/includes.binary && find . | cpio -dmpu --no-preserve-owner ../../binary', shell=True)
|
||||
cpio = subprocess.check_call('cd config/includes.binary && find . | cpio -dmpu --no-preserve-owner ../../binary', shell=True)
|
||||
|
||||
# stagefile
|
||||
os.makedirs('.build', exist_ok=True)
|
||||
|
|
|
@ -113,7 +113,7 @@ def main():
|
|||
|
||||
# Notes:
|
||||
# * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly.
|
||||
cache = subprocess.call('cp -a cache/bootstrap chroot', shell=True)
|
||||
cache = subprocess.check_call('cp -a cache/bootstrap chroot', shell=True)
|
||||
|
||||
os.makedirs('.build', exist_ok=True)
|
||||
open('.build/bootstrap', 'w').close()
|
||||
|
@ -140,7 +140,7 @@ def main():
|
|||
# * calling cdebootstrap twice:
|
||||
# - to use already downloaded /var/cache/bootstrap/*.deb on incomplete builds
|
||||
# - to use /var/cache/boottrap/*.deb for debian-installer
|
||||
cdebootstrap = subprocess.call('/usr/bin/cdebootstrap --download-only ' + cdebootstrap_options, shell=True)
|
||||
cdebootstrap = subprocess.check_call('/usr/bin/cdebootstrap --download-only ' + cdebootstrap_options, shell=True)
|
||||
|
||||
# package cache
|
||||
if glob.glob('chroot/var/cache/bootstrap/*.deb'):
|
||||
|
@ -163,7 +163,7 @@ def main():
|
|||
if verbose:
|
||||
print('I: Calling \'/usr/bin/debootstrap ' + cdebootstrap_options + '\'')
|
||||
|
||||
cdebootstrap = subprocess.call('/usr/bin/cdebootstrap ' + cdebootstrap_options, shell=True)
|
||||
cdebootstrap = subprocess.check_call('/usr/bin/cdebootstrap ' + cdebootstrap_options, shell=True)
|
||||
|
||||
# stage cache
|
||||
if not os.path.exists('cache/bootstrap'):
|
||||
|
@ -172,7 +172,7 @@ def main():
|
|||
|
||||
# Notes:
|
||||
# * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly.
|
||||
cache = subprocess.call('cp -a chroot cache/bootstrap', shell=True)
|
||||
cache = subprocess.check_call('cp -a chroot cache/bootstrap', shell=True)
|
||||
|
||||
# stagefile
|
||||
os.makedirs('.build', exist_ok=True)
|
||||
|
|
|
@ -118,7 +118,7 @@ def main():
|
|||
|
||||
# Notes:
|
||||
# * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly.
|
||||
cache = subprocess.call('cp -a cache/bootstrap chroot', shell=True)
|
||||
cache = subprocess.check_call('cp -a cache/bootstrap chroot', shell=True)
|
||||
|
||||
os.makedirs('.build', exist_ok=True)
|
||||
open('.build/bootstrap', 'w').close()
|
||||
|
@ -142,7 +142,7 @@ def main():
|
|||
if verbose:
|
||||
print('I: Calling \'/usr/sbin/debootstrap ' + debootstrap_options + '\'')
|
||||
|
||||
debootstrap = subprocess.call('/usr/sbin/debootstrap ' + debootstrap_options, shell=True)
|
||||
debootstrap = subprocess.check_call('/usr/sbin/debootstrap ' + debootstrap_options, shell=True)
|
||||
|
||||
# package cache
|
||||
if glob.glob('chroot/var/cache/apt/archives/*.deb'):
|
||||
|
@ -169,7 +169,7 @@ def main():
|
|||
|
||||
# Notes:
|
||||
# * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly.
|
||||
cache = subprocess.call('cp -a chroot cache/bootstrap', shell=True)
|
||||
cache = subprocess.check_call('cp -a chroot cache/bootstrap', shell=True)
|
||||
|
||||
# stagefile
|
||||
os.makedirs('.build', exist_ok=True)
|
||||
|
|
|
@ -72,8 +72,8 @@ def main():
|
|||
|
||||
os.makedirs('chroot/live-build/config', exist_ok=True)
|
||||
|
||||
mount = subprocess.call('mount -o bind config chroot/live-build/config', shell=True)
|
||||
remount = subprocess.call('mount -o remount,ro,bind chroot/live-build/config', shell=True)
|
||||
mount = subprocess.check_call('mount -o bind config chroot/live-build/config', shell=True)
|
||||
remount = subprocess.check_call('mount -o remount,ro,bind chroot/live-build/config', shell=True)
|
||||
|
||||
# process hooks
|
||||
os.makedirs('chroot/live-build', exist_ok=True)
|
||||
|
@ -90,11 +90,11 @@ def main():
|
|||
print('I: Executing \' ' + hook + '\'')
|
||||
|
||||
os.chmod(hook, 0o755)
|
||||
exec_hook = subprocess.call('chroot chroot /live-build/' + os.path.basename(hook), shell=True)
|
||||
exec_hook = subprocess.check_call('chroot chroot /live-build/' + os.path.basename(hook), shell=True)
|
||||
os.remove('chroot/live-build/' + os.path.basename(hook))
|
||||
|
||||
# unmount coniguration directory
|
||||
umount = subprocess.call('umount chroot/live-build/config', shell=True)
|
||||
umount = subprocess.check_call('umount chroot/live-build/config', shell=True)
|
||||
|
||||
os.rmdir('chroot/live-build/config')
|
||||
os.rmdir('chroot/live-build')
|
||||
|
|
|
@ -83,13 +83,13 @@ def main():
|
|||
if verbose:
|
||||
print('I: Copying config/includes to chroot')
|
||||
|
||||
cpio = subprocess.call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True)
|
||||
cpio = subprocess.check_call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True)
|
||||
|
||||
if glob.glob('config/includes.bootstrap/*') or glob.glob('config/includes.bootstrap/.*'):
|
||||
if verbose:
|
||||
print('I: Copying config/includes.bootstrap to chroot')
|
||||
|
||||
cpio = subprocess.call('cd config/includes.bootstrap && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True)
|
||||
cpio = subprocess.check_call('cd config/includes.bootstrap && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True)
|
||||
|
||||
# stagefile
|
||||
os.makedirs('.build', exist_ok=True)
|
||||
|
|
|
@ -72,8 +72,8 @@ def main():
|
|||
|
||||
os.makedirs('chroot/live-build/config', exist_ok=True)
|
||||
|
||||
mount = subprocess.call('mount -o bind config chroot/live-build/config', shell=True)
|
||||
remount = subprocess.call('mount -o remount,ro,bind chroot/live-build/config', shell=True)
|
||||
mount = subprocess.check_call('mount -o bind config chroot/live-build/config', shell=True)
|
||||
remount = subprocess.check_call('mount -o remount,ro,bind chroot/live-build/config', shell=True)
|
||||
|
||||
# process hooks
|
||||
os.makedirs('chroot/live-build', exist_ok=True)
|
||||
|
@ -90,11 +90,11 @@ def main():
|
|||
print('I: Executing \' ' + hook + '\'')
|
||||
|
||||
os.chmod(hook, 0o755)
|
||||
exec_hook = subprocess.call('chroot chroot /live-build/' + os.path.basename(hook), shell=True)
|
||||
exec_hook = subprocess.check_call('chroot chroot /live-build/' + os.path.basename(hook), shell=True)
|
||||
os.remove('chroot/live-build/' + os.path.basename(hook))
|
||||
|
||||
# unmount coniguration directory
|
||||
umount = subprocess.call('umount chroot/live-build/config', shell=True)
|
||||
umount = subprocess.check_call('umount chroot/live-build/config', shell=True)
|
||||
|
||||
os.rmdir('chroot/live-build/config')
|
||||
os.rmdir('chroot/live-build')
|
||||
|
|
|
@ -83,13 +83,13 @@ def main():
|
|||
if verbose:
|
||||
print('I: Copying config/includes to chroot')
|
||||
|
||||
cpio = subprocess.call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True)
|
||||
cpio = subprocess.check_call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True)
|
||||
|
||||
if glob.glob('config/includes.chroot/*') or glob.glob('config/includes.chroot/.*'):
|
||||
if verbose:
|
||||
print('I: Copying config/includes.chroot to chroot')
|
||||
|
||||
cpio = subprocess.call('cd config/includes.chroot && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True)
|
||||
cpio = subprocess.check_call('cd config/includes.chroot && find . | cpio -dmpu --no-preserve-owner ../../chroot', shell=True)
|
||||
|
||||
# stagefile
|
||||
os.makedirs('.build', exist_ok=True)
|
||||
|
|
|
@ -72,8 +72,8 @@ def main():
|
|||
|
||||
os.makedirs('source/live-build/config', exist_ok=True)
|
||||
|
||||
mount = subprocess.call('mount -o bind config source/live-build/config', shell=True)
|
||||
remount = subprocess.call('mount -o remount,ro,bind source/live-build/config', shell=True)
|
||||
mount = subprocess.check_call('mount -o bind config source/live-build/config', shell=True)
|
||||
remount = subprocess.check_call('mount -o remount,ro,bind source/live-build/config', shell=True)
|
||||
|
||||
# process hooks
|
||||
os.makedirs('source/live-build', exist_ok=True)
|
||||
|
@ -90,11 +90,11 @@ def main():
|
|||
print('I: Executing \' ' + hook + '\'')
|
||||
|
||||
os.chmod(hook, 0o755)
|
||||
exec_hook = subprocess.call('cd source && live-build/' + os.path.basename(hook), shell=True)
|
||||
exec_hook = subprocess.check_call('cd source && live-build/' + os.path.basename(hook), shell=True)
|
||||
os.remove('source/live-build/' + os.path.basename(hook))
|
||||
|
||||
# unmount coniguration directory
|
||||
umount = subprocess.call('umount source/live-build/config', shell=True)
|
||||
umount = subprocess.check_call('umount source/live-build/config', shell=True)
|
||||
|
||||
os.rmdir('source/live-build/config')
|
||||
os.rmdir('source/live-build')
|
||||
|
|
|
@ -84,13 +84,13 @@ def main():
|
|||
if verbose:
|
||||
print('I: Copying config/includes to source')
|
||||
|
||||
cpio = subprocess.call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../source', shell=True)
|
||||
cpio = subprocess.check_call('cd config/includes && find . | cpio -dmpu --no-preserve-owner ../../source', shell=True)
|
||||
|
||||
if glob.glob('config/includes.source/*') or glob.glob('config/includes.source/.*'):
|
||||
if verbose:
|
||||
print('I: Copying config/includes.source to source')
|
||||
|
||||
cpio = subprocess.call('cd config/includes.source && find . | cpio -dmpu --no-preserve-owner ../../source', shell=True)
|
||||
cpio = subprocess.check_call('cd config/includes.source && find . | cpio -dmpu --no-preserve-owner ../../source', shell=True)
|
||||
|
||||
# stagefile
|
||||
os.makedirs('.build', exist_ok=True)
|
||||
|
|
Loading…
Reference in New Issue