From fb26452b8db27bca2591968eae79c8f0d2b61c48 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 19 Jan 2024 08:11:59 +1100 Subject: [PATCH] Tools: added linux boards to build sizes web page --- Tools/scripts/build_sizes/build_sizes.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Tools/scripts/build_sizes/build_sizes.py b/Tools/scripts/build_sizes/build_sizes.py index d347278f17..76cbb7af74 100755 --- a/Tools/scripts/build_sizes/build_sizes.py +++ b/Tools/scripts/build_sizes/build_sizes.py @@ -23,6 +23,8 @@ args = parser.parse_args() warning_flash_free = 5000 warning_build_days = 3 +LINUX_BINARIES = ["arduplane", "arducopter", "arducopter-heli", "ardurover", "ardusub", "antennatracker"] + class APJInfo: def __init__(self, vehicle, board, githash, mtime, flash_free): @@ -34,20 +36,29 @@ class APJInfo: self.warning = 0 -def apj_list(basedir): +def firmware_list(basedir): '''list of APJInfo for one directory''' boards = [] for root, subdirs, files in os.walk(basedir): for f in files: - if not fnmatch.fnmatch(f, "*.apj"): + if not fnmatch.fnmatch(f, "*.apj") and f not in LINUX_BINARIES: continue fname = os.path.join(root, f) board = os.path.basename(root) vehicle = fname.split('/')[-4] - fw_json = json.load(open(fname, "r")) - githash = fw_json['git_identity'] - flash_free = fw_json.get('flash_free', -1) mtime = os.stat(fname).st_mtime + if f in LINUX_BINARIES: + git_version = os.path.join(root, "git-version.txt") + try: + line = open(git_version, 'r').readline() + githash = line.split()[1][:8] + except OSError: + githash = "unknown" + flash_free = 999999 + else: + fw_json = json.load(open(fname, "r")) + githash = fw_json['git_identity'] + flash_free = fw_json.get('flash_free', -1) apjinfo = APJInfo(vehicle, board, githash, mtime, flash_free) boards.append(apjinfo) return boards @@ -117,7 +128,7 @@ def write_table(h, build_type): boards = [] for build in builds: - boards.extend(apj_list(os.path.join(args.basedir, build, build_type))) + boards.extend(firmware_list(os.path.join(args.basedir, build, build_type))) max_mtime = 0 for apjinfo in boards: