From c8583b4ba581e3acd9dedd01f06e58092cf0c46b Mon Sep 17 00:00:00 2001 From: Mengwei Liu Date: Wed, 5 Feb 2025 12:34:21 -0800 Subject: [PATCH] Update on "[BE] Remind users to update submodule" Summary: Fixing #7243 As titled. This PR adds 2 things: 1. `check_and_update_submodule()` check if required submodule folders exist and at least contains a CMakeLists.txt file. 2. Give useful error when the submodule is corrupted (most likely missing a file, caused by submodule out of sync). Test Plan: 1. Test if we can still install, if submodule is not updated ``` rm -rf third-party/prelude ./install_executorch.sh ``` See the following log ``` ... Processing /data/users/larryliu/executorch Preparing metadata (pyproject.toml): started Running command Preparing metadata (pyproject.toml) 2025-02-05 11:28:46,430 [ExecuTorch] WARNING: Some required submodules are missing. Updating submodules... Submodule path 'third-party/prelude': checked out '851d3f09c452937fc5adef27e2c50f7f304f1646' 2025-02-05 11:28:46,748 [ExecuTorch] INFO: All required submodules are present. 2025-02-05 11:28:47,018 [ExecuTorch] INFO: running dist_info ... ``` This proves that we can update submodule for the user. 2. Test if we can give useful error message, if we are missing a file. ``` rm third-party/gflags/src/gflags.cc ./install_executorch.sh --clean ./install_executorch.sh ``` See the following error: ``` 2025-02-05 12:08:56,889 [ExecuTorch] ERROR: Failed to query buck for sources. Failed command: buck2 cquery inputs(deps('//runtime/executor:program')) This is likely due to missing git submodules or outdated CMake cache. Please run the following before retry: ./install_executorch.sh --clean git submodule update --init --recursive ``` Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D69156975](https://our.internmc.facebook.com/intern/diff/D69156975) [ghstack-poisoned] --- build/extract_sources.py | 3 ++- setup.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build/extract_sources.py b/build/extract_sources.py index b7fe1b4fd1..5af0904fdf 100755 --- a/build/extract_sources.py +++ b/build/extract_sources.py @@ -138,7 +138,8 @@ def get_sources( "to missing git submodules or outdated CMake cache. " "Please run the following before retry:\033[0m\n\n" " \033[32;1m./install_executorch.sh --clean\033[0m\n" - " \033[32;1mgit submodule update --init --recursive\033[0m\n" + " \033[32;1mgit submodule sync\033[0m\n" + " \033[32;1mgit submodule update --init\033[0m\n" ) raise e diff --git a/setup.py b/setup.py index 8e336dccc4..0abe8117d0 100644 --- a/setup.py +++ b/setup.py @@ -740,7 +740,8 @@ def run(self): "\033[31;1mEither CMake cache is outdated or git submodules are not synced.\n" "Please run the following before retry:\033[0m\n" " \033[32;1m./install_executorch.sh --clean\033[0m\n" - " \033[32;1mgit submodule update --init --recursive\033[0m\n" + " \033[32;1mgit submodule sync\033[0m\n" + " \033[32;1mgit submodule update --init\033[0m\n" ) raise Exception(error + "\n" + additional_log) from e