espressif / idf-installer

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

feat(mirror): add Jihulab as optional git repo #249

Closed leeebo closed 1 day ago

leeebo commented 2 weeks ago

This PR aims to add another git mirror for users to choose

Jihulab is a Chinese localization of Gitlab public repository,

Espressif maintained an official mirror there https://jihulab.com/esp-mirror/espressif/esp-idf,

Which has the same submodule relative paths as the Github repo.

jakub-kocka commented 1 week ago

One more thing, maybe we should have Jihulab and Gitee dependent on each other, and when one option is set the other one will not be possible to set.

leeebo commented 1 week ago

One more thing, maybe we should have Jihulab and Gitee dependent on each other, and when one option is set the other one will not be possible to set.

Yes, make sense. I want to do that, but I don't know the syntax, that's why I write else if here

Will fix it

jakub-kocka commented 1 week ago

One more thing, maybe we should have Jihulab and Gitee dependent on each other, and when one option is set the other one will not be possible to set.

Yes, make sense. I want to do that, but I don't know the syntax, that's why I write else if here

Will fix it

This should be only for summary text so it is OK to put there just if. TBH, I am unsure about the syntax as well, but if you need some help, I can dig a bit more into how to implement this.

leeebo commented 6 days ago

@jakub-kocka Now users can exclusively check or uncheck the Git Mirror like below:

English Language: image

Chinese Language: 07fb808481b20b619d8f684a446a661

I have tested it on my Windows11 PC, it works as expected, the log as bellow: Setup Log 2024-06-27 #003.txt

However, it should be noted that since the submodule of the submodule may specify the URL from github directly (like below, release/v5.3, cmock's submodules are from github), even if the user chooses Git mirror, these submodules still download from github. As suggested by @wujiangang, we may need to run a command like git config - global url.https://jihulab.com/esp-mirror.insteadOf https://github.com to fix it, then unset it after installation. @jakub-kocka @georgik what's your opinion?

image

jakub-kocka commented 4 days ago

@leeebo Nice work! Thank you for the improvements.

I agree with changing the git URL. If it may wait a bit longer we can fix this in the scope of the task with git clone fix (internal tracker IDF-10228 - it is planned for Q3) so this PR can be eventually merged.

leeebo commented 4 days ago

@jakub-kocka Comment has been added in the jira, let's wait for your fix

jakub-kocka commented 4 days ago

@jakub-kocka Comment has been added in the jira, let's wait for your fix

@leeebo, thank you.

So this PR is ready to merge, right?

dobairoland commented 1 day ago

LGTM as far as I can tell.

dobairoland commented 1 day ago

@leeebo Do you think this mirror would be useful to mention at https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup.html#step-2-get-esp-idf? We have later on that page Github mirror for downloadable tools but no alternative mentioned to cloning from Github.

jakub-kocka commented 1 day ago

Thank you @dobairoland for the review. I am merging this and will release the latest IDF version offline installer and online installer.

leeebo commented 23 hours ago

@dobairoland Thanks for your suggestions, I think finally we should mention the mirrors at https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup.html#step-2-get-esp-idf, we currently need an additional step to change the submodule's submodule URL from github to jihulab.

How about adding a new script like tools/set-submodules-to-jihulab.sh ? in esp-idf

dobairoland commented 19 hours ago

we currently need an additional step to change the submodule's submodule URL from github to jihulab.

No, I don't think that is necessary. We use relative paths here: https://github.com/espressif/esp-idf/blob/master/.gitmodules. That means that the submodules URLs will point to the same page domain the root repository was cloned from. The same way it works for our Github & Gitlab. I don't see why it wouldn't work for other mirrors as well.

leeebo commented 19 hours ago

@dobairoland For the ESP-IDF's submodules it's OK, but for submodules's submodule, eg. CMock has submodule vendor/unity and vendor/unity, which using specified URL instead of relative paths. https://github.com/ThrowTheSwitch/CMock/blob/eeecc49ce8af123cf8ad40efdb9673e37b56230f/.gitmodules

dobairoland commented 19 hours ago

Ok, I see. I wouldn't add a script to ESP-IDF which is not even needed directly by it. But I'm sure we can have such helper script in another repository.

Depending on the number of such submodules we can consider to submit PRs into them.