Skip to content
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|binarycache] don't use triplet file hash. Hash variables instead. #19984

Open
Neumann-A opened this issue Sep 3, 2021 · 10 comments · May be fixed by microsoft/vcpkg-tool#596
Open

[vcpkg|binarycache] don't use triplet file hash. Hash variables instead. #19984

Neumann-A opened this issue Sep 3, 2021 · 10 comments · May be fixed by microsoft/vcpkg-tool#596
Assignees
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Comments

@Neumann-A
Copy link
Contributor

So I have a a custom triplet with per port customization and this is a problem for the binary cache since if I add a new customization everything will be invalidated, removed and rebuild although only one port was effectively changed.

I thus suggest: Instead of using the file hash of the triplet to determine the hash for the binary cache it would be better to get the variables set by the triplet and use those to define the triplet hash for a port. Since the triplet is already read numerous times for compiler hash checks it shouldn't add a lot of additional overhead.

This would greatly improve my workflow if I have to touch the triplet file.

@Neumann-A Neumann-A changed the title [vcpkg|binarycache] don't use triplet file hash. [vcpkg|binarycache] don't use triplet file hash. Hash variables instead. Sep 3, 2021
@ras0219-msft
Copy link
Contributor

This will also need to detect changes to environment variables and I'm not sure how to make

set(ENV{PATH} "$ENV{PATH}:$ENV{SOME_BASE_DIR}/magic")

machine independent without hashing the source code.

@dg0yt
Copy link
Contributor

dg0yt commented Sep 12, 2021

This will also need to detect changes to environment variables ...

I'm not sure if it is always desired to detect particular changes to environment variables. And even with hashing the source, you don't hash the contents of the $ENV{SOME_BASE_DIR} input.

How about a triplet revision variable (not replacing the hash, but as an input)? It might even be overridden per port...

@autoantwort
Copy link
Contributor

This will also need to detect changes to environment variables and I'm not sure how to make

set(ENV{PATH} "$ENV{PATH}:$ENV{SOME_BASE_DIR}/magic")

machine independent without hashing the source code.

The question is if you always want this. Maybe one changes the env var SOME_BASE_DIR to switch between versions of something, then you want different hashes. Maybe we should add something like set(VCPKG_IGNORE_FOR_HASH "$ENV{SOME_BASE_DIR}") so that the value(s) of VCPKG_IGNORE_FOR_HASH are removed from the value of every variable so that they are not included in the hash.
Or we don't include ENV variables in the hash. If you want to include a value of the env to be hashed you have to set a local variable to the value.

@JackBoosY JackBoosY added the requires:repro The issue is not currently repro-able label Jan 28, 2022
@Neumann-A
Copy link
Contributor Author

@JackBoosY Why did you mark this as requires:repro?

@JackBoosY JackBoosY added category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) and removed requires:repro The issue is not currently repro-able labels Feb 16, 2022
autoantwort added a commit to autoantwort/vcpkg-tool that referenced this issue Jun 18, 2022
@autoantwort
Copy link
Contributor

@Neumann-A If you use a selfcompiled vcpkg-tool you can now use microsoft/vcpkg-tool#596

autoantwort added a commit to autoantwort/vcpkg-tool that referenced this issue Jun 19, 2022
autoantwort added a commit to autoantwort/vcpkg-tool that referenced this issue Jun 19, 2022
autoantwort added a commit to autoantwort/vcpkg-tool that referenced this issue Jun 19, 2022
autoantwort added a commit to autoantwort/vcpkg-tool that referenced this issue Jun 19, 2022
@Osyotr
Copy link
Contributor

Osyotr commented Jul 13, 2022

Maybe teach VCPKG to also include port-settings/triplet-name.port-name.cmake and hash its content too?

@DownerCase
Copy link
Contributor

Ran into this the other day, added a customization for a single port and was sad to see the world rebuild. Ended up copying the port to be an overlay port instead, which is a rather less ergonomic...

@Neumann-A
Copy link
Contributor Author

I think nowadays you could solve it with an if checking if a per port customization file exists and VCPKG_HASH_ADDITIONAL_FILES. Of course inserting that logic requires a world rebuild once to introduce the logic.

@microsoft microsoft deleted a comment from github-actions bot Sep 18, 2024
@Cheney-W Cheney-W removed the Stale label Sep 18, 2024
@redbaron
Copy link
Contributor

@Neumann-A ,

solve it with an if checking if a per port customization file exists

do you propose triplets to implicitly include per-port customisation files ?

@Neumann-A
Copy link
Contributor Author

@Neumann-A ,

solve it with an if checking if a per port customization file exists

do you propose triplets to implicitly include per-port customisation files ?

Yes and then explicitly add that file to the hash for that port.

@WangWeiLin-MV WangWeiLin-MV removed the category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

Successfully merging a pull request may close this issue.