From 1ff5aeafd1eb3973738b4cfda023cd898d05e4c7 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Tue, 22 Feb 2022 23:30:56 +0000 Subject: [PATCH 1/2] xtensa-build-zephyr.py: don't git_submodules_update() twice A second git_submodules_update() immediately after the first one does not make sense. This looks like something leftover from a past experiment. Fixes initial commit 1de3ef367584 ("Rewritten xtensa-build-zephyr.sh to python") Signed-off-by: Marc Herbert --- scripts/xtensa-build-zephyr.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 5e2ea56a8813..3100cf6559a0 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -425,8 +425,6 @@ def run_clone_mode(): if args.platforms: build_platforms() show_installed_files() - else: - git_submodules_update() def run_point_mode(): global west_top, SOF_TOP From 2fdacfb2feceb1eb299082be9101a88a7e14c633 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Wed, 23 Feb 2022 00:41:24 +0000 Subject: [PATCH 2/2] xtensa-build-zephyr.py: de-duplicate common code De-duplicate this code: if args.platforms: build_platforms() show_installed_files() Signed-off-by: Marc Herbert --- scripts/xtensa-build-zephyr.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 3100cf6559a0..43bf0bad7eae 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -185,7 +185,7 @@ def parse_args(): if args.clone_mode and not args.z: args.z = "main" # set default name for -z if -c specified - if args.west_path: # allow user override path to zephyr project + if args.west_path: # let the user provide an already existing zephyrproject/ anywhere west_top = pathlib.Path(args.west_path) elif not args.clone_mode: # if neather -p nor -c provided, use -p args.west_path = west_top @@ -422,9 +422,6 @@ def run_clone_mode(): create_zephyr_directory() west_init_update() git_submodules_update() - if args.platforms: - build_platforms() - show_installed_files() def run_point_mode(): global west_top, SOF_TOP @@ -436,9 +433,6 @@ def run_point_mode(): raise FileNotFoundError("West topdir returned {} as workspace but it" " does not exist".format(west_workspace_path)) create_zephyr_sof_symlink() - if args.platforms: - build_platforms() - show_installed_files() def main(): parse_args() @@ -448,11 +442,17 @@ def main(): else: print("Building platforms: {}".format(" ".join(args.platforms))) - # Two mutually exclusive working modes are supported + # we made two modes mutually exclusive with argparse if args.west_path: + # check west_path input + create symlink if needed run_point_mode() if args.clone_mode: + # Initialize zephyr project with west run_clone_mode() + if args.platforms: + build_platforms() + show_installed_files() + if __name__ == "__main__": main()