Skip to content

Commit

Permalink
Fix IDF tool installation by using exact list
Browse files Browse the repository at this point in the history
Double-typed 'install', and wildcard tool spec. only supported for IDF 5.2
Just provide explicit list of tools for each version
  • Loading branch information
mikee47 committed Jul 15, 2024
1 parent fd165a5 commit 84c8b74
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 22 deletions.
7 changes: 7 additions & 0 deletions Sming/Arch/Esp32/Tools/idf_tools-4.3.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
xtensa-esp32-elf
xtensa-esp32s2-elf
xtensa-esp32s3-elf
riscv32-esp-elf
esp32ulp-elf
esp32s2ulp-elf
openocd-esp32
8 changes: 8 additions & 0 deletions Sming/Arch/Esp32/Tools/idf_tools-4.4.lst
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions Sming/Arch/Esp32/Tools/idf_tools-5.0.lst
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions Sming/Arch/Esp32/Tools/idf_tools-5.2.lst
Original file line number Diff line number Diff line change
@@ -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
17 changes: 10 additions & 7 deletions Sming/Arch/Esp32/Tools/install.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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\*"
Expand Down
32 changes: 17 additions & 15 deletions Sming/Arch/Esp32/Tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 84c8b74

Please sign in to comment.