aboutsummaryrefslogtreecommitdiff
path: root/tests/guix-system.sh
blob: de6db0928ca8f50dcc149a7d72509dbcfdbaeefb (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# GNU Guix --- Functional package management for GNU
# Copyright © 2014, 2015, 2016 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 'guix system', mostly error reporting.
#

set -e

guix system --version

tmpfile="t-guix-system-$$"
errorfile="t-guix-system-error-$$"

# Note: This directory is chosen outside $builddir so that relative file name
# canonicalization doesn't mess up with 'current-source-directory', used by
# 'local-file' ('load' forces 'relative' for
# %FILE-PORT-NAME-CANONICALIZATION.)
tmpdir="${TMPDIR:-/tmp}/t-guix-system-$$"
mkdir "$tmpdir"

trap 'rm -f "$tmpfile" "$errorfile" "$tmpdir"/*; rmdir "$tmpdir"' EXIT

# Reporting of syntax errors.

cat > "$tmpfile"<<EOF
;; This is line 1, and the next one is line 2.
   (operating-system)
;; The 'T' is at column 3.
EOF

if guix system vm "$tmpfile" 2> "$errorfile"
then
    # This must not succeed.
    exit 1
else
    grep "$tmpfile:2:3:.*missing.* initializers" "$errorfile"
fi


# Reporting of unbound variables.

cat > "$tmpfile" <<EOF
(use-modules (gnu))                                   ; 1
(use-service-modules networking)                      ; 2

(operating-system                                     ; 4
  (host-name "antelope")                              ; 5
  (timezone "Europe/Paris")                           ; 6
  (locale "en_US.UTF-8")                              ; 7

  (bootloader (GRUB-config (device "/dev/sdX")))      ; 9
  (file-systems (cons (file-system
                        (device "root")
                        (title 'label)
                        (mount-point "/")
                        (type "ext4"))
                      %base-file-systems)))
EOF

if guix system build "$tmpfile" -n 2> "$errorfile"
then false
else
    if test "`guile -c '(display (effective-version))'`" = 2.2
    then
	# FIXME: With Guile 2.2.0 the error is reported on line 4.
	# See <http://bugs.gnu.org/26107>.
	grep "$tmpfile:[49]:.*[Uu]nbound variable.*GRUB-config" "$errorfile"
    else
	grep "$tmpfile:9:.*[Uu]nbound variable.*GRUB-config" "$errorfile"
    fi
fi

OS_BASE='
  (host-name "antelope")
  (timezone "Europe/Paris")
  (locale "en_US.UTF-8")

  (bootloader (grub-configuration (device "/dev/sdX")))
  (file-systems (cons (file-system
                        (device "root")
                        (title (string->symbol "label"))
                        (mount-point "/")
                        (type "ext4"))
                      %base-file-systems))
'

# Reporting of duplicate service identifiers.

cat > "$tmpfile" <<EOF
(use-modules (gnu))
(use-service-modules networking)

(operating-system
  $OS_BASE
  (services (cons* (dhcp-client-service)
                   (dhcp-client-service) ;twice!
                   %base-services)))
EOF

if guix system vm "$tmpfile" 2> "$errorfile"
then
    # This must not succeed.
    exit 1
else
    grep "service 'networking'.*more than once" "$errorfile"
fi

# Reporting unmet shepherd requirements.

cat > "$tmpfile" <<EOF
(use-modules (gnu) (gnu services shepherd))
(use-service-modules networking)

(define buggy-service-type
  (shepherd-service-type
    'buggy
    (lambda _
      (shepherd-service
        (provision '(buggy!))
        (requirement '(does-not-exist))
        (start #t)))))

(operating-system
  $OS_BASE
  (services (cons (service buggy-service-type #t)
                  %base-services)))
EOF

if guix system build "$tmpfile" 2> "$errorfile"
then
    exit 1
else
    grep "service 'buggy!'.*'does-not-exist'.*not provided" "$errorfile"
fi

# Reporting inconsistent user accounts.

make_user_config ()
{
    cat > "$tmpfile" <<EOF
(use-modules (gnu))
(use-service-modules networking)

(operating-system
  (host-name "antelope")
  (timezone "Europe/Paris")
  (locale "en_US.UTF-8")

  (bootloader (grub-configuration (device "/dev/sdX")))
  (file-systems (cons (file-system
                        (device "root")
                        (title 'label)
                        (mount-point "/")
                        (type "ext4"))
                      %base-file-systems))
  (users (list (user-account
                 (name "dave")
                 (home-directory "/home/dave")
                 (group "$1")
                 (supplementary-groups '("$2"))))))
EOF
}

make_user_config "users" "wheel"
guix system build "$tmpfile" -n       # succeeds

guix system build "$tmpfile" -d	      # succeeds
guix system build "$tmpfile" -d | grep '\.drv$'

guix system vm "$tmpfile" -d	      # succeeds
guix system vm "$tmpfile" -d | grep '\.drv$'

make_user_config "group-that-does-not-exist" "users"
if guix system build "$tmpfile" -n 2> "$errorfile"
then false
else grep "primary group.*group-that-does-not-exist.*undeclared" "$errorfile"; fi

make_user_config "users" "group-that-does-not-exist"
if guix system build "$tmpfile" -n 2> "$errorfile"
then false
else grep "supplementary group.*group-that-does-not-exist.*undeclared" "$errorfile"; fi

# Try 'local-file' and relative file name resolution.

cat > "$tmpdir/config.scm"<<EOF
(use-modules (gnu))
(use-service-modules networking)

(operating-system
  $OS_BASE
  (services (cons (tor-service (local-file "my-torrc"))
                  %base-services)))
EOF

cat > "$tmpdir/my-torrc"<<EOF
# This is an example file.
EOF

# In both cases 'my-torrc' should be properly resolved.
guix system build "$tmpdir/config.scm" -n
(cd "$tmpdir"; guix system build "config.scm" -n)
bksba: Update to 1.3.0.Andreas Enge * gnu/packages/gnupg.scm (libksba): Update to 1.3.0. 2013-09-25gnu: libgcrypt: Update to 1.5.3Andreas Enge * gnu/packages/gnupg.scm (libgcrypt): Update to 1.5.3. 2013-09-25gnu: gnupg: Update to 2.0.21.Andreas Enge * gnu/packages/gnupg.scm (gnupg): Update to 2.0.21. 2013-09-25gnu: pspp: Update to 0.8.1.Andreas Enge * gnu/packages/maths.scm (pspp): Update to 0.8.1. 2013-09-25gnu: fontconfig: Add and register gs-fonts.Andreas Enge * gnu/packages/fontutils.scm (fontconfig): Add gs-fonts as an input and register it in the configuration file; so any porgram using fontconfig should at least have the gs-fonts at its disposal. 2013-09-25gnu: m4: Upgrade to 1.4.17.Ludovic Courtès * gnu/packages/m4.scm (m4): Upgrade to 1.4.17. Remove 'm4-s_isdir.patch' and 'm4-gets-undeclared.patch'. * gnu/packages/patches/m4-s_isdir.patch: Remove. * gnu-system.am (dist_patch_DATA): Adjust accordingly. 2013-09-25gnu: guix: Rework 0.4 hack to gracefully handle lack of tarball.Ludovic Courtès * gnu/packages/package-management.scm (guix-0.4): Fall back to the source of GIUX when the tarball doesn't exist. 2013-09-24gnu: vm: Add a service for the Guix daemon.Ludovic Courtès * gnu/system/dmd.scm (guix-service): New procedure. * gnu/system/vm.scm (system-qemu-image): Use it. 2013-09-24gnu: vm: Initialize the image's store.Ludovic Courtès * gnu/system/vm.scm (qemu-image): Add 'initialize-store?' keyword parameter. Use 'guix-register' when INITIALIZE-STORE? is true. (system-qemu-image): Pass #:initialize-store? #t. 2013-09-24gnu: guix: Set $localstatedir; add gzip as input.Ludovic Courtès * gnu/packages/package-management.scm (guix): Add "--localstatedir=/var". Add GZIP as an explicit input, to avoid referring to the final gzip. 2013-09-24guix-register: Allow the initial directory creation to proceed.Ludovic Courtès This fixes a bug whereby 'guix-register' would bail out when trying to create NIX_STORE_DIR/.links when NIX_STORE_DIR is read-only. * nix/guix-register/guix-register.cc (parse_opt): Initialize 'settings.nixStore' to PREFIX + NIX_STORE_DIR. (main): Change 'settings.nixStore' once the 'LocalStore' has been instantiated. 2013-09-24gnu: racket: Add dependency on GTK+.Ludovic Courtès * gnu/packages/scheme.scm (racket): Add dependency on GTK+ and gdk-pixbuf. 2013-09-24gnu: xorg: Fix xorg-server.Andreas Enge * gnu/packages/xorg.scm (xkbcomp-intermediate): New variable, serves as input to xkeyboard-config. * gnu/packages/xorg.scm (xkeyboard-config): Add input xkbcomp-intermediate. * gnu/packages/xorg.scm (xkbcomp): Add input xkeyboard-config. * gnu/packages/xorg.scm (xorg-server): Adapt xkb paths and replace references to /bin/sh (with Ludovic Courtès <ludo@gnu.org>). 2013-09-23guix-register: Expect closures to refer to the original store.Ludovic Courtès * nix/guix-register/guix-register.cc (prefix): New variable. (parse_opt): Use it. (register_validity): Change 'info.path' to the final store name. Hash the final under its real path. * tests/guix-register.sh: Adjust the contents of $closure accordingly. Rename 'NIX_LOCALSTATE_DIR' to 'NIX_STATE_DIR'. Don't try to call 'valid-path?'. Add test using 'sqlite3'. 2013-09-23list-packages: Progressive Enhancement approach to JS.Alex Sassmannshausen * build-aux/list-packages.scm (package->sxml): Add parameters previous, description-ids and remaining, update docstring accordingly. Introduce logic for fold-values process. (insert-tr): Moved sxml package table-row generation to new function; remove <a> elements and JS function calls. These are created through JS (prep_pkg_descs). Add insert-js-call for every 15th package, and the last. (insert-js-call): New function. (packages->sxml): Change map to fold values; add init params. (insert-js): show_hide: add compatibility check, introduce, use thingLink prep: new JS function. bulk_show_hide: new JS function. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2013-09-23gnu: mutt: Add SASL for authenticated SMTP.Andreas Enge * gnu/packages/mail.scm (mutt): Add input cyrus-sasl. 2013-09-23Merge branch 'master' into core-updatesLudovic Courtès 2013-09-23build: check-available-binaries: Adjust to derivation API change.Ludovic Courtès * build-aux/check-available-binaries.scm: Use 'derivation->output-path' instead of 'derivation-path->output-path'. 2013-09-23nar: Fix file descriptor leak when writing a Nar.Ludovic Courtès * guix/nar.scm (write-contents)[call-with-binary-input-file]: Always close PORT. 2013-09-23doc: Document '--list-generations' among the query options.Ludovic Courtès * doc/guix.texi (Invoking guix package): Move '--list-generations' below "In addition to these actions".