mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
Merge branch 'feature/idf_tools_github_mirror_v4.0' into 'release/v4.0'
Add GitHub mirror option for IDF tools installs (v4.0) See merge request espressif/esp-idf!13767
This commit is contained in:
@@ -185,6 +185,35 @@ Linux and macOS
|
||||
cd ~/esp/esp-idf
|
||||
./install.sh
|
||||
|
||||
Alternative File Downloads
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The tools installer downloads a number of files attached to GitHub Releases. If accessing GitHub is slow then it is possible to set an environment variable to prefer Espressif's download server for GitHub asset downloads.
|
||||
|
||||
.. note:: This setting only controls individual tools downloaded from GitHub releases, it doesn't change the URLs used to access any Git repositories.
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
||||
To prefer the Espressif download server when running the ESP-IDF Tools Installer or installing tools from the command line, open the System control panel, then click on Advanced Settings. Add a new Environment Variable (of type either User or System) with the name ``IDF_GITHUB_ASSETS`` and value ``dl.espressif.com/github_assets``. Click OK once done.
|
||||
|
||||
If the command line window or ESP-IDF Tools Installer window was already open before you added the new environment variable, you will need to close and reopen it.
|
||||
|
||||
While this environment variable is still set, the ESP-IDF Tools Installer and the command line installer will prefer the Espressif download server.
|
||||
|
||||
.. Once the ESP-IDF Tools Installer binary is updated to include the checkbox, the above can be rewritten to refer to it
|
||||
|
||||
Linux and macOS
|
||||
---------------
|
||||
|
||||
To prefer the Espressif download server when installing tools, use the following sequence of commands when running ``install.sh``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd ~/esp/esp-idf
|
||||
export IDF_GITHUB_ASSETS="dl.espressif.com/github_assets"
|
||||
./install.sh
|
||||
|
||||
Customizing the tools installation path
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@@ -185,6 +185,37 @@ Linux 和 macOS 操作系统
|
||||
cd ~/esp/esp-idf
|
||||
./install.sh
|
||||
|
||||
|
||||
下载工具备选方案
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
ESP-IDF 工具安装器会下载 Github 发布版本中附带的一些工具,如果访问 Github 较为缓慢,则可以设置一个环境变量,实现优先选择 Espressif 的下载服务器进行 Github 资源下载。
|
||||
|
||||
.. 注解:: 该设置只影响从 Github 发布版本中下载的单个工具,它并不会改变访问任何 Git 仓库的 URL。
|
||||
|
||||
Windows 操作系统
|
||||
-----------------
|
||||
|
||||
如果希望在运行 ESP-IDF 工具安装器或在使用命令行安装工具时优先选择 Espressif 下载服务器,可通过以下方式设置:打开系统控制面板,然后点击高级设置,添加一个新的环境变量(类型为用户或系统都可以,名称为 ``IDF_GITHUB_ASSETS``,值为 ``dl.espressif.com/github_assets``),最后点击确定。
|
||||
|
||||
如果在添加新的环境变量前命令行窗口或 ESP-IDF 工具安装器窗口已经打开,请关闭这些窗口后重新打开。
|
||||
|
||||
当设置好这个新的环境变量后,ESP-IDF 工具安装器以及命令行安装程序将会优先选择 Espressif 下载服务器。
|
||||
|
||||
.. 在 ESP-IDF 工具安装器的二进制文件更新后(导入复选框),这段需要重新更新
|
||||
|
||||
Linux 和 macOS 操作系统
|
||||
--------------------------
|
||||
|
||||
要在安装工具时优先选择 Espressif 下载服务器,请在运行 ``install.sh`` 时使用以下命令:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd ~/esp/esp-idf
|
||||
export IDF_GITHUB_ASSETS="dl.espressif.com/github_assets"
|
||||
./install.sh
|
||||
|
||||
|
||||
自定义工具安装路径
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@@ -1056,6 +1056,11 @@ def action_export(args):
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
def apply_url_mirrors(args, tool_download_obj):
|
||||
apply_mirror_prefix_map(args, tool_download_obj)
|
||||
apply_github_assets_option(tool_download_obj)
|
||||
|
||||
|
||||
def apply_mirror_prefix_map(args, tool_download_obj):
|
||||
"""Rewrite URL for given tool_obj, given tool_version, and current platform,
|
||||
if --mirror-prefix-map flag or IDF_MIRROR_PREFIX_MAP environment variable is given.
|
||||
@@ -1083,6 +1088,32 @@ def apply_mirror_prefix_map(args, tool_download_obj):
|
||||
break
|
||||
|
||||
|
||||
def apply_github_assets_option(tool_download_obj):
|
||||
""" Rewrite URL for given tool_obj if the download URL is an https://github.com/ URL and the variable
|
||||
IDF_GITHUB_ASSETS is set. The github.com part of the URL will be replaced.
|
||||
"""
|
||||
try:
|
||||
github_assets = os.environ["IDF_GITHUB_ASSETS"].strip()
|
||||
except KeyError:
|
||||
return # no IDF_GITHUB_ASSETS
|
||||
if not github_assets: # variable exists but is empty
|
||||
return
|
||||
|
||||
# check no URL qualifier in the mirror URL
|
||||
if '://' in github_assets:
|
||||
fatal("IDF_GITHUB_ASSETS shouldn't include any URL qualifier, https:// is assumed")
|
||||
raise SystemExit(1)
|
||||
|
||||
# Strip any trailing / from the mirror URL
|
||||
github_assets = github_assets.rstrip('/')
|
||||
|
||||
old_url = tool_download_obj.url
|
||||
new_url = re.sub(r'^https://github.com/', 'https://{}/'.format(github_assets), old_url)
|
||||
if new_url != old_url:
|
||||
info('Using GitHub assets mirror for URL: {} => {}'.format(old_url, new_url))
|
||||
tool_download_obj.url = new_url
|
||||
|
||||
|
||||
def action_download(args):
|
||||
tools_info = load_tools_info()
|
||||
tools_spec = args.tools
|
||||
@@ -1125,7 +1156,7 @@ def action_download(args):
|
||||
tool_spec = '{}@{}'.format(tool_name, tool_version)
|
||||
|
||||
info('Downloading {}'.format(tool_spec))
|
||||
apply_mirror_prefix_map(args, tool_obj.versions[tool_version].get_download_for_platform(platform))
|
||||
apply_url_mirrors(args, tool_obj.versions[tool_version].get_download_for_platform(platform))
|
||||
|
||||
tool_obj.download(tool_version)
|
||||
|
||||
@@ -1166,7 +1197,7 @@ def action_install(args):
|
||||
continue
|
||||
|
||||
info('Installing {}'.format(tool_spec))
|
||||
apply_mirror_prefix_map(args, tool_obj.versions[tool_version].get_download_for_platform(PYTHON_PLATFORM))
|
||||
apply_url_mirrors(args, tool_obj.versions[tool_version].get_download_for_platform(PYTHON_PLATFORM))
|
||||
|
||||
tool_obj.download(tool_version)
|
||||
tool_obj.install(tool_version)
|
||||
|
@@ -24,34 +24,34 @@
|
||||
"linux-amd64": {
|
||||
"sha256": "674080a12f9c5ebe5a3a5ce51c6deaeffe6dfb06d6416233df86f25b574e9279",
|
||||
"size": 85731226,
|
||||
"url": "https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz"
|
||||
"url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2020r3/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz"
|
||||
},
|
||||
"linux-armel": {
|
||||
"sha256": "6771e011dffa2438ef84ff3474538b4a69df8f9d4cfae3b3707ca31c782ed7db",
|
||||
"size": 83888892,
|
||||
"url": "https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-armel.tar.gz"
|
||||
"url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2020r3/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-armel.tar.gz"
|
||||
},
|
||||
"linux-i686": {
|
||||
"sha256": "076b7e05304e26aa6ec105c9e0dc74addca079bc2cae6e42ee7575c5ded29877",
|
||||
"size": 87715092,
|
||||
"url": "https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-i686.tar.gz"
|
||||
"url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2020r3/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-i686.tar.gz"
|
||||
},
|
||||
"macos": {
|
||||
"sha256": "6845f786303b26c4a55ede57487ba65bd25737232fe6104be03f25bb62f4631c",
|
||||
"size": 92424226,
|
||||
"url": "https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-macos.tar.gz"
|
||||
"url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2020r3/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-macos.tar.gz"
|
||||
},
|
||||
"name": "esp-2020r3-8.4.0",
|
||||
"status": "recommended",
|
||||
"win32": {
|
||||
"sha256": "81cecd5493a3fcf2118977f3fd60bd0a13a4aeac8fe6760d912f96d2c34fab66",
|
||||
"size": 104226379,
|
||||
"url": "https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-win32.zip"
|
||||
"url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2020r3/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-win32.zip"
|
||||
},
|
||||
"win64": {
|
||||
"sha256": "58419852fefb7111fdec056ac2fd7c4bd09c1f4c17610a761a97b788413527cf",
|
||||
"size": 106855139,
|
||||
"url": "https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-win64.zip"
|
||||
"url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2020r3/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-win64.zip"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@@ -54,7 +54,7 @@ begin
|
||||
if IDFZIPFileVersion <> '' then
|
||||
begin
|
||||
Url := 'https://github.com/espressif/esp-idf/releases/download/' + IDFZIPFileVersion + '/esp-idf-' + IDFZIPFileVersion + '.zip';
|
||||
MirrorUrl := 'https://dl.espressif.com/dl/esp-idf/releases/esp-idf-' + IDFZIPFileVersion + '.zip';
|
||||
MirrorUrl := 'https://dl.espressif.com/github_assets/espressif/esp-idf/releases/download/' + IDFZIPFileVersion + '/esp-idf-' + IDFZIPFileVersion + '.zip';
|
||||
IDFZIPFileName := ExpandConstant('{app}\releases\esp-idf-' + IDFZIPFileVersion + '.zip')
|
||||
if not FileExists(IDFZIPFileName) then
|
||||
begin
|
||||
|
Reference in New Issue
Block a user