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 | ||
850edd77 LC |
32 | ;; Globally disable grafts because they can trigger early builds. |
33 | (%graft? #f) | |
34 | ||
19c924af | 35 | (define-syntax-rule (test-assertm name store exp) |
850edd77 | 36 | (test-assert name |
19c924af | 37 | (run-with-store store exp |
850edd77 LC |
38 | #:guile-for-build (%guile-for-build)))) |
39 | ||
40 | (define %gzip-compressor | |
41 | ;; Compressor that uses the bootstrap 'gzip'. | |
42 | ((@ (guix scripts pack) compressor) "gzip" | |
48b44430 LC |
43 | "gz" |
44 | #~(#+(file-append %bootstrap-coreutils&co "/bin/gzip") "-6n"))) | |
850edd77 LC |
45 | |
46 | (define %tar-bootstrap %bootstrap-coreutils&co) | |
47 | ||
48 | \f | |
49 | (test-begin "pack") | |
50 | ||
19c924af LC |
51 | ;; The following test needs guile-sqlite3, libgcrypt, etc. as a consequence of |
52 | ;; commit c45477d2a1a651485feede20fe0f3d15aec48b39 and related changes. Thus, | |
53 | ;; run it on the user's store, if it's available, on the grounds that these | |
54 | ;; dependencies may be already there, or we can get substitutes or build them | |
55 | ;; quite inexpensively; see <https://bugs.gnu.org/32184>. | |
cda08dd3 | 56 | |
19c924af | 57 | (with-external-store store |
ec397b31 | 58 | (unless store (test-skip 1)) |
19c924af LC |
59 | (test-assertm "self-contained-tarball" store |
60 | (mlet* %store-monad | |
61 | ((profile (profile-derivation (packages->manifest | |
62 | (list %bootstrap-guile)) | |
63 | #:hooks '() | |
64 | #:locales? #f)) | |
65 | (tarball (self-contained-tarball "pack" profile | |
66 | #:symlinks '(("/bin/Guile" | |
67 | -> "bin/guile")) | |
68 | #:compressor %gzip-compressor | |
69 | #:archiver %tar-bootstrap)) | |
70 | (check (gexp->derivation | |
71 | "check-tarball" | |
72 | #~(let ((bin (string-append "." #$profile "/bin"))) | |
73 | (setenv "PATH" | |
74 | (string-append #$%tar-bootstrap "/bin")) | |
75 | (system* "tar" "xvf" #$tarball) | |
76 | (mkdir #$output) | |
77 | (exit | |
78 | (and (file-exists? (string-append bin "/guile")) | |
79 | (string=? (string-append #$%bootstrap-guile "/bin") | |
80 | (readlink bin)) | |
81 | (string=? (string-append ".." #$profile | |
82 | "/bin/guile") | |
83 | (readlink "bin/Guile")))))))) | |
84 | (built-derivations (list check))))) | |
850edd77 LC |
85 | |
86 | (test-end) | |
19c924af LC |
87 | |
88 | ;; Local Variables: | |
89 | ;; eval: (put 'test-assertm 'scheme-indent-function 2) | |
90 | ;; End: |