-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vcpkg] Add feature option 'withMirror' ⚡ #12532
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
@@ -12,134 +12,6 @@ | |||
|
|||
namespace vcpkg::Downloads | |||
{ | |||
#if defined(_WIN32) | |||
static void winhttp_download_file(Files::Filesystem& fs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should do something reasonable in the vcpkg_download_distfile_SKIP_SHA512
case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without SHA512, vcpkg_download_distfile
cannot splice the download URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -154,6 +154,10 @@ namespace vcpkg | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -154,6 +154,10 @@ namespace vcpkg | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, this should arguably be moved into download_file() so that every case across vcpkg uses it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_URL
to mirror address, example:139.196.94.253
.To download all ports to mirror machine:
Thanks @ras0219-msft for the advice.
Closes #11040