git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #130462 from rski/importCargoLock

rustPlatform.importCargoLock: add an assert for old Cargo.locks

commitb2fac1cfe0fdb72bbf790891447d2c83995ad9b6 authorDaniël de Kok <me@danieldk.eu> dateSun 18 Jul 2021, 18:57 (5 years ago) parentb3d805023dd37d
1 file changed+13−5
pkgs/build-support/rust/import-cargo-lock.nix+13−5
pkgs/build-support/rust/import-cargo-lock.nix+13−5
@@ -63,11 +63,19 @@ let
6363
6464 # We can't use the existing fetchCrate function, since it uses a
6565 # recursive hash of the unpacked crate.
66− fetchCrate = pkg: fetchurl {
67− name = "crate-${pkg.name}-${pkg.version}.tar.gz";
68− url = "https://crates.io/api/v1/crates/${pkg.name}/${pkg.version}/download";
69− sha256 = pkg.checksum;
70− };
66+ fetchCrate = pkg:
67+ assert lib.assertMsg (pkg ? checksum) ''
68+ Package ${pkg.name} does not have a checksum.
69+ Please note that the Cargo.lock format where checksums used to be listed
70+ under [metadata] is not supported.
71+ If that is the case, running `cargo update` with a recent toolchain will
72+ automatically update the format along with the crate's depenendencies.
73+ '';
74+ fetchurl {
75+ name = "crate-${pkg.name}-${pkg.version}.tar.gz";
76+ url = "https://crates.io/api/v1/crates/${pkg.name}/${pkg.version}/download";
77+ sha256 = pkg.checksum;
78+ };
7179
7280 # Fetch and unpack a crate.
7381 mkCrate = pkg: