espressif / idf-installer

ESP IDF Windows Installer
https://dl.espressif.com/dl/esp-idf/
102 stars 21 forks source link

installer: fetch one tag after doing a shallow clone #157

Closed igrr closed 1 year ago

igrr commented 1 year ago

When the installer downloads a release branch, creation of local IDF repository is done in two stages:

  1. Download the zip file of one of the releases on the same branch, extract it in a temporary directory.
  2. Perform git clone, using the extracted directory as reference.

In the 2nd step, we may perform "shallow" clone if such option is chosen by the user. Shallow repository doesn't contain any tags, so "git describe" will later not work correctly in the repository. In particular, IDF build system will not determine the version correctly, which can be seen in the output of the 2nd stage bootloader.

This is a partial fix to the problem. In order to make "git describe" work, we fetch one of the tags from the same release branch.

Note that this fix still doesn't solve the issue in two cases:

Possible fix for https://github.com/espressif/esp-idf/issues/10342.

TODOs

georgik commented 1 year ago

@igrr There might be one alternative solution which uses slightly more disk space than --depth 1 --shallow-submodules, but it still yields nice gain. Just replace depth, by single-branch:

--single-branch --shallow-submodules

This way there is branch name and history of the branch.

georgik commented 1 year ago

Hm, weird thing is that deployment created by Offline Installer has branch name working without problem when --depth is set to 1. The procedure is in Build-Installer.ps1. https://github.com/espressif/idf-installer/blob/main/Build-Installer.ps1#L231

georgik commented 1 year ago

@igrr The behavior of the installer was changed to use single branch when optimization is turned on. Tests indicates that the solution works.

Please test the build: https://github.com/espressif/idf-installer/releases/tag/online-2.18-beta-04

georgik commented 1 year ago

Solved by switching from --depth 1 to --single-branch when cloning repo. Please, test the latest idf-installer 2.19: https://github.com/espressif/idf-installer/releases