microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.79k stars 6.29k forks source link

User can't turn off vcpkgDownloadTool without modifying source #40613

Closed charlieok closed 2 weeks ago

charlieok commented 2 weeks ago

Describe the bug In scripts/bootstrap.sh, the variable vcpkgDownloadTool is set to "ON". No method is given for a user running the script to turn it "OFF". This value is then checked, and if it is "ON", a download is attempted.

This does not serve users in airgapped environments well, where downloads will be unavailable and attempts to connect to the public internet are unwanted. (This also applies in scenarios where software builds are isolated for reasons like reproducibility or supply chain security.)

What would help is an option, settable via environment variable or command line flag, to explicitly disable downloads, so that this script won't need to be patched or otherwise worked around in an airgapped setting.

Environment

To Reproduce Steps to reproduce the behavior:

  1. in an environment without network connectivity
  2. cd to project root
  3. ./bootstrap-vcpkg.sh (with environment variable or option to disable downloads set)

Expected behavior No connections to public internet should be attempted. Or at least, scripts/bootstrap.sh should not attempt to download artifacts from a public url (in this case on github).

JonLiu1993 commented 2 weeks ago

@charlieok, The bootstrap-vcpkg.sh script is used to download the vcpkg.exe executable program. You can download vcpkg.exe in advance in a networked environment and copy it to the vcpkg root directory. In this way, you can use vcpkg directly in an offline environment without running this script.

charlieok commented 2 weeks ago

It looks like the bootstrap script makes a decision to either download an executable or build one. What should the user do if they want to build the executable in an offline environment?

JonLiu1993 commented 2 weeks ago

Currently, vcpkg.exe can’t be generated without an Internet connection. You can build it in an Internet environment in advance and copy it to use in an offline environment.

charlieok commented 2 weeks ago

hmm, ok, thanks for the info!

JonLiu1993 commented 2 weeks ago

We hope your question was answered to your satisfaction; if it wasn't, you can reopen with more info.