diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2018-11-03 21:53:07 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2018-11-06 23:21:24 +0100 |
| commit | f5a2fb1bfbb620a6ce23ac0e7e15132cae9207da (patch) | |
| tree | 719fd280f76e0f41fb2b6f339fa696d7735cd817 /tests/pack.scm | |
| parent | c5ce2db56909e7dd3fdcd30fa453272d56b07451 (diff) | |
pack: Docker backend now honors '--localstatedir'.
* guix/docker.scm (build-docker-image): Add #:database parameter.
Create /var/guix/db, /var/guix/profiles, etc. when DATABASE is true.
* guix/scripts/pack.scm (docker-image): Export. Remove #:deduplicate?
parameter. Define 'database' and pass it to 'docker-image'.
* tests/pack.scm (test-assertm): Recompile the derivation of
%BOOTSTRAP-GUILE.
("docker-image + localstatedir"): New test.
Diffstat (limited to 'tests/pack.scm')
| -rw-r--r-- | tests/pack.scm | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/tests/pack.scm b/tests/pack.scm index 6bd18bdee29..bfff802d8ac 100644 --- a/tests/pack.scm +++ b/tests/pack.scm | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #:use-module (guix store) | 22 | #:use-module (guix store) |
| 23 | #:use-module (guix derivations) | 23 | #:use-module (guix derivations) |
| 24 | #:use-module (guix profiles) | 24 | #:use-module (guix profiles) |
| 25 | #:use-module (guix packages) | ||
| 25 | #:use-module (guix monads) | 26 | #:use-module (guix monads) |
| 26 | #:use-module (guix grafts) | 27 | #:use-module (guix grafts) |
| 27 | #:use-module (guix tests) | 28 | #:use-module (guix tests) |
| @@ -37,8 +38,9 @@ | |||
| 37 | 38 | ||
| 38 | (define-syntax-rule (test-assertm name store exp) | 39 | (define-syntax-rule (test-assertm name store exp) |
| 39 | (test-assert name | 40 | (test-assert name |
| 40 | (run-with-store store exp | 41 | (let ((guile (package-derivation store %bootstrap-guile))) |
| 41 | #:guile-for-build (%guile-for-build)))) | 42 | (run-with-store store exp |
| 43 | #:guile-for-build guile)))) | ||
| 42 | 44 | ||
| 43 | (define %gzip-compressor | 45 | (define %gzip-compressor |
| 44 | ;; Compressor that uses the bootstrap 'gzip'. | 46 | ;; Compressor that uses the bootstrap 'gzip'. |
| @@ -79,6 +81,53 @@ | |||
| 79 | (readlink "bin/Guile")))))))) | 81 | (readlink "bin/Guile")))))))) |
| 80 | (built-derivations (list check)))) | 82 | (built-derivations (list check)))) |
| 81 | 83 | ||
| 84 | ;; The following test needs guile-sqlite3, libgcrypt, etc. as a consequence of | ||
| 85 | ;; commit c45477d2a1a651485feede20fe0f3d15aec48b39 and related changes. Thus, | ||
| 86 | ;; run it on the user's store, if it's available, on the grounds that these | ||
| 87 | ;; dependencies may be already there, or we can get substitutes or build them | ||
| 88 | ;; quite inexpensively; see <https://bugs.gnu.org/32184>. | ||
| 89 | |||
| 90 | (with-external-store store | ||
| 91 | (unless store (test-skip 1)) | ||
| 92 | (test-assertm "docker-image + localstatedir" store | ||
| 93 | (mlet* %store-monad | ||
| 94 | ((guile (set-guile-for-build (default-guile))) | ||
| 95 | (profile (profile-derivation (packages->manifest | ||
| 96 | (list %bootstrap-guile)) | ||
| 97 | #:hooks '() | ||
| 98 | #:locales? #f)) | ||
| 99 | (tarball (docker-image "docker-pack" profile | ||
| 100 | #:symlinks '(("/bin/Guile" -> "bin/guile")) | ||
| 101 | #:localstatedir? #t)) | ||
| 102 | (check (gexp->derivation | ||
| 103 | "check-tarball" | ||
| 104 | (with-imported-modules '((guix build utils)) | ||
| 105 | #~(begin | ||
| 106 | (use-modules (guix build utils) | ||
| 107 | (ice-9 match)) | ||
| 108 | |||
| 109 | (define bin | ||
| 110 | (string-append "." #$profile "/bin")) | ||
| 111 | |||
| 112 | (setenv "PATH" (string-append #$%tar-bootstrap "/bin")) | ||
| 113 | (mkdir "base") | ||
| 114 | (with-directory-excursion "base" | ||
| 115 | (invoke "tar" "xvf" #$tarball)) | ||
| 116 | |||
| 117 | (match (find-files "base" "layer.tar") | ||
| 118 | ((layer) | ||
| 119 | (invoke "tar" "xvf" layer))) | ||
| 120 | |||
| 121 | (when | ||
| 122 | (and (file-exists? (string-append bin "/guile")) | ||
| 123 | (file-exists? "var/guix/db/db.sqlite") | ||
| 124 | (string=? (string-append #$%bootstrap-guile "/bin") | ||
| 125 | (pk 'binlink (readlink bin))) | ||
| 126 | (string=? (string-append #$profile "/bin/guile") | ||
| 127 | (pk 'guilelink (readlink "bin/Guile")))) | ||
| 128 | (mkdir #$output))))))) | ||
| 129 | (built-derivations (list check))))) | ||
| 130 | |||
| 82 | (test-end) | 131 | (test-end) |
| 83 | 132 | ||
| 84 | ;; Local Variables: | 133 | ;; Local Variables: |
