mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-09-11 15:08:33 +01:00
rust: fix importCargoLock for repositories without toplevel Cargo.toml
Some crates do not have a Cargo.toml at the top-level, but only in nested directories. Before this change importCargoLock used to fail with: error: manifest path `/nix/store/some-store-path/Cargo.toml` does not exist
This commit is contained in:
parent
859da94b9b
commit
3619ffaeb6
|
@ -128,8 +128,13 @@ let
|
|||
|
||||
# If the target package is in a workspace, or if it's the top-level
|
||||
# crate, we should find the crate path using `cargo metadata`.
|
||||
crateCargoTOML=$(${cargo}/bin/cargo metadata --format-version 1 --no-deps --manifest-path $tree/Cargo.toml | \
|
||||
# Some packages do not have a Cargo.toml at the top-level,
|
||||
# but only in nested directories.
|
||||
# Only check the top-level Cargo.toml, if it actually exists
|
||||
if [[ -f $tree/Cargo.toml ]]; then
|
||||
crateCargoTOML=$(${cargo}/bin/cargo metadata --format-version 1 --no-deps --manifest-path $tree/Cargo.toml | \
|
||||
${jq}/bin/jq -r '.packages[] | select(.name == "${pkg.name}") | .manifest_path')
|
||||
fi
|
||||
|
||||
# If the repository is not a workspace the package might be in a subdirectory.
|
||||
if [[ -z $crateCargoTOML ]]; then
|
||||
|
|
Loading…
Reference in a new issue