mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
guix graph: '--path' defaults to "out" in the case of multiple outputs.
Previously, "guix graph -t references --graph guix guile" would fail with: no path from '/gnu/store/…-guix-1.4.0-1.9fe5b49' to '/gnu/store/…-guile-3.0.8-debug' simply because the "debug" happened to be the first one, getting bound to NODE2. With this change it will instead pick the "out" output of each. * guix/scripts/graph.scm (guix-graph)[shorter?, length-sorted]: New procedures. In the 'path?' case, use the latter to store node lists.
This commit is contained in:
parent
a4a35e123b
commit
99e255d04b
1 changed files with 11 additions and 1 deletions
|
@ -569,6 +569,12 @@ (define-command (guix-graph . args)
|
|||
(category packaging)
|
||||
(synopsis "view and query package dependency graphs")
|
||||
|
||||
(define (shorter? str1 str2)
|
||||
(< (string-length str1) (string-length str2)))
|
||||
|
||||
(define length-sorted
|
||||
(cut sort <> shorter?))
|
||||
|
||||
(with-error-handling
|
||||
(define opts
|
||||
(parse-command-line args %options
|
||||
|
@ -603,8 +609,12 @@ (define type
|
|||
(node-type-convert type)
|
||||
(reverse items))))
|
||||
(if (assoc-ref opts 'path?)
|
||||
;; Sort by string length such that, in case of multiple
|
||||
;; outputs, the shortest one (which corresponds to "out") is
|
||||
;; picked (yup, a hack).
|
||||
(match nodes
|
||||
(((node1 _ ...) (node2 _ ...))
|
||||
(((= length-sorted (node1 _ ...))
|
||||
(= length-sorted (node2 _ ...)))
|
||||
(display-path node1 node2 type))
|
||||
(_
|
||||
(leave (G_ "'--path' option requires exactly two \
|
||||
|
|
Loading…
Reference in a new issue