From 84c8b74b2ae06c8e69a457975d97e1db5456dc6c Mon Sep 17 00:00:00 2001 From: mikee47 Date: Mon, 15 Jul 2024 06:33:37 +0100 Subject: [PATCH] Fix IDF tool installation by using exact list Double-typed 'install', and wildcard tool spec. only supported for IDF 5.2 Just provide explicit list of tools for each version --- Sming/Arch/Esp32/Tools/idf_tools-4.3.lst | 7 ++++++ Sming/Arch/Esp32/Tools/idf_tools-4.4.lst | 8 ++++++ Sming/Arch/Esp32/Tools/idf_tools-5.0.lst | 9 +++++++ Sming/Arch/Esp32/Tools/idf_tools-5.2.lst | 7 ++++++ Sming/Arch/Esp32/Tools/install.cmd | 17 +++++++------ Sming/Arch/Esp32/Tools/install.sh | 32 +++++++++++++----------- 6 files changed, 58 insertions(+), 22 deletions(-) create mode 100644 Sming/Arch/Esp32/Tools/idf_tools-4.3.lst create mode 100644 Sming/Arch/Esp32/Tools/idf_tools-4.4.lst create mode 100644 Sming/Arch/Esp32/Tools/idf_tools-5.0.lst create mode 100644 Sming/Arch/Esp32/Tools/idf_tools-5.2.lst diff --git a/Sming/Arch/Esp32/Tools/idf_tools-4.3.lst b/Sming/Arch/Esp32/Tools/idf_tools-4.3.lst new file mode 100644 index 0000000000..8b49fd1b38 --- /dev/null +++ b/Sming/Arch/Esp32/Tools/idf_tools-4.3.lst @@ -0,0 +1,7 @@ +xtensa-esp32-elf +xtensa-esp32s2-elf +xtensa-esp32s3-elf +riscv32-esp-elf +esp32ulp-elf +esp32s2ulp-elf +openocd-esp32 diff --git a/Sming/Arch/Esp32/Tools/idf_tools-4.4.lst b/Sming/Arch/Esp32/Tools/idf_tools-4.4.lst new file mode 100644 index 0000000000..d0ea4bf7b2 --- /dev/null +++ b/Sming/Arch/Esp32/Tools/idf_tools-4.4.lst @@ -0,0 +1,8 @@ +xtensa-esp32-elf +xtensa-esp32s2-elf +xtensa-esp32s3-elf +riscv32-esp-elf +esp32ulp-elf +xtensa-esp-elf-gdb +riscv32-esp-elf-gdb +openocd-esp32 diff --git a/Sming/Arch/Esp32/Tools/idf_tools-5.0.lst b/Sming/Arch/Esp32/Tools/idf_tools-5.0.lst new file mode 100644 index 0000000000..33c5dcb00b --- /dev/null +++ b/Sming/Arch/Esp32/Tools/idf_tools-5.0.lst @@ -0,0 +1,9 @@ +xtensa-esp-elf-gdb +riscv32-esp-elf-gdb +xtensa-esp32-elf +xtensa-esp32s2-elf +xtensa-esp32s3-elf +riscv32-esp-elf +esp32ulp-elf +esp-rom-elfs +openocd-esp32 diff --git a/Sming/Arch/Esp32/Tools/idf_tools-5.2.lst b/Sming/Arch/Esp32/Tools/idf_tools-5.2.lst new file mode 100644 index 0000000000..e121b28480 --- /dev/null +++ b/Sming/Arch/Esp32/Tools/idf_tools-5.2.lst @@ -0,0 +1,7 @@ +xtensa-esp-elf-gdb +riscv32-esp-elf-gdb +xtensa-esp-elf +riscv32-esp-elf +esp32ulp-elf +esp-rom-elfs +openocd-esp32 diff --git a/Sming/Arch/Esp32/Tools/install.cmd b/Sming/Arch/Esp32/Tools/install.cmd index 552d43b9e6..8e8b5b42c6 100644 --- a/Sming/Arch/Esp32/Tools/install.cmd +++ b/Sming/Arch/Esp32/Tools/install.cmd @@ -45,18 +45,21 @@ goto :setup if exist "%IDF_PATH%" rmdir /q %IDF_PATH% mklink /j %IDF_PATH% %IDF_CLONE_PATH% -if "%CI_BUILD_DIR%"=="" ( -set IDF_TOOL_PACKAGES=*openocd* -) else ( - REM Skip installation for CI if already present +REM Install IDF tools and packages (unless CI has restored from cache) +if "%CI_BUILD_DIR%" NEQ "" ( if exist "%IDF_TOOLS_PATH%\tools" ( + echo Skipping IDF tools installation, "%IDF_TOOLS_PATH%\tools" exists goto :EOF ) ) -REM Install IDF tools and packages -python "%IDF_PATH%\tools\idf_tools.py" --non-interactive install install "*elf*" %IDF_TOOL_PACKAGES% -python "%IDF_PATH%\tools\idf_tools.py" --non-interactive install-python-env +REM Be specific about which tools we want to install for each IDF version +tr '\n' ' ' < "%~dp0idf_tools-%INSTALL_IDF_VER%.lst" > toolver.txt || goto :EOF +for /f "tokens=*" %%x in (toolver.txt) do set IDF_TOOL_PACKAGES=%%x +del toolver.txt +echo Install: %IDF_TOOL_PACKAGES% +python "%IDF_PATH%\tools\idf_tools.py" --non-interactive install %IDF_TOOL_PACKAGES% || goto :EOF +python "%IDF_PATH%\tools\idf_tools.py" --non-interactive install-python-env || goto :EOF if "%CI_BUILD_DIR%" NEQ "" ( del /q "%IDF_TOOLS_PATH%\dist\*" diff --git a/Sming/Arch/Esp32/Tools/install.sh b/Sming/Arch/Esp32/Tools/install.sh index 11a216ef36..0a872db39d 100755 --- a/Sming/Arch/Esp32/Tools/install.sh +++ b/Sming/Arch/Esp32/Tools/install.sh @@ -61,22 +61,24 @@ rm -f "$IDF_PATH" ln -s "$IDF_CLONE_PATH" "$IDF_PATH" -# Skip installation for CI if already present -if [ -z "$CI_BUILD_DIR" ] || [ ! -d "$IDF_TOOLS_PATH/tools" ]; then - -# Install IDF tools and packages -python3 "$IDF_PATH/tools/idf_tools.py" --non-interactive install "*elf*" -if [ -n "$VIRTUAL_ENV" ]; then - unset VIRTUAL_ENV - unset VIRTUAL_ENV_PROMPT - export PATH="${PATH/$VIRTUAL_ENV\/bin:/}" -fi -python3 "$IDF_PATH/tools/idf_tools.py" --non-interactive install-python-env +# Install IDF tools and packages (unless CI has restored from cache) +if [ -n "$CI_BUILD_DIR" ] && [ -d "$IDF_TOOLS_PATH/tools" ]; then + printf "\n\n** Skipping IDF tools installation: '%s/tools' exists\n\n" "$IDF_TOOLS_PATH" +else + # Be specific about which tools we want to install for each IDF version + IDF_TOOL_PACKAGES=$(tr '\n' ' ' < "$SMING_HOME/Arch/Esp32/Tools/idf_tools-${INSTALL_IDF_VER}.lst") + echo "Install: $IDF_TOOL_PACKAGES" + python3 "$IDF_PATH/tools/idf_tools.py" --non-interactive install $IDF_TOOL_PACKAGES + if [ -n "$VIRTUAL_ENV" ]; then + unset VIRTUAL_ENV + unset VIRTUAL_ENV_PROMPT + export PATH="${PATH/$VIRTUAL_ENV\/bin:/}" + fi + python3 "$IDF_PATH/tools/idf_tools.py" --non-interactive install-python-env -if [ -z "$KEEP_DOWNLOADS" ]; then - rm -rf "$IDF_TOOLS_PATH/dist" + if [ -z "$KEEP_DOWNLOADS" ]; then + rm -rf "$IDF_TOOLS_PATH/dist" + fi fi -fi # CI install - fi