summaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2021-03-15 13:04:46 +0200
committerEfraim Flashner <efraim@flashner.co.il>2021-03-15 15:53:11 +0200
commit78e7e178a3976d6c38de80449548e0332bbc474c (patch)
tree50a74e89ac8f97d5b8d8ca1205341e59b4ec76c1 /guix/build
parentbf612ead766ee5afcdccd7c8ab003b791ecea9df (diff)
build-system/cargo: Don't clobber packaged crates while building.
This fixes an issue where two packages share a common dependent. * guix/build/cargo-build-system.scm (unpack-rust-crates): Only copy rust crates into the target directory if there isn't one already there with the same name.
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/cargo-build-system.scm16
1 files changed, 11 insertions, 5 deletions
diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm
index c7ca98105c..0a95672b00 100644
--- a/guix/build/cargo-build-system.scm
+++ b/guix/build/cargo-build-system.scm
@@ -91,11 +91,17 @@ Cargo.toml file present at its root."
(mkdir-p "target/package")
(mkdir-p vendor-dir)
;; TODO: copy only regular inputs to target/package, not native-inputs.
- (for-each (lambda (input-crate)
- (copy-recursively (string-append input-crate
- "/share/cargo/registry")
- "target/package"))
- (delete-duplicates rust-inputs))
+ (for-each
+ (lambda (input-crate)
+ (for-each
+ (lambda (packaged-crate)
+ (unless
+ (file-exists?
+ (string-append "target/package/" (basename packaged-crate)))
+ (install-file packaged-crate "target/package/")))
+ (find-files
+ (string-append input-crate "/share/cargo/registry") "\\.crate$")))
+ (delete-duplicates rust-inputs))
(for-each (lambda (crate)
(invoke "tar" "xzf" crate "-C" vendor-dir))