ci(tools): Fix IDF_MIRROR_PREFIX_MAP for including all tools from local

This commit is contained in:
Roland Dobai 2024-04-25 11:13:52 +02:00
parent 13effc7f23
commit 6f6706cb8e
3 changed files with 12 additions and 9 deletions

View File

@ -133,7 +133,7 @@ test_cli_installer:
script:
# Tools must be downloaded for testing
# We could use "idf_tools.py download all", but we don't want to install clang because of its huge size
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
- cd ${IDF_PATH}/tools/test_idf_tools
- python3 -m pip install jsonschema
- python3 ./test_idf_tools.py -v

View File

@ -31,7 +31,7 @@ test_cli_installer_win:
IDF_PATH: "$CI_PROJECT_DIR"
script:
# Tools must be downloaded for testing
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
- cd ${IDF_PATH}\tools\test_idf_tools
- python -m pip install jsonschema
- python .\test_idf_tools.py

View File

@ -118,14 +118,17 @@ class TestUsageBase(unittest.TestCase):
old_tools_dir = os.environ.get('IDF_TOOLS_PATH') or os.path.expanduser(idf_tools.IDF_TOOLS_PATH_DEFAULT)
mirror_prefix_map = None
if os.path.exists(old_tools_dir):
mirror_prefix_map = 'https://dl.espressif.com/dl/toolchains/preview,file:' + os.path.join(old_tools_dir,
'dist')
mirror_prefix_map += ';https://dl.espressif.com/dl,file:' + os.path.join(old_tools_dir, 'dist')
mirror_prefix_map += ';https://github.com/espressif/.*/releases/download/.*/,file:' + os.path.join(
old_tools_dir, 'dist', '')
if os.path.exists(old_tools_dir) and sys.platform != 'win32':
# These are are all mapping to filesystem. Windows cannot download from there not even if file:// is omitted
local = ''.join(['file://', os.path.join(old_tools_dir, 'dist', '')])
mirror_prefix_map = ';'.join([f'https://dl.espressif.com/dl,{local}',
f'https://github.com/.*/.*/releases/download/.*/,{local}'])
# Windows will keep downloading the tools from default location or IDF_MIRROR_PREFIX_MAP if set globally
if mirror_prefix_map:
print('Using IDF_MIRROR_PREFIX_MAP={}'.format(mirror_prefix_map))
print(f'Using IDF_MIRROR_PREFIX_MAP={mirror_prefix_map}')
os.environ['IDF_MIRROR_PREFIX_MAP'] = mirror_prefix_map
cls.temp_tools_dir = tempfile.mkdtemp(prefix='idf_tools_tmp')