Commit | Line | Data |
---|---|---|
850edd77 | 1 | ;;; GNU Guix --- Functional package management for GNU |
ccc951ca | 2 | ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
44057a46 | 3 | ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> |
850edd77 LC |
4 | ;;; |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
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. | |
11 | ;;; | |
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. | |
16 | ;;; | |
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/>. | |
19 | ||
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)) | |
31 | ||
32 | (define %store | |
33 | (open-connection-for-tests)) | |
34 | ||
35 | ;; Globally disable grafts because they can trigger early builds. | |
36 | (%graft? #f) | |
37 | ||
38 | (define-syntax-rule (test-assertm name exp) | |
39 | (test-assert name | |
40 | (run-with-store %store exp | |
41 | #:guile-for-build (%guile-for-build)))) | |
42 | ||
43 | (define %gzip-compressor | |
44 | ;; Compressor that uses the bootstrap 'gzip'. | |
45 | ((@ (guix scripts pack) compressor) "gzip" | |
48b44430 LC |
46 | "gz" |
47 | #~(#+(file-append %bootstrap-coreutils&co "/bin/gzip") "-6n"))) | |
850edd77 LC |
48 | |
49 | (define %tar-bootstrap %bootstrap-coreutils&co) | |
50 | ||
51 | \f | |
52 | (test-begin "pack") | |
53 | ||
cda08dd3 LC |
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>. | |
58 | (test-skip 1) | |
59 | ||
850edd77 LC |
60 | (test-assertm "self-contained-tarball" |
61 | (mlet* %store-monad | |
62 | ((profile (profile-derivation (packages->manifest | |
63 | (list %bootstrap-guile)) | |
64 | #:hooks '() | |
65 | #:locales? #f)) | |
66 | (tarball (self-contained-tarball "pack" profile | |
67 | #:symlinks '(("/bin/Guile" | |
68 | -> "bin/guile")) | |
69 | #:compressor %gzip-compressor | |
44057a46 | 70 | #:archiver %tar-bootstrap)) |
850edd77 LC |
71 | (check (gexp->derivation |
72 | "check-tarball" | |
ccc951ca | 73 | #~(let ((bin (string-append "." #$profile "/bin"))) |
850edd77 LC |
74 | (setenv "PATH" |
75 | (string-append #$%tar-bootstrap "/bin")) | |
76 | (system* "tar" "xvf" #$tarball) | |
77 | (mkdir #$output) | |
78 | (exit | |
ccc951ca | 79 | (and (file-exists? (string-append bin "/guile")) |
850edd77 | 80 | (string=? (string-append #$%bootstrap-guile "/bin") |
ccc951ca LC |
81 | (readlink bin)) |
82 | (string=? (string-append ".." #$profile | |
83 | "/bin/guile") | |
850edd77 LC |
84 | (readlink "bin/Guile")))))))) |
85 | (built-derivations (list check)))) | |
86 | ||
87 | (test-end) |