build/cargo-build-system: Remove 'update-cargo-lock phase.

* guix/build/cargo-build-system.scm (update-cargo-lock): Remove
procedure.
(configure): Delete Cargo.lock file if it exists.
(%standard-phases): Remove 'update-cargo-lock.
* doc/guix.texi (Build System)[cargo-build-system]: Remove references to
the 'update-cargo-lock phase.
This commit is contained in:
Efraim Flashner 2019-08-22 16:21:26 +03:00
parent 4ad7e7e604
commit 3762e31b6c
No known key found for this signature in database
GPG Key ID: 41AAE7DCCA3D8351
2 changed files with 8 additions and 20 deletions

View File

@ -5854,11 +5854,10 @@ should be added to the package definition via the
In its @code{configure} phase, this build system will make any source inputs In its @code{configure} phase, this build system will make any source inputs
specified in the @code{#:cargo-inputs} and @code{#:cargo-development-inputs} specified in the @code{#:cargo-inputs} and @code{#:cargo-development-inputs}
parameters available to cargo. The @code{update-cargo-lock} phase will, parameters available to cargo. It will also remove an included
when there is a @code{Cargo.lock} file, update the @code{Cargo.lock} file @code{Cargo.lock} file to be recreated by @code{cargo} during the
with the inputs and their versions available at build time. The @code{build} phase. The @code{install} phase installs any crate the binaries
@code{install} phase installs any crate the binaries if they are defined by if they are defined by the crate.
the crate.
@end defvr @end defvr
@cindex Clojure (programming language) @cindex Clojure (programming language)

View File

@ -134,22 +134,12 @@ directory = '" port)
;; upgrading the compiler for example. ;; upgrading the compiler for example.
(setenv "RUSTFLAGS" "--cap-lints allow") (setenv "RUSTFLAGS" "--cap-lints allow")
(setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc")) (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
#t)
;; The Cargo.lock file tells the build system which crates are required for ;; We don't use the Cargo.lock file to determine the package versions we use
;; building and hardcodes their version and checksum. In order to build with ;; during building, and in any case if one is not present it is created
;; the inputs we provide, we need to recreate the file with our inputs. ;; during the 'build phase by cargo.
(define* (update-cargo-lock #:key
(vendor-dir "guix-vendor")
#:allow-other-keys)
"Regenerate the Cargo.lock file with the current build inputs."
(when (file-exists? "Cargo.lock") (when (file-exists? "Cargo.lock")
(begin (delete-file "Cargo.lock"))
;; Unfortunately we can't generate a Cargo.lock file until the checksums
;; are generated, so we have an extra round of generate-all-checksums here.
(generate-all-checksums vendor-dir)
(delete-file "Cargo.lock")
(invoke "cargo" "generate-lockfile")))
#t) #t)
;; After the 'patch-generated-file-shebangs phase any vendored crates who have ;; After the 'patch-generated-file-shebangs phase any vendored crates who have
@ -203,7 +193,6 @@ directory = '" port)
(replace 'build build) (replace 'build build)
(replace 'check check) (replace 'check check)
(replace 'install install) (replace 'install install)
(add-after 'configure 'update-cargo-lock update-cargo-lock)
(add-after 'patch-generated-file-shebangs 'patch-cargo-checksums patch-cargo-checksums))) (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums patch-cargo-checksums)))
(define* (cargo-build #:key inputs (phases %standard-phases) (define* (cargo-build #:key inputs (phases %standard-phases)