Tools: added --stop option to configure_all.py
This commit is contained in:
parent
467e8481fb
commit
3d7c6fea78
@ -14,11 +14,14 @@ import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(description='configure all ChibiOS boards')
|
||||
parser.add_argument('--build', action='store_true', default=False, help='build as well as configure')
|
||||
parser.add_argument('--stop', action='store_true', default=False, help='stop on build fail')
|
||||
parser.add_argument('--pattern', default='*')
|
||||
args = parser.parse_args()
|
||||
|
||||
os.environ['PYTHONUNBUFFERED'] = '1'
|
||||
|
||||
failures = []
|
||||
|
||||
def get_board_list():
|
||||
'''add boards based on existance of hwdef-bl.dat in subdirectories for ChibiOS'''
|
||||
board_list = []
|
||||
@ -29,24 +32,35 @@ def get_board_list():
|
||||
board_list.append(d)
|
||||
return board_list
|
||||
|
||||
def run_program(cmd_list):
|
||||
def run_program(cmd_list, build):
|
||||
print("Running (%s)" % " ".join(cmd_list))
|
||||
retcode = subprocess.call(cmd_list)
|
||||
if retcode != 0:
|
||||
print("Build failed: %s" % ' '.join(cmd_list))
|
||||
sys.exit(1)
|
||||
print("Build failed: %s %s" % (build, ' '.join(cmd_list)))
|
||||
global failures
|
||||
failures.append(build)
|
||||
if args.stop:
|
||||
sys.exit(1)
|
||||
|
||||
for board in get_board_list():
|
||||
if not fnmatch.fnmatch(board, args.pattern):
|
||||
continue
|
||||
print("Configuring for %s" % board)
|
||||
run_program(["./waf", "configure", "--board", board])
|
||||
run_program(["./waf", "configure", "--board", board], "configure: " + board)
|
||||
if args.build:
|
||||
run_program(["./waf", "copter"])
|
||||
run_program(["./waf", "copter"], "build: " + board)
|
||||
# check for bootloader def
|
||||
hwdef_bl = os.path.join('libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef-bl.dat' % board)
|
||||
if os.path.exists(hwdef_bl):
|
||||
print("Configuring bootloader for %s" % board)
|
||||
run_program(["./waf", "configure", "--board", board, "--bootloader"])
|
||||
run_program(["./waf", "configure", "--board", board, "--bootloader"], "configure: " + board + "-bl")
|
||||
if args.build:
|
||||
run_program(["./waf", "bootloader"])
|
||||
run_program(["./waf", "bootloader"], "build: " + board + "-bl")
|
||||
|
||||
if len(failures) > 0:
|
||||
print("Failed builds:")
|
||||
for f in failures:
|
||||
print(' ' + f)
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
||||
|
Loading…
Reference in New Issue
Block a user