From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwayJ-0000EW-RI for guix-patches@gnu.org; Fri, 07 Apr 2017 16:59:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwayF-0004Q0-0N for guix-patches@gnu.org; Fri, 07 Apr 2017 16:59:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:38627) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwayE-0004Pw-TP for guix-patches@gnu.org; Fri, 07 Apr 2017 16:59:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cwayE-0002rN-JW for guix-patches@gnu.org; Fri, 07 Apr 2017 16:59:02 -0400 Subject: bug#26166: [PATCH] gnu: cargo: Simplify unpacking. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170319002844.19407-1-dannym@scratchpost.org> Date: Fri, 07 Apr 2017 22:58:32 +0200 In-Reply-To: <20170319002844.19407-1-dannym@scratchpost.org> (Danny Milosavljevic's message of "Sun, 19 Mar 2017 01:28:44 +0100") Message-ID: <87pogosznr.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Danny Milosavljevic Cc: 26166@debbugs.gnu.org Hi Danny, Danny Milosavljevic skribis: > * gnu/packages/rust.scm (cargo): Simplify unpacking. One minor issue: Please describe the changes in terms of code: add #:modules, modify =E2=80=98unpack-submodule-sources=E2=80=99 phase such tha= t this and that, etc. > gnu/packages/rust.scm | 60 +++++++++++++++++++++++++++++++++------------= ------ > 1 file changed, 39 insertions(+), 21 deletions(-) It=E2=80=99s not immediately obvious that it=E2=80=99s 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=3D1")= ))))) > + (let* ((unpack > + (lambda (source target) > + (mkdir-p target) > + (with-directory-excursion target > + (zero? (system* "tar" "xf" > + source > + "--strip-components=3D1"))))) > + (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 =E2=80=98let=E2=80=99 with =E2=80=9C= internal defines=E2=80=9D, like this: (lambda* =E2=80=A6 (define (unpack source target) =E2=80=A6) (define (touch file) =E2=80=A6) (define (install-rust-library entry) =E2=80=A6) body =E2=80=A6) > + (mkdir ".cargo") > + ;(setenv "CARGO_HOME" (string-append (getcwd) "/cargohome= ")) ^ Leftover? I don=E2=80=99t fully understand this file, but if it sounds good to you, we should apply it. OK to send an updated patch? Thank you! Ludo=E2=80=99.