diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2018-10-20 19:28:05 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2018-11-23 15:42:01 +0100 |
| commit | 08f410834bffbe1e55633a0a4c87caba69d7fa92 (patch) | |
| tree | 1013c1a9c3f92382c5cd6750d15d1cd36ba76326 /tests/guix-pack-localstatedir.sh | |
| parent | 4bd5b9707e14bd5ad4da6868687ff3c642705ce3 (diff) | |
pack: Add '--profile-name'.
* guix/scripts/pack.scm (self-contained-tarball): Add #:profile-name and
honor it.
(squashfs-image, docker-image): Add #:profile-name.
(%default-options): Add 'profile-name'.
(%options, show-help): Add "--profile-name".
(guix-pack): Honor it.
* tests/guix-pack-localstatedir.sh: New file.
* Makefile.am (SH_TESTS): Add it.
* doc/guix.texi (Invoking guix pack): Document "--profile-name".
Diffstat (limited to 'tests/guix-pack-localstatedir.sh')
| -rw-r--r-- | tests/guix-pack-localstatedir.sh | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/guix-pack-localstatedir.sh b/tests/guix-pack-localstatedir.sh new file mode 100644 index 00000000000..b734b0f7e3a --- /dev/null +++ b/tests/guix-pack-localstatedir.sh | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | # GNU Guix --- Functional package management for GNU | ||
| 2 | # Copyright © 2018 Ludovic Courtès <ludo@gnu.org> | ||
| 3 | # | ||
| 4 | # This file is part of GNU Guix. | ||
| 5 | # | ||
| 6 | # GNU Guix is free software; you can redistribute it and/or modify it | ||
| 7 | # under the terms of the GNU General Public License as published by | ||
| 8 | # the Free Software Foundation; either version 3 of the License, or (at | ||
| 9 | # your option) any later version. | ||
| 10 | # | ||
| 11 | # GNU Guix is distributed in the hope that it will be useful, but | ||
| 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | # GNU General Public License for more details. | ||
| 15 | # | ||
| 16 | # You should have received a copy of the GNU General Public License | ||
| 17 | # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | # | ||
| 20 | # Test the 'guix pack --localstatedir' command-line utility. | ||
| 21 | # | ||
| 22 | |||
| 23 | guix pack --version | ||
| 24 | |||
| 25 | # 'guix pack --localstatedir' produces derivations that depend on | ||
| 26 | # guile-sqlite3 and guile-gcrypt. To make that relatively inexpensive, run | ||
| 27 | # the test in the user's global store if possible, on the grounds that | ||
| 28 | # binaries may already be there or can be built or downloaded inexpensively. | ||
| 29 | |||
| 30 | NIX_STORE_DIR="`guile -c '(use-modules (guix config))(display %storedir)'`" | ||
| 31 | localstatedir="`guile -c '(use-modules (guix config))(display %localstatedir)'`" | ||
| 32 | GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket" | ||
| 33 | export NIX_STORE_DIR GUIX_DAEMON_SOCKET | ||
| 34 | |||
| 35 | if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connection)))' | ||
| 36 | then | ||
| 37 | exit 77 | ||
| 38 | fi | ||
| 39 | |||
| 40 | # Build a tarball with '--localstatedir' | ||
| 41 | the_pack="`guix pack -C none --localstatedir --profile-name=current-guix \ | ||
| 42 | guile-bootstrap`" | ||
| 43 | test_directory="`mktemp -d`" | ||
| 44 | trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT | ||
| 45 | |||
| 46 | cd "$test_directory" | ||
| 47 | tar -xf "$the_pack" | ||
| 48 | |||
| 49 | profile="`find -name current-guix`" | ||
| 50 | test "`readlink $profile`" = "current-guix-1-link" | ||
| 51 | test -s "`dirname $profile`/../../../db/db.sqlite" | ||
| 52 | test -x ".`guix build guile-bootstrap`/bin/guile" | ||
| 53 | cd - | ||
| 54 | |||
| 55 | # Make sure the store database is not completely bogus. | ||
| 56 | guile -c "(use-modules (sqlite3) (guix config) (ice-9 match)) | ||
| 57 | |||
| 58 | (define db | ||
| 59 | (sqlite-open (string-append \"$test_directory\" | ||
| 60 | %localstatedir | ||
| 61 | \"/guix/db/db.sqlite\") | ||
| 62 | SQLITE_OPEN_READONLY)) | ||
| 63 | |||
| 64 | (define stmt | ||
| 65 | (sqlite-prepare db \"SELECT * FROM ValidPaths;\")) | ||
| 66 | |||
| 67 | (match (sqlite-fold cons '() stmt) | ||
| 68 | ((#(ids paths hashes times derivers sizes) ...) | ||
| 69 | (exit (member \"`guix build guile-bootstrap`\" paths))))" | ||
