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] Binaries recovered by Nuget are not cached locally, no matter the value of VCPKG_BINARY_SOURCES
#15169
Comments
@BillyONeal Can you please take a look? Thanks. |
If I understood @ras0219 / @ras0219-msft correctly when this feature was deployed, this is by design; I don't know if the nuget caches necessarily contain the same contents such that we could use one cache strategy to mint the other without the original sources. But I'm not positive. |
This behavior is by design (i.e. not a bug), but I think it's a very reasonable feature request to allow users to enable the nuget cache. |
Hey! Thanks for taking the time to read the issue and answer 🙂 . So you think in the 5 solutions I suggested ( |
I have to defer to @ras0219 on that one myself |
@klalumiere Yeah, exactly. I was thinking it would probably be appropriate to add a switch (or two) to the I think for most users it probably makes sense to pass those flags by default still (treating NuGet as just a "dumb" download client with fancy authentication). |
#15169) (#15512) * Fix warning on clang version 10.0.0-4ubuntu1 The warning was ```shell ../src/vcpkg/commands.porthistory.cpp:55:14: error: unused function 'is_date' [-Werror,-Wunused-function] ``` * Add environment variable VCPKG_USE_NUGET_CACHE As the name suggests, this environment variable allow tu use Nuget cache for Nuget binary caching sources. * Document NuGet's Cache environment variable
microsoft#15169) (microsoft#15512) * Fix warning on clang version 10.0.0-4ubuntu1 The warning was ```shell ../src/vcpkg/commands.porthistory.cpp:55:14: error: unused function 'is_date' [-Werror,-Wunused-function] ``` * Add environment variable VCPKG_USE_NUGET_CACHE As the name suggests, this environment variable allow tu use Nuget cache for Nuget binary caching sources. * Document NuGet's Cache environment variable
Describe the bug
This is somewhere between a new feature and a bug. I wanted to discuss the issue before trying to implement a fix.
I set
VCPKG_BINARY_SOURCES
toclear;default,readwrite;nuget,https://nuget.coveo.com/v3/index.json,read
. I expected binaries to be fetched the first time from Nuget, and then to be fetched locally. However, they are always fetched from Nuget. This become a major issue for us since we have a large number of large dependencies. More details below.Environment
To Reproduce
Consider the minimal
/coveobaselib/vcpkg.json
manifestSteps to reproduce the behavior:
export VCPKG_BINARY_SOURCES="clear;default,readwrite;nuget,https://nuget.coveo.com/v3/index.json,read"
. I actually tried every permutations possible withdefault
andnuget
.cd /coveobaselib
mkdir debug && cd debug
cmake -G Ninja ..
aws-sdk-cpp
is downloaded from Nugetmkdir ../release && cd ../release
. This could also be a directoryanotherDebug
where I test different compiler flags.aws-sdk-cpp
is downloaded, again, from NugetExpected behavior
The second time (step
7
), I expectedaws-sdk-cpp
to be cached locally, for instance in$HOME/.cache/vcpkg
, and no query to the Nuget server to be made. Of course, in this toy example, it doesn't matter. However, in our case, we have more than 40 dependencies and some of them are large. This would be problematic for us to re-download them each time we clear our build directory.Of course, the dependency
aws-sdk-cpp
do not need to be in$HOME/.cache/vcpkg
, it only need to be local. For instance, I saw while browsing the code that Nuget also has a cache and that we purposely do not use it. Maybe we could use it? Another possible fix: the dependencies are downloaded in/vcpkg/packages
. Maybe we could use them directly and not redownload them from Nuget if they are found? However, this would required "versioning" (preferably with the hash) the content of the foldervcpkg/packages
. This will be required anyway if many repository manifests with different versions of the same package sharesvcpkg/packages
(for race conditions in particular).In summary, to fix the issue, given
VCPKG_BINARY_SOURCES="clear;source1,readwrite;nuget,https://nuget.coveo.com/v3/index.json,read;source2,readwrite"
, we couldA) Download the dependency from Nuget, copy (write) it to
source1
only since it is beforenuget
in the list and it is inreadwrite
B) Download the dependency from Nuget, copy (write) it to
source2
only since it is afternuget
in the list ("weird" for people that read from left to right, but I include it anyway) and it is inreadwrite
.C) Download the dependency from Nuget, copy (write) it to every
source
s inreadwrite
.D) Use Nuget cache.
E) Use the package from
vcpkg/packages
if it is availableF) Something else?
Looking forward for your feedback 🙂
The text was updated successfully, but these errors were encountered: