summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2023-05-09 09:56:33 +0300
committerEfraim Flashner <efraim@flashner.co.il>2023-05-09 09:56:33 +0300
commit649ce7b433171a47e8a2819b849bfa88c736d0e9 (patch)
treeca4c7a4b3bfb13825737f72718e1377ee0ddbe1e /guix
parent1bb29cd49c759a9af62b3d5c51ebd212bd3596c7 (diff)
parentc56d57110de1412d3529940d4f856611d123da66 (diff)
Merge branch 'rust-team'
Diffstat (limited to 'guix')
-rw-r--r--guix/build/cargo-build-system.scm24
1 files changed, 22 insertions, 2 deletions
diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm
index 41766228c2..fbba554e9b 100644
--- a/guix/build/cargo-build-system.scm
+++ b/guix/build/cargo-build-system.scm
@@ -2,7 +2,7 @@
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
-;;; Copyright © 2019-2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2019-2023 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
;;;
@@ -210,12 +210,32 @@ directory = '" port)
#t))
(define* (package #:key
+ source
+ skip-build?
install-source?
(cargo-package-flags '("--no-metadata" "--no-verify"))
#:allow-other-keys)
"Run 'cargo-package' for a given Cargo package."
(if install-source?
- (apply invoke `("cargo" "package" ,@cargo-package-flags))
+ (if skip-build?
+ (begin
+ (install-file source "target/package")
+ (with-directory-excursion "target/package"
+ (for-each
+ (lambda (file)
+ (make-file-writable file)
+ ;; Strip the hash and replace '.tar.gz' with '.crate'.
+ (rename-file file
+ (string-append (string-drop-right
+ (string-drop file 35)
+ (string-length ".tar.gz"))
+ ".crate")))
+ (find-files "." "\\.tar\\.gz$"))))
+ (begin
+ ;;error: invalid inclusion of reserved file name Cargo.toml.orig in package source
+ (when (file-exists? "Cargo.toml.orig")
+ (delete-file "Cargo.toml.orig"))
+ (apply invoke `("cargo" "package" ,@cargo-package-flags))))
(format #t "Not installing cargo sources, skipping `cargo package`.~%"))
#t)