Merge pull request #105305 from lopsided98/build-rust-crate-platform-hash

buildRustCrate: add host platform to rlib hash suffix
This commit is contained in:
John Ericson 2020-11-29 10:50:25 -05:00 committed by GitHub
commit 77816426b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,10 @@ let
}; };
installCrate = import ./install-crate.nix { inherit stdenv; }; installCrate = import ./install-crate.nix { inherit stdenv; };
# Allow access to the rust attribute set from inside buildRustCrate, which
# has a parameter that shadows the name.
rustAttrs = rust;
in in
/* The overridable pkgs.buildRustCrate function. /* The overridable pkgs.buildRustCrate function.
@ -250,7 +254,7 @@ stdenv.mkDerivation (rec {
depsMetadata = lib.foldl' (str: dep: str + dep.metadata) "" (dependencies ++ buildDependencies); depsMetadata = lib.foldl' (str: dep: str + dep.metadata) "" (dependencies ++ buildDependencies);
hashedMetadata = builtins.hashString "sha256" hashedMetadata = builtins.hashString "sha256"
(crateName + "-" + crateVersion + "___" + toString (mkRustcFeatureArgs crateFeatures) + (crateName + "-" + crateVersion + "___" + toString (mkRustcFeatureArgs crateFeatures) +
"___" + depsMetadata); "___" + depsMetadata + "___" + rustAttrs.toRustTarget stdenv.hostPlatform);
in lib.substring 0 10 hashedMetadata; in lib.substring 0 10 hashedMetadata;
build = crate.build or ""; build = crate.build or "";