Skip to content

Fix license install bug using cargo vendor

The find -path produced multiple matches when multiple rustix directories existed whether these were different versions or internal rust index hashes.

Using mktemp to create a short-lived vendor directory, and installing the crate there allows us to avoid this. This should allow for multiple parallel builds using the same source directory, and should also work offline.

For reference, the original find command was returning multiple results even for the same version:

$ find "$HOME/.cargo/registry/src" -path "*rustix-$_rustix_ver/*LLVM-exception"
/home/exampleuser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.38.34/LICENSE-Apache-2.0_WITH_LLVM-exception
/home/exampleuser/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.38.34/LICENSE-Apache-2.0_WITH_LLVM-exception

Presumably, the index.crates.io-1949cf8c6b5b557f is from separate invocations of cargo pulling down the same version of rustix and caching it multiple times.

Edited by James Cuzella

Merge request reports

Loading