Update license headers.
[jackhill/guix/guix.git] / tests / guix-package.sh
1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2012 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-package' command-line utility.
21 #
22
23 guix-package --version
24
25 profile="t-profile-$$"
26 rm -f "$profile"
27
28 trap 'rm "$profile" "$profile-"[0-9]*' EXIT
29
30 guix-package -b -p "$profile" \
31 -i `guix-build -e '(@@ (distro packages base) %bootstrap-guile)'`
32 test -L "$profile" && test -L "$profile-1-link"
33 test -f "$profile/bin/guile"
34
35 # Installing the same package a second time does nothing.
36 guix-package -b -p "$profile" \
37 -i `guix-build -e '(@@ (distro packages base) %bootstrap-guile)'`
38 test -L "$profile" && test -L "$profile-1-link"
39 ! test -f "$profile-2-link"
40 test -f "$profile/bin/guile"
41
42 # Check whether we have network access.
43 if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
44 then
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"
49
50
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
63
64 test "`guix-package -p "$profile" -I 'g.*e' | cut -f1`" = "guile-bootstrap"
65
66 # Remove a package.
67 guix-package -b -p "$profile" -r "guile-bootstrap"
68 test -L "$profile-3-link"
69 test -f "$profile/bin/make" && ! test -f "$profile/bin/guile"
70 fi
71
72 # Make sure the `:' syntax works.
73 guix-package -b -i "libsigsegv:lib" -n
74
75 # Check whether `--list-available' returns something sensible.
76 guix-package -A 'gui.*e' | grep guile
77