diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-05-24 15:32:24 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-05-24 15:32:24 -0400 |
| commit | 4e85c1ef91683929df0afe105e92ce6e4291b445 (patch) | |
| tree | 23a62c425622c0f64d99ff0caff88f20b7461c86 /tools | |
| parent | e84f3b1c6a4a4fde58842d85d002b8964a4e74ad (diff) | |
Implement forced clean builds for boards so designated.
Mark boards that set CFLAGS_INLINE_LIMIT for particular langauges as needing clean builds.
Fixes #1910.
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/build_release_files.py | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/tools/build_release_files.py b/tools/build_release_files.py index 872302a4f..e29b098c7 100755 --- a/tools/build_release_files.py +++ b/tools/build_release_files.py @@ -1,3 +1,5 @@ +#! /usr/bin/env python3 + import os import sys import subprocess @@ -6,7 +8,7 @@ import build_board_info as build_info import time for port in build_info.SUPPORTED_PORTS: - result = subprocess.run("rm -rf ../ports/{}/build*".format(port), shell=True) + result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True) ROSIE_SETUPS = ["rosie-ci"] rosie_ok = {} @@ -37,7 +39,25 @@ for board in build_boards: bin_directory = "../bin/{board}/{language}".format(board=board, language=language) os.makedirs(bin_directory, exist_ok=True) start_time = time.monotonic() - make_result = subprocess.run("make -C ../ports/" + board_info["port"] + " TRANSLATION=" + language + " BOARD=" + board, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + + # Normally different language builds are all done based on the same set of compiled sources. + # But sometimes a particular language needs to be built from scratch, if, for instance, + # CFLAGS_INLINE_LIMIT is set for a particular language to make it fit. + clean_build_check_result = subprocess.run( + "make -C ../ports/{port} TRANSLATION={language} BOARD={board} check-release-needs-clean-build | fgrep 'RELEASE_NEEDS_CLEAN_BUILD = 1'".format( + port = board_info["port"], language=language, board=board), + shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + clean_build = clean_build_check_result.returncode == 0 + + build_dir = "build-{board}".format(board=board) + if clean_build: + build_dir += "-{language}".format(language=language) + + make_result = subprocess.run( + "make -C ../ports/{port} TRANSLATION={language} BOARD={board} BUILD={build}".format( + port = board_info["port"], language=language, board=board, build=build_dir), + shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + build_duration = time.monotonic() - start_time success = "\033[32msucceeded\033[0m" if make_result.returncode != 0: @@ -47,11 +67,14 @@ for board in build_boards: other_output = "" for extension in board_info["extensions"]: - temp_filename = "../ports/{port}/build-{board}/firmware.{extension}".format(port=board_info["port"], board=board, extension=extension) + temp_filename = "../ports/{port}/{build}/firmware.{extension}".format( + port=board_info["port"], build=build_dir, extension=extension) for alias in board_info["aliases"] + [board]: - bin_directory = "../bin/{alias}/{language}".format(alias=alias, language=language) + bin_directory = "../bin/{alias}/{language}".format( + alias=alias, language=language) os.makedirs(bin_directory, exist_ok=True) - final_filename = "adafruit-circuitpython-{alias}-{language}-{version}.{extension}".format(alias=alias, language=language, version=version, extension=extension) + final_filename = "adafruit-circuitpython-{alias}-{language}-{version}.{extension}".format( + alias=alias, language=language, version=version, extension=extension) final_filename = os.path.join(bin_directory, final_filename) try: shutil.copyfile(temp_filename, final_filename) @@ -62,7 +85,9 @@ for board in build_boards: if travis: print('travis_fold:start:adafruit-bins-{}-{}\\r'.format(language, board)) - print("Build {} for {} took {:.2f}s and {}".format(board, language, build_duration, success)) + print("Build {board} for {language}{clean_build} took {build_duration:.2f}s and {success}".format( + board=board, language=language, clean_build=(" (clean_build)" if clean_build else ""), + build_duration=build_duration, success=success)) if make_result.returncode != 0: print(make_result.stdout.decode("utf-8")) print(other_output) |
