From fc0606c686d60188087d5ffff5c890ceb3275bde Mon Sep 17 00:00:00 2001 From: Andrew Walker Date: Tue, 23 Oct 2012 18:43:11 -0700 Subject: [PATCH] scripts: Build make targets sequentially. Added omap2 to the list of defconfigs to scan. Install headers and kernel modules to separate staging directories by setting values for INSTALL_HDR_PATH and INSTALL_MOD_PATH. Build make targets sequentially instead all on one invocation. Signed-off-by: Andrew Walker Change-Id: I87dae363bd536808a74ff368b905d18ae11607b2 --- scripts/build-all.py | 54 +++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/scripts/build-all.py b/scripts/build-all.py index 296d9adf941..7f3784128ae 100755 --- a/scripts/build-all.py +++ b/scripts/build-all.py @@ -35,6 +35,7 @@ from optparse import OptionParser import subprocess import os import os.path +import re import shutil import sys @@ -83,12 +84,15 @@ def update_config(file, str): def scan_configs(): """Get the full list of defconfigs appropriate for this tree.""" names = {} - for n in glob.glob('arch/arm/configs/[fm]sm[0-9-]*_defconfig'): - names[os.path.basename(n)[:-10]] = n - for n in glob.glob('arch/arm/configs/qsd*_defconfig'): - names[os.path.basename(n)[:-10]] = n - for n in glob.glob('arch/arm/configs/apq*_defconfig'): - names[os.path.basename(n)[:-10]] = n + arch_pats = ( + r'[fm]sm[0-9]*_defconfig', + r'apq*_defconfig', + r'qsd*_defconfig', + r'omap2*_defconfig', + ) + for p in arch_pats: + for n in glob.glob('arch/arm/configs/' + p): + names[os.path.basename(n)[:-10]] = n return names class Builder: @@ -142,23 +146,41 @@ def build(target): savedefconfig = '%s/defconfig' % dest_dir shutil.copyfile(defconfig, dotconfig) + staging_dir = 'install_staging' + modi_dir = '%s' % staging_dir + hdri_dir = '%s/usr' % staging_dir + shutil.rmtree(os.path.join(dest_dir, staging_dir), ignore_errors=True) + devnull = open('/dev/null', 'r') subprocess.check_call(['make', 'O=%s' % dest_dir, '%s_defconfig' % target], env=make_env, stdin=devnull) devnull.close() if not all_options.updateconfigs: - build = Builder(log_name) - - result = build.run(['make', 'O=%s' % dest_dir] + make_command) - - if result != 0: - if all_options.keep_going: - failed_targets.append(target) - fail_or_error = error + # Build targets can be dependent upon the completion of previous + # build targets, so build them one at a time. + cmd_line = ['make', + 'INSTALL_HDR_PATH=%s' % hdri_dir, + 'INSTALL_MOD_PATH=%s' % modi_dir, + 'O=%s' % dest_dir] + build_targets = [] + for c in make_command: + if re.match(r'^-{1,2}\w', c): + cmd_line.append(c) else: - fail_or_error = fail - fail_or_error("Failed to build %s, see %s" % (target, build.logname)) + build_targets.append(c) + for t in build_targets: + build = Builder(log_name) + + result = build.run(cmd_line + [t]) + if result != 0: + if all_options.keep_going: + failed_targets.append(target) + fail_or_error = error + else: + fail_or_error = fail + fail_or_error("Failed to build %s, see %s" % + (target, build.logname)) # Copy the defconfig back. if all_options.configs or all_options.updateconfigs: