projects/guix·blob master · refs

96 lines · 2.9 KiB

1# GNU Guix --- Functional package management for GNU
2# Copyright © 2015-2016, 2019-2020, 2022-2023 Ludovic Courtès <[email protected]>
3# Copyright © 2019 Simon Tournier <[email protected]>
4#
5# This file is part of GNU Guix.
6#
7# GNU Guix is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or (at
10# your option) any later version.
11#
12# GNU Guix is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20#
21# Test the 'guix graph' command-line utility.
22#
23
24module_dir="t-guix-graph-$$"
25mkdir "$module_dir"
26
27tmpfile1="$module_dir/t-guix-graph1-$$"
28tmpfile2="$module_dir/t-guix-graph2-$$"
29trap 'rm -r "$module_dir"' EXIT
30
31
32cat > "$module_dir/foo.scm"<<EOF
33(define-module (foo)
34 #:use-module (guix packages)
35 #:use-module (gnu packages base))
36
37(define-public dummy
38 (package (inherit hello)
39 (name "dummy")
40 (version "42")
41 (synopsis "dummy package")
42 (description "dummy package. Only used for testing purposes.")))
43EOF
44
45
46guix graph --version
47
48for package in guile-bootstrap coreutils python
49do
50 for graph in package bag-emerged bag bag-with-origins
51 do
52 guix graph -t "$graph" "$package" | grep "$package"
53 done
54done
55
56guix build guile-bootstrap
57guix graph -t references guile-bootstrap | grep guile-bootstrap
58
59guix graph -e '(@ (gnu packages bootstrap) %bootstrap-guile)' \
60 | grep guile-bootstrap
61
62guix graph -e + && false
63
64# Try passing store file names.
65
66guix graph -t references guile-bootstrap > "$tmpfile1"
67guix graph -t references `guix build guile-bootstrap` > "$tmpfile2"
68cmp "$tmpfile1" "$tmpfile2"
69
70# XXX: Filter the file names in the graph to work around the fact that we get
71# a mixture of relative and absolute file names.
72guix graph -t derivation coreutils > "$tmpfile1"
73guix graph -t derivation `guix build -d coreutils` > "$tmpfile2"
74cmp "$tmpfile1" "$tmpfile2"
75
76# Try package transformation options.
77guix graph git | grep 'label = "openssl'
78guix graph git --with-input=openssl=libressl | grep 'label = "libressl'
79guix graph git --with-input=openssl=libressl | grep 'label = "openssl' && false
80
81# Try --load-path
82guix graph -L $module_dir dummy | grep 'label = "dummy'
83
84# Displaying shortest paths (or lack thereof).
85guix graph --path emacs vim && false
86
87path="\
88emacs
89cairo
90gobject-introspection
91libffi"
92test "`guix graph --path emacs libffi | cut -d '@' -f1`" = "$path"
93
94# At the derivation level, there's a direct path because libffi is propagated
95# via gtk+.
96test "`guix graph --path -t derivation emacs libffi | wc -l`" -ge 2