diff options
author | Kiel Christofferson <kiel@endpoint.com> | 2014-05-02 19:19:35 -0400 |
---|---|---|
committer | Kiel Christofferson <kiel@endpoint.com> | 2014-06-17 13:32:37 -0400 |
commit | 846e8a079578507f576f6cb9e2628cb8ff8ca138 (patch) | |
tree | 6db7b2ea6086a92124a961b01afb1592a26629e9 | |
parent | e8cbbb09d378145d5467326de5e0f5144827eb38 (diff) | |
download | vyos-live-build-846e8a079578507f576f6cb9e2628cb8ff8ca138.tar.gz vyos-live-build-846e8a079578507f576f6cb9e2628cb8ff8ca138.zip |
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.
-rwxr-xr-x | components/binary-hooks | 8 | ||||
-rwxr-xr-x | components/binary-includes | 4 | ||||
-rwxr-xr-x | components/bootstrap-cdebootstrap | 8 | ||||
-rwxr-xr-x | components/bootstrap-debootstrap | 6 | ||||
-rwxr-xr-x | components/bootstrap-hooks | 8 | ||||
-rwxr-xr-x | components/bootstrap-includes | 4 | ||||
-rwxr-xr-x | components/chroot-hooks | 8 | ||||
-rwxr-xr-x | components/chroot-includes | 4 | ||||
-rwxr-xr-x | components/source-hooks | 8 | ||||
-rwxr-xr-x | components/source-includes | 4 |
10 files changed, 31 insertions, 31 deletions
diff --git a/components/binary-hooks b/components/binary-hooks index d7bb4d7a7..20c5c0190 100755 --- a/components/binary-hooks +++ b/components/binary-hooks @@ -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') diff --git a/components/binary-includes b/components/binary-includes index a18d508ea..5b829aeba 100755 --- a/components/binary-includes +++ b/components/binary-includes @@ -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) diff --git a/components/bootstrap-cdebootstrap b/components/bootstrap-cdebootstrap index 514bb79d7..59c83c8df 100755 --- a/components/bootstrap-cdebootstrap +++ b/components/bootstrap-cdebootstrap @@ -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) diff --git a/components/bootstrap-debootstrap b/components/bootstrap-debootstrap index cc81e77a0..70974be6e 100755 --- a/components/bootstrap-debootstrap +++ b/components/bootstrap-debootstrap @@ -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) diff --git a/components/bootstrap-hooks b/components/bootstrap-hooks index 9eaa5ea71..694d66b95 100755 --- a/components/bootstrap-hooks +++ b/components/bootstrap-hooks @@ -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') diff --git a/components/bootstrap-includes b/components/bootstrap-includes index 8d10807b4..2ce677282 100755 --- a/components/bootstrap-includes +++ b/components/bootstrap-includes @@ -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) diff --git a/components/chroot-hooks b/components/chroot-hooks index a7a24816c..6d973afea 100755 --- a/components/chroot-hooks +++ b/components/chroot-hooks @@ -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') diff --git a/components/chroot-includes b/components/chroot-includes index 19c519af8..a961db6cf 100755 --- a/components/chroot-includes +++ b/components/chroot-includes @@ -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) diff --git a/components/source-hooks b/components/source-hooks index 672b53f3e..552e228da 100755 --- a/components/source-hooks +++ b/components/source-hooks @@ -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') diff --git a/components/source-includes b/components/source-includes index fe9684e92..85eca1482 100755 --- a/components/source-includes +++ b/components/source-includes @@ -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) |