microsoft / vcpkg

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

[vcpkg-tool] Using binary hash in overrides #40028

Open Neumann-A opened 4 months ago

Neumann-A commented 4 months ago

Is your feature request related to a problem? Please describe.

Controlling version/binary of a dependency directly. vcpkg only allows version pinning via overrides in vcpkg-configuration.json, e.g.

  "overrides": [
    { "name": "fmt", "version": "6.0.0" },
    { "name": "openssl", "version": "1.1.1h#3" }
  ]

What I want is a direct pinning of a version via an existent binary cache hash which is explicitly useful for --only-binarycaching.

Proposed solution

platform dependent version constrains:

  "overrides": [
    { "name": "fmt", "version": "6.0.0", "platform" : "!windows" },
    { "name": "fmt", "binaryhash": "<somehash>", "platform" : "windows" },
    { "name": "openssl", "version": "1.1.1h#3" }
  ]

Describe alternatives you've considered

No response

Additional context

No response

Neumann-A commented 4 months ago

Side note: It might be interesting to differentiate between host/target triplets and provide different overrides depending on host/target.

autoantwort commented 4 months ago

I guess binaryhash implies downloads-only for this port.

Neumann-A commented 4 months ago

Another note: binaryhash probably implies inverse dependency lookup since you simply cannot get the dependencies for a hashed dependency since there is no manifest. I don't see how to extract it from vcpkg.abi-info.txt so vcpkg probably needs to change their binary format to include the manifest itself for something like this.

Neumann-A commented 4 months ago

after thinking about it further. vcpkg could probably create a <binary_filename_without_last_extension>.json at the same location as the binary to be restored. This can then be used to transport the additional information for the here requrested feature. If the json file does not exist the binary can not be restored.