fetch-cargo-tarball: fix for packages without dep

This commit is contained in:
linsui 2022-06-26 13:07:01 +08:00
parent 656e3022f4
commit 51a6ac79d2
2 changed files with 5 additions and 1 deletions

View file

@ -13,7 +13,9 @@ def quote(s: str) -> str:
def main() -> None:
data = toml.load(sys.stdin)
assert list(data.keys()) == ["source"]
# There is no dependency to vendor in this project.
if not list(data.keys()) == ["source"]:
return
# this value is non deterministic
data["source"]["vendored-sources"]["directory"] = "@vendor@"

View file

@ -71,6 +71,8 @@ in stdenv.mkDerivation ({
cargo vendor $name --respect-source-config | cargo-vendor-normalise > $CARGO_CONFIG
# Create an empty vendor directory when there is no dependency to vendor
mkdir -p $name
# Add the Cargo.lock to allow hash invalidation
cp Cargo.lock.orig $name/Cargo.lock