rust: Fix for legacy fetch cargo

See inline comment and #79975 for details.
This commit is contained in:
Benjamin Hipple 2020-02-14 19:51:05 -05:00 committed by Jon
parent 4c900027b1
commit 6d881472ef

View File

@ -45,11 +45,17 @@ let
# and have vendored deps, check them against the src attr for consistency. # and have vendored deps, check them against the src attr for consistency.
validateCargoDeps = cargoSha256 != "unset" && !legacyCargoFetcher; validateCargoDeps = cargoSha256 != "unset" && !legacyCargoFetcher;
# Some cargo builds include build hooks that modify their own vendor
# dependencies. This copies the vendor directory into the build tree and makes
# it writable. If we're using a tarball, the unpackFile hook already handles
# this for us automatically.
setupVendorDir = if cargoVendorDir == null setupVendorDir = if cargoVendorDir == null
then '' then (''
unpackFile "$cargoDeps" unpackFile "$cargoDeps"
cargoDepsCopy=$(stripHash $cargoDeps) cargoDepsCopy=$(stripHash $cargoDeps)
'' '' + stdenv.lib.optionalString legacyCargoFetcher ''
chmod -R +w "$cargoDepsCopy"
'')
else '' else ''
cargoDepsCopy="$sourceRoot/${cargoVendorDir}" cargoDepsCopy="$sourceRoot/${cargoVendorDir}"
''; '';