1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (test-pack)
21 #:use-module (guix scripts pack)
22 #:use-module (guix store)
23 #:use-module (guix derivations)
24 #:use-module (guix profiles)
25 #:use-module (guix monads)
26 #:use-module (guix grafts)
27 #:use-module (guix tests)
28 #:use-module (guix gexp)
29 #:use-module (gnu packages bootstrap)
30 #:use-module (srfi srfi-64))
33 (open-connection-for-tests))
35 ;; Globally disable grafts because they can trigger early builds.
38 (define-syntax-rule (test-assertm name exp)
40 (run-with-store %store exp
41 #:guile-for-build (%guile-for-build))))
43 (define %gzip-compressor
44 ;; Compressor that uses the bootstrap 'gzip'.
45 ((@ (guix scripts pack) compressor) "gzip"
47 #~(#+(file-append %bootstrap-coreutils&co "/bin/gzip") "-6n")))
49 (define %tar-bootstrap %bootstrap-coreutils&co)
54 ;; FIXME: The following test would rebuild the world (and likely fail) as a
55 ;; consequence of commit c45477d2a1a651485feede20fe0f3d15aec48b39 (and related
56 ;; changes) that made guile-sqlite3 a dependency of the derivation.
57 ;; See <https://bugs.gnu.org/32184>.
60 (test-assertm "self-contained-tarball"
62 ((profile (profile-derivation (packages->manifest
63 (list %bootstrap-guile))
66 (tarball (self-contained-tarball "pack" profile
67 #:symlinks '(("/bin/Guile"
69 #:compressor %gzip-compressor
70 #:archiver %tar-bootstrap))
71 (check (gexp->derivation
73 #~(let ((bin (string-append "." #$profile "/bin")))
75 (string-append #$%tar-bootstrap "/bin"))
76 (system* "tar" "xvf" #$tarball)
79 (and (file-exists? (string-append bin "/guile"))
80 (string=? (string-append #$%bootstrap-guile "/bin")
82 (string=? (string-append ".." #$profile
84 (readlink "bin/Guile"))))))))
85 (built-derivations (list check))))