aboutsummaryrefslogtreecommitdiff
path: root/tests/guix-pack-localstatedir.sh
blob: 042887ea9b326c22ed732fde4b32a8ad8d2e212b (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# GNU Guix --- Functional package management for GNU
# Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
# GNU Guix is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Guix is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

#
# Test the 'guix pack --localstatedir' command-line utility.
#

guix pack --version

# 'guix pack --localstatedir' produces derivations that depend on
# guile-sqlite3 and guile-gcrypt.  To make that relatively inexpensive, run
# the test in the user's global store if possible, on the grounds that
# binaries may already be there or can be built or downloaded inexpensively.

storedir="`guile -c '(use-modules (guix config))(display %storedir)'`"
localstatedir="`guile -c '(use-modules (guix config))(display %localstatedir)'`"
NIX_STORE_DIR="$storedir"
GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket"
export NIX_STORE_DIR GUIX_DAEMON_SOCKET

if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connection)))'
then
    exit 77
fi

# Build a tarball with '--localstatedir'
the_pack="`guix pack -C none --localstatedir --profile-name=current-guix \
            guile-bootstrap`"
test_directory="`mktemp -d`"
trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT

cd "$test_directory"
tar -xf "$the_pack"

profile="`find -name current-guix`"
test "`readlink $profile`" = "current-guix-1-link"
test -s "`dirname $profile`/../../../db/db.sqlite"
test -x ".`guix build guile-bootstrap`/bin/guile"
cd -

# Make sure the store database is not completely bogus.
guile -c "(use-modules (sqlite3) (guix config) (ice-9 match))

  (define db
    (sqlite-open (string-append \"$test_directory\"
                                %localstatedir
                               \"/guix/db/db.sqlite\")
                 SQLITE_OPEN_READONLY))

  (define stmt
    (sqlite-prepare db \"SELECT * FROM ValidPaths;\"))

  (match (sqlite-fold cons '() stmt)
    ((#(ids paths hashes times derivers sizes) ...)
     (exit (member \"`guix build guile-bootstrap`\" paths))))"
ghlight'> * gnu/packages/guile.scm (guile-next): Update to 2.1.3. 2016-06-20gnu: Add argon2.Lukas Gradl * gnu/packages/password-utils.scm (argon2): New variable. Signed-off-by: Leo Famulari <leo@famulari.name> 2016-06-20gnu: git: Update to 2.9.0Leo Famulari * gnu/packages/version-control.scm (git): Update to 2.9.0. (git-manpages)[source]: Update hash. 2016-06-20gnu: chicken: Update to 4.11.0 [fixes CVE-2014-9651].Efraim Flashner * gnu/packages/scheme.scm (chicken): Update to 4.11.0. 2016-06-20gnu: Add quesoglc.Kei Kebreau * gnu/packages/game-development.scm (quesoglc): New variable. 2016-06-20gnu: perl-uri: Update to 1.71.ng0 * gnu/packages/web.scm (perl-uri): Update to 1.71. Signed-off-by: 宋文武 <iyzsong@gmail.com> 2016-06-20gnu: Add guile-dbd-sqlite3.宋文武 * gnu/packages/guile.scm (guile-dbd-sqlite3): New variable. 2016-06-20gnu: Add guile-dbi.宋文武 * gnu/packages/guile.scm (guile-dbi): New variable. 2016-06-20gnu: screen: Update to 4.4.0.Efraim Flashner * gnu/packages/screen.scm (screen): Update to 4.4.0. 2016-06-20gnu: Add emacs-lispy.Ricardo Wurmus * gnu/packages/emacs.scm (emacs-lispy): New variable. 2016-06-20gnu: Add emacs-iedit.Ricardo Wurmus * gnu/packages/emacs.scm (emacs-iedit): New variable. 2016-06-20gnu: Add emacs-ace-window.Ricardo Wurmus * gnu/packages/emacs.scm (emacs-ace-window): New variable. 2016-06-20gnu: Add emacs-avy.Ricardo Wurmus * gnu/packages/emacs.scm (emacs-avy): New variable. 2016-06-20gnu: Add emacs-ivy.Ricardo Wurmus * gnu/packages/emacs.scm (emacs-ivy): New variable. 2016-06-20