gnu: bootstrap: Add support for snippets to 'package-from-tarball'.

* gnu/packages/bootstrap.scm (package-from-tarball): Add new keyword
  argument #:snippet.
This commit is contained in:
Mark H Weaver 2014-12-31 03:38:26 -05:00
parent c9a4655553
commit 2959dbe935

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -87,10 +88,13 @@
(patch patch)) (patch patch))
(origin-patches source)))))) (origin-patches source))))))
(define (package-from-tarball name source program-to-test description) (define* (package-from-tarball name source program-to-test description
#: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 whether everything is alright." check whether everything is alright. If SNIPPET is provided, it is
evaluated after extracting SOURCE. SNIPPET should return true if
successful, or false to signal an error."
(package (package
(name name) (name name)
(version "0") (version "0")
@ -112,6 +116,7 @@ check whether everything is alright."
(with-directory-excursion out (with-directory-excursion out
(and (zero? (system* tar "xvf" (and (zero? (system* tar "xvf"
(string-append builddir "/binaries.tar"))) (string-append builddir "/binaries.tar")))
,@(if snippet (list snippet) '())
(zero? (system* (string-append "bin/" ,program-to-test) (zero? (system* (string-append "bin/" ,program-to-test)
"--version")))))))) "--version"))))))))
(inputs (inputs