Update license headers.
[jackhill/guix/guix.git] / tests / guix-package.sh
CommitLineData
233e7676
LC
1# GNU Guix --- Functional package management for GNU
2# Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
0afdc485 3#
233e7676 4# This file is part of GNU Guix.
0afdc485 5#
233e7676 6# GNU Guix is free software; you can redistribute it and/or modify it
0afdc485
LC
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#
233e7676 11# GNU Guix is distributed in the hope that it will be useful, but
0afdc485
LC
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
233e7676 17# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
0afdc485
LC
18
19#
20# Test the `guix-package' command-line utility.
21#
22
23guix-package --version
24
25profile="t-profile-$$"
26rm -f "$profile"
27
7a6548cb
LC
28trap 'rm "$profile" "$profile-"[0-9]*' EXIT
29
0afdc485
LC
30guix-package -b -p "$profile" \
31 -i `guix-build -e '(@@ (distro packages base) %bootstrap-guile)'`
32test -L "$profile" && test -L "$profile-1-link"
33test -f "$profile/bin/guile"
34
1c67d639
LC
35# Installing the same package a second time does nothing.
36guix-package -b -p "$profile" \
37 -i `guix-build -e '(@@ (distro packages base) %bootstrap-guile)'`
38test -L "$profile" && test -L "$profile-1-link"
39! test -f "$profile-2-link"
40test -f "$profile/bin/guile"
0afdc485 41
ad1ebab3
LC
42# Check whether we have network access.
43if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
44then
45 guix-package -b -p "$profile" \
46 -i `guix-build -e '(@@ (distro packages base) gnu-make-boot0)'`
47 test -L "$profile-2-link"
48 test -f "$profile/bin/make" && test -f "$profile/bin/guile"
0afdc485 49
733b4130 50
ad1ebab3
LC
51 # Check whether `--list-installed' works.
52 # XXX: Change the tests when `--install' properly extracts the package
53 # name and version string.
54 installed="`guix-package -p "$profile" --list-installed | cut -f1 | xargs echo | sort`"
55 case "x$installed" in
56 "guile-bootstrap make-boot0")
57 true;;
58 "make-boot0 guile-bootstrap")
59 true;;
60 "*")
61 false;;
62 esac
733b4130 63
ad1ebab3 64 test "`guix-package -p "$profile" -I 'g.*e' | cut -f1`" = "guile-bootstrap"
733b4130 65
ad1ebab3 66 # Remove a package.
1e982451 67 guix-package -b -p "$profile" -r "guile-bootstrap"
ad1ebab3
LC
68 test -L "$profile-3-link"
69 test -f "$profile/bin/make" && ! test -f "$profile/bin/guile"
70fi
0afdc485 71
9518856b
LC
72# Make sure the `:' syntax works.
73guix-package -b -i "libsigsegv:lib" -n
74
64fc89b6
LC
75# Check whether `--list-available' returns something sensible.
76guix-package -A 'gui.*e' | grep guile
77