fix(tvix): fix outputHashes calculation for crates with versions

In case two crate versions are present, the key in the Cargo.nix file
includes the version number too.

To be able to set a specific hash for "tracing-opentelemetry 0.25.0" for
example, this needs to account for keys with the version included.

Access `crateName`, `version` and `src.outputHash` individually.

Change-Id: Ib9800691a445ac403ff646cb32e85a7a4cbef9d8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11994
Tested-by: BuildkiteCI
Reviewed-by: yuka <yuka@yuka.dev>
This commit is contained in:
Florian Klink 2024-07-20 22:25:38 +02:00 committed by flokli
parent 8b77c7fcd7
commit fca8462530

View file

@ -15,8 +15,8 @@ let
# and the outputHash as value.
outputHashes = builtins.listToAttrs
(map
(crateName:
(lib.nameValuePair "${crateName}-${crates.internal.crates.${crateName}.version}" crates.internal.crates.${crateName}.src.outputHash)
(k:
(lib.nameValuePair "${crates.internal.crates.${k}.crateName}-${crates.internal.crates.${k}.version}" crates.internal.crates.${k}.src.outputHash)
) [
"wu-manber"
]);