From 51a6ac79d2971ed44994af138914a70c1b04762d Mon Sep 17 00:00:00 2001 From: linsui Date: Sun, 26 Jun 2022 13:07:01 +0800 Subject: [PATCH] fetch-cargo-tarball: fix for packages without dep --- .../rust/fetch-cargo-tarball/cargo-vendor-normalise.py | 4 +++- pkgs/build-support/rust/fetch-cargo-tarball/default.nix | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/rust/fetch-cargo-tarball/cargo-vendor-normalise.py b/pkgs/build-support/rust/fetch-cargo-tarball/cargo-vendor-normalise.py index 2d7a18957184..90933b089c92 100755 --- a/pkgs/build-support/rust/fetch-cargo-tarball/cargo-vendor-normalise.py +++ b/pkgs/build-support/rust/fetch-cargo-tarball/cargo-vendor-normalise.py @@ -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@" diff --git a/pkgs/build-support/rust/fetch-cargo-tarball/default.nix b/pkgs/build-support/rust/fetch-cargo-tarball/default.nix index e2ee870f22a3..6d6219078bac 100644 --- a/pkgs/build-support/rust/fetch-cargo-tarball/default.nix +++ b/pkgs/build-support/rust/fetch-cargo-tarball/default.nix @@ -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