GNU bug report logs -
#26166
[PATCH] gnu: cargo: Simplify unpacking.
Previous Next
Full log
Message #8 received at 26166 <at> debbugs.gnu.org (full text, mbox):
Hi Danny,
Danny Milosavljevic <dannym <at> scratchpost.org> skribis:
> * gnu/packages/rust.scm (cargo): Simplify unpacking.
One minor issue: Please describe the changes in terms of code: add
#:modules, modify ‘unpack-submodule-sources’ phase such that this and
that, etc.
> gnu/packages/rust.scm | 60 +++++++++++++++++++++++++++++++++------------------
> 1 file changed, 39 insertions(+), 21 deletions(-)
It’s not immediately obvious that it’s a simplification. ;-)
> (delete 'patch-usr-bin-file)
> (add-after 'unpack 'unpack-submodule-sources
> (lambda* (#:key inputs #:allow-other-keys)
> - (let ((unpack (lambda (source target)
> - (mkdir-p target)
> - (with-directory-excursion target
> - (zero? (system* "tar" "xf"
> - source
> - "--strip-components=1"))))))
> + (let* ((unpack
> + (lambda (source target)
> + (mkdir-p target)
> + (with-directory-excursion target
> + (zero? (system* "tar" "xf"
> + source
> + "--strip-components=1")))))
> + (touch
> + (lambda (file-name)
> + (call-with-output-file file-name (const #t))))
> + (install-rust-library
> + (lambda (entry)
> + (match entry
> + ((name . src)
> + (if (string-prefix? "rust-" name)
> + (let* ((rust-length (string-length "rust-"))
> + (rust-name (string-drop name
> + rust-length))
> + (rsrc (string-append "vendor/"
> + rust-name))
> + (unpack-status (unpack src rsrc)))
> + (touch (string-append rsrc "/.cargo-ok"))
> + (generate-checksums rsrc src)
> + unpack-status)))
For clarity it may help to replace the ‘let’ with “internal defines”,
like this:
(lambda* …
(define (unpack source target)
…)
(define (touch file)
…)
(define (install-rust-library entry)
…)
body …)
> + (mkdir ".cargo")
> + ;(setenv "CARGO_HOME" (string-append (getcwd) "/cargohome"))
^
Leftover?
I don’t fully understand this file, but if it sounds good to you, we
should apply it. OK to send an updated patch?
Thank you!
Ludo’.
This bug report was last modified 8 years and 12 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.