[vcpkg] Add feature option 'withMirror' ⚡#12532
[vcpkg] Add feature option 'withMirror' ⚡#12532JackBoosY wants to merge 48 commits intomicrosoft:masterfrom
Conversation
|
Thanks, this is great 👍 I would like to see the control being done with an environment variable and/or command line option rather than compiling it into the tool with bootstrap, because once we start doing binary releases that won't work anymore. |
…e rename to full hash value
| namespace vcpkg::Downloads | ||
| { | ||
| #if defined(_WIN32) | ||
| static void winhttp_download_file(Files::Filesystem& fs, |
There was a problem hiding this comment.
Since winhttp.h has conflict with wininet.h, I split this function into two files.
|
qt5-tools: |
|
clapack: |
@Neumann-A It seems that qt5-tools forgot to link to dxguid.lib? |
|
|
||
| if (ENV{VCPKG_EXPERIMENTAL_MIRROR_URL}) | ||
| message(STATUS "Use vcpkg mirror $ENV{VCPKG_EXPERIMENTAL_MIRROR_URL}") | ||
| set(vcpkg_download_distfile_URLS "ftp://$ENV{VCPKG_EXPERIMENTAL_MIRROR_URL}/${vcpkg_download_distfile_SHA512}") |
There was a problem hiding this comment.
This should do something reasonable in the vcpkg_download_distfile_SKIP_SHA512 case
There was a problem hiding this comment.
Without SHA512, vcpkg_download_distfile cannot splice the download URL.
BillyONeal
left a comment
There was a problem hiding this comment.
I will merge this for you after #13038 lands; they both touch a lot of the same stuff but this one is a bit smaller so merging will be less painful.
Do we have a spec for this feature? As I originally understood it this was the ability to redirect our download attempts somewhere else; this "crawl" attempt thing is something very different. I don't know if that changed from when I looked last or if I was just blind due to being delirious trying to ship jthread in STL land.
| constexpr static StringLiteral WAIT_FOR_LOCK_SWITCH = "x-wait-for-lock"; | ||
| Optional<bool> wait_for_lock = nullopt; | ||
|
|
||
| constexpr static StringLiteral VCPKG_EXPERIMENTAL_MIRROR_URL = "VCPKG_EXPERIMENTAL_MIRROR_URL"; |
There was a problem hiding this comment.
I don't think we should name the variable EXPERIMENTAL because someday it won't be and there's no reason to force everyone to edit their scripts then?
There was a problem hiding this comment.
OTOH we can continue respecting the experimental form for backwards compatibility and this makes it clear for users that they are using an unsupported feature. Alternatively, the tool could emit a big yelllow warning at the top every time it's run with this env var set.
| constexpr static StringLiteral WAIT_FOR_LOCK_SWITCH = "x-wait-for-lock"; | ||
| Optional<bool> wait_for_lock = nullopt; | ||
|
|
||
| constexpr static StringLiteral VCPKG_EXPERIMENTAL_MIRROR_URL = "VCPKG_EXPERIMENTAL_MIRROR_URL"; |
There was a problem hiding this comment.
We conventionally use lowercase here
| constexpr static StringLiteral VCPKG_EXPERIMENTAL_MIRROR_URL = "VCPKG_EXPERIMENTAL_MIRROR_URL"; | |
| constexpr static StringLiteral VCPKG_EXPERIMENTAL_MIRROR_URL = "x-mirror-url"; |
There was a problem hiding this comment.
The environment variable name is set here. Is this correct?
| if (paths.vcpkg_use_mirror) | ||
| { | ||
| url = "ftp://"; | ||
| url += paths.vcpkg_mirror_url; |
There was a problem hiding this comment.
If vcpkg_mirror_url is changed to include the protocol, this would enable https mirrors as well and generally be more robust
There was a problem hiding this comment.
Additionally, this should arguably be moved into download_file() so that every case across vcpkg uses it.
There was a problem hiding this comment.
I am currently unable to change it to https, can we make these changes later?
|
Since the source package downloaded using x-mirror will be automatically renamed to sha512 value, do we need to provide the list of downloaded source packages to the mirror maintainer? |
|
@ras0219 @ras0219-msft Please review again. |
|
@JackBoosY why this PR closed? Where this functionality exist? Thanks |
It needs to be replayed over in vcpkg-tool instead at a minimum |
|
This PR was replaced by #13639. |
This PR will add the use of mirror download address function, allow users to set the mirror address of ports and tools through parameters when building vcpkg to reduce download time.
usage:
To use vcpkg mirror:
set environment
VCPKG_EXPERIMENTAL_MIRROR_URLto mirror address, example:139.196.94.253.To download all ports to mirror machine:
Thanks @ras0219-msft for the advice.
Closes #11040