bootstrap: Use invoke instead of system*.

* gnu/packages/bootstrap.scm (package-from-tarball): Ignore the result of
the snippet procedure.  Use invoke and remove vestigial plumbing.
(%bootstrap-coreutils&co): Remove the vestigial #t from the snippet.
(%bootstrap-glibc, %bootstrap-gcc)[arguments]: Use invoke.  Return #t from the
builder.
This commit is contained in:
Mark H Weaver 2018-03-16 03:48:24 -04:00
parent 2eeffc0acc
commit ad1656dc91
No known key found for this signature in database
GPG Key ID: 7CEF29847562C516
1 changed files with 24 additions and 22 deletions

View File

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
@ -98,10 +98,10 @@
(define* (package-from-tarball name source program-to-test description (define* (package-from-tarball name source program-to-test description
#:key snippet) #:key snippet)
"Return a package that correspond to the extraction of SOURCE. "Return a package that correspond to the extraction of SOURCE.
PROGRAM-TO-TEST is a program to run after extraction of SOURCE, to PROGRAM-TO-TEST is a program to run after extraction of SOURCE, to check
check whether everything is alright. If SNIPPET is provided, it is whether everything is alright. If SNIPPET is provided, it is evaluated after
evaluated after extracting SOURCE. SNIPPET should return true if extracting SOURCE. SNIPPET should raise an exception to signal an error; its
successful, or false to signal an error." return value is ignored."
(package (package
(name name) (name name)
(version "0") (version "0")
@ -118,14 +118,14 @@ successful, or false to signal an error."
(mkdir out) (mkdir out)
(copy-file tarball "binaries.tar.xz") (copy-file tarball "binaries.tar.xz")
(system* xz "-d" "binaries.tar.xz") (invoke xz "-d" "binaries.tar.xz")
(let ((builddir (getcwd))) (let ((builddir (getcwd)))
(with-directory-excursion out (with-directory-excursion out
(and (zero? (system* tar "xvf" (invoke tar "xvf"
(string-append builddir "/binaries.tar"))) (string-append builddir "/binaries.tar"))
,@(if snippet (list snippet) '()) ,@(if snippet (list snippet) '())
(zero? (system* (string-append "bin/" ,program-to-test) (invoke (string-append "bin/" ,program-to-test)
"--version")))))))) "--version"))))))
(inputs (inputs
`(("tar" ,(search-bootstrap-binary "tar" (%current-system))) `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
("xz" ,(search-bootstrap-binary "xz" (%current-system))) ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
@ -390,8 +390,7 @@ $out/bin/guile --version~%"
(if (not (elf-file? "bin/egrep")) (if (not (elf-file? "bin/egrep"))
(substitute* '("bin/egrep" "bin/fgrep") (substitute* '("bin/egrep" "bin/fgrep")
(("^exec grep") (string-append (getcwd) "/bin/grep")))) (("^exec grep") (string-append (getcwd) "/bin/grep"))))
(chmod "bin" #o555) (chmod "bin" #o555))))
#t)))
(define %bootstrap-binutils (define %bootstrap-binutils
(package-from-tarball "binutils-bootstrap" (package-from-tarball "binutils-bootstrap"
@ -446,18 +445,20 @@ $out/bin/guile --version~%"
(mkdir out) (mkdir out)
(copy-file tarball "binaries.tar.xz") (copy-file tarball "binaries.tar.xz")
(system* xz "-d" "binaries.tar.xz") (invoke xz "-d" "binaries.tar.xz")
(let ((builddir (getcwd))) (let ((builddir (getcwd)))
(with-directory-excursion out (with-directory-excursion out
(system* tar "xvf" (invoke tar "xvf"
(string-append builddir (string-append builddir
"/binaries.tar")) "/binaries.tar"))
(chmod "lib" #o755) (chmod "lib" #o755)
;; Patch libc.so so it refers to the right path. ;; Patch libc.so so it refers to the right path.
(substitute* "lib/libc.so" (substitute* "lib/libc.so"
(("/[^ ]+/lib/(libc|ld)" _ prefix) (("/[^ ]+/lib/(libc|ld)" _ prefix)
(string-append out "/lib/" prefix)))))))) (string-append out "/lib/" prefix)))
#t)))))
(inputs (inputs
`(("tar" ,(search-bootstrap-binary "tar" (%current-system))) `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
("xz" ,(search-bootstrap-binary "xz" (%current-system))) ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
@ -518,12 +519,12 @@ $out/bin/guile --version~%"
(mkdir out) (mkdir out)
(copy-file tarball "binaries.tar.xz") (copy-file tarball "binaries.tar.xz")
(system* xz "-d" "binaries.tar.xz") (invoke xz "-d" "binaries.tar.xz")
(let ((builddir (getcwd)) (let ((builddir (getcwd))
(bindir (string-append out "/bin"))) (bindir (string-append out "/bin")))
(with-directory-excursion out (with-directory-excursion out
(system* tar "xvf" (invoke tar "xvf"
(string-append builddir "/binaries.tar"))) (string-append builddir "/binaries.tar")))
(with-directory-excursion bindir (with-directory-excursion bindir
(chmod "." #o755) (chmod "." #o755)
@ -538,7 +539,8 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
out libc libc libc out libc libc libc
,(glibc-dynamic-linker)))) ,(glibc-dynamic-linker))))
(chmod "gcc" #o555)))))) (chmod "gcc" #o555)
#t)))))
(inputs (inputs
`(("tar" ,(search-bootstrap-binary "tar" (%current-system))) `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
("xz" ,(search-bootstrap-binary "xz" (%current-system))) ("xz" ,(search-bootstrap-binary "xz" (%current-system)))