summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorvacabun <[email protected]>2024-01-09 22:03:32 +0800
committerGitHub <[email protected]>2024-01-09 22:03:32 +0800
commitacaa23052f2d24de5cc5c389014ed8a8513e7311 (patch)
tree9d358b4275f5964e31d62b3a38e19df3d62de466 /tools
parent48244f25f88c72907119f9778789bb3c773d8b52 (diff)
[ci][bsp_build]attachconfig add scons args parsing (#8464)
Diffstat (limited to 'tools')
-rw-r--r--tools/ci/bsp_buildings.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/tools/ci/bsp_buildings.py b/tools/ci/bsp_buildings.py
index 8ffd2d9849..ab731c5cad 100644
--- a/tools/ci/bsp_buildings.py
+++ b/tools/ci/bsp_buildings.py
@@ -1,5 +1,6 @@
import os
import shutil
+import re
import multiprocessing
@@ -17,6 +18,7 @@ def run_cmd(cmd, output_info=True):
print('\033[1;32m' + cmd + '\033[0m')
output_str_list = []
+ res = 0
if output_info:
res = os.system(cmd + " > output.txt 2>&1")
@@ -34,7 +36,7 @@ def run_cmd(cmd, output_info=True):
return output_str_list, res
-def build_bsp(bsp):
+def build_bsp(bsp, scons_args=''):
"""
build bsp.
@@ -46,7 +48,7 @@ def build_bsp(bsp):
pkgs --list
cd {rtt_root}
- scons -C bsp/{bsp} -j{nproc}
+ scons -C bsp/{bsp} -j{nproc} {scons_args}
cd {rtt_root}/bsp/{bsp}
scons -c > /dev/null
@@ -65,7 +67,8 @@ def build_bsp(bsp):
nproc = multiprocessing.cpu_count()
os.chdir(rtt_root)
- __, res = run_cmd(f'scons -C bsp/{bsp} -j{nproc}', output_info=False)
+ cmd = f'scons -C bsp/{bsp} -j{nproc} {scons_args}'
+ __, res = run_cmd(cmd, output_info=False)
if res != 0:
success = False
@@ -89,6 +92,16 @@ def append_file(source_file, destination_file):
destination.write(line)
+def check_scons_args(file_path):
+ args = []
+ with open(file_path, 'r') as file:
+ for line in file:
+ match = re.search(r'#\s*scons:\s*(.*)', line)
+ if match:
+ args.append(match.group(1).strip())
+ return ' '.join(args)
+
+
def build_bsp_attachconfig(bsp, attach_file):
"""
build bsp with attach config.
@@ -111,7 +124,9 @@ def build_bsp_attachconfig(bsp, attach_file):
append_file(attach_path, config_file)
- res = build_bsp(bsp)
+ scons_args = check_scons_args(attach_path)
+
+ res = build_bsp(bsp, scons_args)
shutil.copyfile(config_bacakup, config_file)
os.remove(config_bacakup)