guix graph: Add '--path'.

* guix/scripts/graph.scm (display-path): New procedure.
(%options, show-help): Add '--path'.
(guix-graph): Handle it.
* tests/guix-graph.sh: Add tests.
* doc/guix.texi (Invoking guix graph): Document it.
(Invoking guix size): Mention it.
This commit is contained in:
Ludovic Courtès 2020-05-10 00:53:29 +02:00
parent 36c2192414
commit 88a96c568c
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 102 additions and 8 deletions

View file

@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
# Copyright © 2015, 2016, 2019 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2015, 2016, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
#
# This file is part of GNU Guix.
@ -82,3 +82,17 @@ then false; else true; fi
# Try --load-path
guix graph -L $module_dir dummy | grep 'label = "dummy'
# Displaying shortest paths (or lack thereof).
if guix graph --path emacs vim; then false; else true; fi
path="\
emacs
gnutls
guile
libffi"
test "`guix graph --path emacs libffi | cut -d '@' -f1`" = "$path"
# At the derivation level, there's a direct path because libffi is propagated
# via gtk+.
test "`guix graph --path -t derivation emacs libffi | wc -l`" -ge 2