From 18c44e6cee33d524c0c1621ed53241853854ba69 Mon Sep 17 00:00:00 2001 From: guotong ma Date: Mon, 25 Dec 2023 14:01:07 +0800 Subject: [PATCH] [ci][attachconfig] remove some output --- tools/ci/bsp_buildings.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/tools/ci/bsp_buildings.py b/tools/ci/bsp_buildings.py index 825f05815d..01222a7466 100644 --- a/tools/ci/bsp_buildings.py +++ b/tools/ci/bsp_buildings.py @@ -12,18 +12,28 @@ def add_summary(text): os.system(f'echo "{text}" >> $GITHUB_STEP_SUMMARY ;') -def run_cmd(cmd): +def run_cmd(cmd, output_info=True): """ run command and return output and result. """ print('\033[1;32m' + cmd + '\033[0m') - res = os.system(cmd + " > output.txt 2>&1") + + output_str_list = [] + + if output_info: + res = os.system(cmd + " > output.txt 2>&1") + else: + res = os.system(cmd + " > /dev/null 2>output.txt") + with open("output.txt", "r") as file: - output = file.readlines() - for line in output: + output_str_list = file.readlines() + + for line in output_str_list: print(line, end='') + os.remove("output.txt") - return output, res + + return output_str_list, res def build_bsp(bsp): @@ -31,7 +41,7 @@ def build_bsp(bsp): build bsp. cd {rtt_root} - scons -C bsp/{bsp} --pyconfig-silent + scons -C bsp/{bsp} --pyconfig-silent > /dev/null cd {rtt_root}/bsp/{bsp} pkgs --update @@ -41,7 +51,7 @@ def build_bsp(bsp): scons -C bsp/{bsp} -j{nproc} --debug=time cd {rtt_root}/bsp/{bsp} - scons -c + scons -c > /dev/null rm -rf packages """ @@ -49,7 +59,7 @@ def build_bsp(bsp): os.chdir(rtt_root) if os.path.exists(f"{rtt_root}/bsp/{bsp}/Kconfig"): os.chdir(rtt_root) - run_cmd(f'scons -C bsp/{bsp} --pyconfig-silent') + run_cmd(f'scons -C bsp/{bsp} --pyconfig-silent', output_info=False) os.chdir(f'{rtt_root}/bsp/{bsp}') run_cmd('pkgs --update') @@ -63,7 +73,7 @@ def build_bsp(bsp): success = False os.chdir(f'{rtt_root}/bsp/{bsp}') - run_cmd('scons -c') + run_cmd('scons -c', output_info=False) pkg_dir = os.path.join(rtt_root, 'bsp', bsp, 'packages') shutil.rmtree(pkg_dir, ignore_errors=True)