2015-08-27 00:36:41 +02:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2018-03-27 14:00:48 +02:00
|
|
|
|
;;; Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
2015-08-27 00:36:41 +02:00
|
|
|
|
;;;
|
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
|
;;; your option) any later version.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
|
;;;
|
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
(define-module (guix scripts graph)
|
|
|
|
|
#:use-module (guix ui)
|
2015-11-21 13:12:02 +01:00
|
|
|
|
#:use-module (guix graph)
|
2016-02-27 23:06:50 +01:00
|
|
|
|
#:use-module (guix grafts)
|
2015-09-10 11:37:36 +02:00
|
|
|
|
#:use-module (guix scripts)
|
2015-08-27 00:36:41 +02:00
|
|
|
|
#:use-module (guix packages)
|
|
|
|
|
#:use-module (guix monads)
|
|
|
|
|
#:use-module (guix store)
|
|
|
|
|
#:use-module (guix gexp)
|
|
|
|
|
#:use-module (guix derivations)
|
Add (guix memoization).
* guix/combinators.scm (memoize): Remove.
* guix/memoization.scm: New file.
* Makefile.am (MODULES): Add it.
* gnu/packages.scm, gnu/packages/bootstrap.scm,
guix/build-system/gnu.scm, guix/build-system/python.scm,
guix/derivations.scm, guix/gnu-maintenance.scm,
guix/import/cran.scm, guix/import/elpa.scm,
guix/modules.scm, guix/scripts/build.scm,
guix/scripts/graph.scm, guix/scripts/lint.scm,
guix/store.scm, guix/utils.scm: Adjust imports accordingly.
2017-01-28 16:33:57 +01:00
|
|
|
|
#:use-module (guix memoization)
|
2018-03-27 14:00:48 +02:00
|
|
|
|
#:use-module (guix modules)
|
2015-08-27 00:36:41 +02:00
|
|
|
|
#:use-module ((guix build-system gnu) #:select (standard-packages))
|
|
|
|
|
#:use-module (gnu packages)
|
|
|
|
|
#:use-module (guix sets)
|
2018-03-27 14:00:48 +02:00
|
|
|
|
#:use-module ((guix utils) #:select (location-file))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
#:use-module (srfi srfi-1)
|
2015-11-23 23:31:53 +01:00
|
|
|
|
#:use-module (srfi srfi-26)
|
2015-08-27 00:36:41 +02:00
|
|
|
|
#:use-module (srfi srfi-34)
|
2016-05-20 17:07:23 +02:00
|
|
|
|
#:use-module (srfi srfi-35)
|
2015-08-27 00:36:41 +02:00
|
|
|
|
#:use-module (srfi srfi-37)
|
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
|
#:export (%package-node-type
|
2017-01-04 16:16:17 +01:00
|
|
|
|
%reverse-package-node-type
|
2015-08-27 00:36:41 +02:00
|
|
|
|
%bag-node-type
|
2015-11-23 23:31:53 +01:00
|
|
|
|
%bag-with-origins-node-type
|
2015-08-27 00:36:41 +02:00
|
|
|
|
%bag-emerged-node-type
|
|
|
|
|
%derivation-node-type
|
|
|
|
|
%reference-node-type
|
2016-10-15 22:47:42 +02:00
|
|
|
|
%referrer-node-type
|
2018-03-27 14:00:48 +02:00
|
|
|
|
%module-node-type
|
2015-08-27 21:32:23 +02:00
|
|
|
|
%node-types
|
|
|
|
|
|
2015-08-27 00:36:41 +02:00
|
|
|
|
guix-graph))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Package DAG.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define (node-full-name thing)
|
|
|
|
|
"Return a human-readable name to denote THING, a package, origin, or file
|
|
|
|
|
name."
|
|
|
|
|
(cond ((package? thing)
|
|
|
|
|
(package-full-name thing))
|
|
|
|
|
((origin? thing)
|
2015-09-10 22:39:44 +02:00
|
|
|
|
(origin-actual-file-name thing))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
((string? thing) ;file name
|
|
|
|
|
(or (basename thing)
|
|
|
|
|
(error "basename" thing)))
|
|
|
|
|
(else
|
|
|
|
|
(number->string (object-address thing) 16))))
|
|
|
|
|
|
|
|
|
|
(define (package-node-edges package)
|
|
|
|
|
"Return the list of dependencies of PACKAGE."
|
|
|
|
|
(match (package-direct-inputs package)
|
|
|
|
|
(((labels packages . outputs) ...)
|
|
|
|
|
;; Filter out origins and other non-package dependencies.
|
|
|
|
|
(filter package? packages))))
|
|
|
|
|
|
2016-05-20 17:07:23 +02:00
|
|
|
|
(define assert-package
|
|
|
|
|
(match-lambda
|
|
|
|
|
((? package? package)
|
|
|
|
|
package)
|
|
|
|
|
(x
|
|
|
|
|
(raise
|
|
|
|
|
(condition
|
|
|
|
|
(&message
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(message (format #f (G_ "~a: invalid argument (package name expected)")
|
2016-05-20 17:07:23 +02:00
|
|
|
|
x))))))))
|
|
|
|
|
|
|
|
|
|
(define nodes-from-package
|
|
|
|
|
;; The default conversion method.
|
|
|
|
|
(lift1 (compose list assert-package) %store-monad))
|
|
|
|
|
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(define %package-node-type
|
|
|
|
|
;; Type for the traversal of package nodes.
|
|
|
|
|
(node-type
|
|
|
|
|
(name "package")
|
|
|
|
|
(description "the DAG of packages, excluding implicit inputs")
|
2016-05-20 17:07:23 +02:00
|
|
|
|
(convert nodes-from-package)
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
|
|
|
|
;; We use package addresses as unique identifiers. This generally works
|
|
|
|
|
;; well, but for generated package objects, we could end up with two
|
|
|
|
|
;; packages that are not 'eq?', yet map to the same derivation (XXX).
|
|
|
|
|
(identifier (lift1 object-address %store-monad))
|
|
|
|
|
(label node-full-name)
|
|
|
|
|
(edges (lift1 package-node-edges %store-monad))))
|
|
|
|
|
|
2017-01-04 16:16:17 +01:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Reverse package DAG.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define %reverse-package-node-type
|
|
|
|
|
;; For this node type we first need to compute the list of packages and the
|
|
|
|
|
;; list of back-edges. Since we want to do it only once, we use the
|
|
|
|
|
;; promises below.
|
|
|
|
|
(let* ((packages (delay (fold-packages cons '())))
|
|
|
|
|
(back-edges (delay (run-with-store #f ;store not actually needed
|
|
|
|
|
(node-back-edges %package-node-type
|
|
|
|
|
(force packages))))))
|
|
|
|
|
(node-type
|
|
|
|
|
(inherit %package-node-type)
|
|
|
|
|
(name "reverse-package")
|
|
|
|
|
(description "the reverse DAG of packages")
|
|
|
|
|
(edges (lift1 (force back-edges) %store-monad)))))
|
|
|
|
|
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Package DAG using bags.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define (bag-node-identifier thing)
|
|
|
|
|
"Return a unique identifier for THING, which may be a package, origin, or a
|
|
|
|
|
file name."
|
|
|
|
|
;; If THING is a file name (a string), we just return it; if it's a package
|
|
|
|
|
;; or origin, we return its address. That gives us the object graph, but
|
|
|
|
|
;; that may differ from the derivation graph (for instance,
|
|
|
|
|
;; 'package-with-bootstrap-guile' generates fresh package objects, and
|
|
|
|
|
;; several packages that are not 'eq?' may actually map to the same
|
|
|
|
|
;; derivation.) Thus, we lower THING and use its derivation file name as a
|
|
|
|
|
;; unique identifier.
|
|
|
|
|
(with-monad %store-monad
|
|
|
|
|
(if (string? thing)
|
|
|
|
|
(return thing)
|
|
|
|
|
(mlet %store-monad ((low (lower-object thing)))
|
|
|
|
|
(return (if (derivation? low)
|
|
|
|
|
(derivation-file-name low)
|
|
|
|
|
low))))))
|
|
|
|
|
|
|
|
|
|
(define (bag-node-edges thing)
|
2015-11-23 23:31:53 +01:00
|
|
|
|
"Return the list of dependencies of THING, a package or origin.
|
|
|
|
|
Dependencies may include packages, origin, and file names."
|
|
|
|
|
(cond ((package? thing)
|
|
|
|
|
(match (bag-direct-inputs (package->bag thing))
|
|
|
|
|
(((labels things . outputs) ...)
|
|
|
|
|
things)))
|
|
|
|
|
((origin? thing)
|
2016-01-02 22:22:57 +01:00
|
|
|
|
(cons (or (origin-patch-guile thing) (default-guile))
|
2015-11-23 23:31:53 +01:00
|
|
|
|
(if (or (pair? (origin-patches thing))
|
|
|
|
|
(origin-snippet thing))
|
|
|
|
|
(match (origin-patch-inputs thing)
|
|
|
|
|
(#f '())
|
|
|
|
|
(((labels dependencies _ ...) ...)
|
|
|
|
|
(delete-duplicates dependencies eq?)))
|
|
|
|
|
'())))
|
|
|
|
|
(else
|
|
|
|
|
'())))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
|
|
|
|
(define %bag-node-type
|
|
|
|
|
;; Type for the traversal of package nodes via the "bag" representation,
|
|
|
|
|
;; which includes implicit inputs.
|
|
|
|
|
(node-type
|
|
|
|
|
(name "bag")
|
|
|
|
|
(description "the DAG of packages, including implicit inputs")
|
2016-05-20 17:07:23 +02:00
|
|
|
|
(convert nodes-from-package)
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(identifier bag-node-identifier)
|
|
|
|
|
(label node-full-name)
|
2015-11-23 23:31:53 +01:00
|
|
|
|
(edges (lift1 (compose (cut filter package? <>) bag-node-edges)
|
|
|
|
|
%store-monad))))
|
|
|
|
|
|
|
|
|
|
(define %bag-with-origins-node-type
|
|
|
|
|
(node-type
|
|
|
|
|
(name "bag-with-origins")
|
|
|
|
|
(description "the DAG of packages and origins, including implicit inputs")
|
2016-05-20 17:07:23 +02:00
|
|
|
|
(convert nodes-from-package)
|
2015-11-23 23:31:53 +01:00
|
|
|
|
(identifier bag-node-identifier)
|
|
|
|
|
(label node-full-name)
|
|
|
|
|
(edges (lift1 (lambda (thing)
|
|
|
|
|
(filter (match-lambda
|
|
|
|
|
((? package?) #t)
|
|
|
|
|
((? origin?) #t)
|
|
|
|
|
(_ #f))
|
|
|
|
|
(bag-node-edges thing)))
|
|
|
|
|
%store-monad))))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
|
|
|
|
(define standard-package-set
|
2017-01-28 17:09:34 +01:00
|
|
|
|
(mlambda ()
|
|
|
|
|
"Return the set of standard packages provided by GNU-BUILD-SYSTEM."
|
|
|
|
|
(match (standard-packages)
|
|
|
|
|
(((labels packages . output) ...)
|
|
|
|
|
(list->setq packages)))))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
|
|
|
|
(define (bag-node-edges-sans-bootstrap thing)
|
|
|
|
|
"Like 'bag-node-edges', but pretend that the standard packages of
|
|
|
|
|
GNU-BUILD-SYSTEM have zero dependencies."
|
|
|
|
|
(if (set-contains? (standard-package-set) thing)
|
|
|
|
|
'()
|
|
|
|
|
(bag-node-edges thing)))
|
|
|
|
|
|
|
|
|
|
(define %bag-emerged-node-type
|
|
|
|
|
;; Like %BAG-NODE-TYPE, but without the bootstrap subset of the DAG.
|
|
|
|
|
(node-type
|
|
|
|
|
(name "bag-emerged")
|
|
|
|
|
(description "same as 'bag', but without the bootstrap nodes")
|
2016-05-20 17:07:23 +02:00
|
|
|
|
(convert nodes-from-package)
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(identifier bag-node-identifier)
|
|
|
|
|
(label node-full-name)
|
2016-01-02 22:12:36 +01:00
|
|
|
|
(edges (lift1 (compose (cut filter package? <>)
|
|
|
|
|
bag-node-edges-sans-bootstrap)
|
|
|
|
|
%store-monad))))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Derivation DAG.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define (derivation-dependencies obj)
|
|
|
|
|
"Return the <derivation> objects and store items corresponding to the
|
|
|
|
|
dependencies of OBJ, a <derivation> or store item."
|
|
|
|
|
(if (derivation? obj)
|
2017-06-12 17:11:22 +02:00
|
|
|
|
(append (map (compose read-derivation-from-file derivation-input-path)
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(derivation-inputs obj))
|
|
|
|
|
(derivation-sources obj))
|
|
|
|
|
'()))
|
|
|
|
|
|
|
|
|
|
(define (derivation-node-identifier node)
|
|
|
|
|
"Return a unique identifier for NODE, which may be either a <derivation> or
|
|
|
|
|
a plain store file."
|
|
|
|
|
(if (derivation? node)
|
|
|
|
|
(derivation-file-name node)
|
|
|
|
|
node))
|
|
|
|
|
|
|
|
|
|
(define (derivation-node-label node)
|
|
|
|
|
"Return a label for NODE, a <derivation> object or plain store item."
|
|
|
|
|
(store-path-package-name (match node
|
|
|
|
|
((? derivation? drv)
|
|
|
|
|
(derivation-file-name drv))
|
|
|
|
|
((? string? file)
|
|
|
|
|
file))))
|
|
|
|
|
|
|
|
|
|
(define %derivation-node-type
|
|
|
|
|
;; DAG of derivations. Very accurate, very detailed, but usually too much
|
|
|
|
|
;; detailed.
|
|
|
|
|
(node-type
|
|
|
|
|
(name "derivation")
|
|
|
|
|
(description "the DAG of derivations")
|
2016-05-20 17:07:23 +02:00
|
|
|
|
(convert (match-lambda
|
|
|
|
|
((? package? package)
|
|
|
|
|
(with-monad %store-monad
|
|
|
|
|
(>>= (package->derivation package)
|
|
|
|
|
(lift1 list %store-monad))))
|
|
|
|
|
((? derivation-path? item)
|
|
|
|
|
(mbegin %store-monad
|
|
|
|
|
((store-lift add-temp-root) item)
|
2017-06-12 17:11:22 +02:00
|
|
|
|
(return (list (read-derivation-from-file item)))))
|
2016-05-20 17:07:23 +02:00
|
|
|
|
(x
|
|
|
|
|
(raise
|
|
|
|
|
(condition (&message (message "unsupported argument for \
|
|
|
|
|
derivation graph")))))))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(identifier (lift1 derivation-node-identifier %store-monad))
|
|
|
|
|
(label derivation-node-label)
|
|
|
|
|
(edges (lift1 derivation-dependencies %store-monad))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; DAG of residual references (aka. run-time dependencies).
|
|
|
|
|
;;;
|
|
|
|
|
|
2016-10-15 22:47:42 +02:00
|
|
|
|
(define ensure-store-items
|
|
|
|
|
;; Return a list of store items as a monadic value based on the given
|
|
|
|
|
;; argument, which may be a store item or a package.
|
|
|
|
|
(match-lambda
|
|
|
|
|
((? package? package)
|
|
|
|
|
;; Return the output file names of PACKAGE.
|
|
|
|
|
(mlet %store-monad ((drv (package->derivation package)))
|
|
|
|
|
(return (match (derivation->output-paths drv)
|
|
|
|
|
(((_ . file-names) ...)
|
|
|
|
|
file-names)))))
|
|
|
|
|
((? store-path? item)
|
|
|
|
|
(with-monad %store-monad
|
|
|
|
|
(return (list item))))
|
|
|
|
|
(x
|
|
|
|
|
(raise
|
|
|
|
|
(condition (&message (message "unsupported argument for \
|
|
|
|
|
this type of graph")))))))
|
|
|
|
|
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(define (references* item)
|
|
|
|
|
"Return as a monadic value the references of ITEM, based either on the
|
|
|
|
|
information available in the local store or using information about
|
|
|
|
|
substitutes."
|
|
|
|
|
(lambda (store)
|
|
|
|
|
(guard (c ((nix-protocol-error? c)
|
|
|
|
|
(match (substitutable-path-info store (list item))
|
|
|
|
|
((info)
|
|
|
|
|
(values (substitutable-references info) store))
|
|
|
|
|
(()
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(leave (G_ "references for '~a' are not known~%")
|
2015-08-27 00:36:41 +02:00
|
|
|
|
item)))))
|
|
|
|
|
(values (references store item) store))))
|
|
|
|
|
|
|
|
|
|
(define %reference-node-type
|
|
|
|
|
(node-type
|
|
|
|
|
(name "references")
|
|
|
|
|
(description "the DAG of run-time dependencies (store references)")
|
2016-10-15 22:47:42 +02:00
|
|
|
|
(convert ensure-store-items)
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(identifier (lift1 identity %store-monad))
|
|
|
|
|
(label store-path-package-name)
|
|
|
|
|
(edges references*)))
|
|
|
|
|
|
2016-10-15 22:47:42 +02:00
|
|
|
|
(define non-derivation-referrers
|
|
|
|
|
(let ((referrers (store-lift referrers)))
|
|
|
|
|
(lambda (item)
|
|
|
|
|
"Return the referrers of ITEM, except '.drv' files."
|
|
|
|
|
(mlet %store-monad ((items (referrers item)))
|
|
|
|
|
(return (remove derivation-path? items))))))
|
|
|
|
|
|
|
|
|
|
(define %referrer-node-type
|
|
|
|
|
(node-type
|
|
|
|
|
(name "referrers")
|
|
|
|
|
(description "the DAG of referrers in the store")
|
|
|
|
|
(convert ensure-store-items)
|
|
|
|
|
(identifier (lift1 identity %store-monad))
|
|
|
|
|
(label store-path-package-name)
|
|
|
|
|
(edges non-derivation-referrers)))
|
|
|
|
|
|
2018-03-27 14:00:48 +02:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Scheme modules.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define (module-from-package package)
|
|
|
|
|
(file-name->module-name (location-file (package-location package))))
|
|
|
|
|
|
|
|
|
|
(define (source-module-dependencies* module)
|
|
|
|
|
"Like 'source-module-dependencies' but filter out modules that are not
|
|
|
|
|
package modules, while attempting to retain user package modules."
|
|
|
|
|
(remove (match-lambda
|
|
|
|
|
(('guix _ ...) #t)
|
|
|
|
|
(('system _ ...) #t)
|
|
|
|
|
(('language _ ...) #t)
|
|
|
|
|
(('ice-9 _ ...) #t)
|
|
|
|
|
(('srfi _ ...) #t)
|
|
|
|
|
(_ #f))
|
|
|
|
|
(source-module-dependencies module)))
|
|
|
|
|
|
|
|
|
|
(define %module-node-type
|
|
|
|
|
;; Show the graph of package modules.
|
|
|
|
|
(node-type
|
|
|
|
|
(name "module")
|
|
|
|
|
(description "the graph of package modules")
|
|
|
|
|
(convert (lift1 (compose list module-from-package) %store-monad))
|
|
|
|
|
(identifier (lift1 identity %store-monad))
|
|
|
|
|
(label object->string)
|
|
|
|
|
(edges (lift1 source-module-dependencies* %store-monad))))
|
|
|
|
|
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; List of node types.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define %node-types
|
|
|
|
|
;; List of all the node types.
|
|
|
|
|
(list %package-node-type
|
2017-01-04 16:16:17 +01:00
|
|
|
|
%reverse-package-node-type
|
2015-08-27 00:36:41 +02:00
|
|
|
|
%bag-node-type
|
2015-11-23 23:31:53 +01:00
|
|
|
|
%bag-with-origins-node-type
|
2015-08-27 00:36:41 +02:00
|
|
|
|
%bag-emerged-node-type
|
|
|
|
|
%derivation-node-type
|
2016-10-15 22:47:42 +02:00
|
|
|
|
%reference-node-type
|
2018-03-27 14:00:48 +02:00
|
|
|
|
%referrer-node-type
|
|
|
|
|
%module-node-type))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
|
|
|
|
(define (lookup-node-type name)
|
|
|
|
|
"Return the node type called NAME. Raise an error if it is not found."
|
|
|
|
|
(or (find (lambda (type)
|
|
|
|
|
(string=? (node-type-name type) name))
|
|
|
|
|
%node-types)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(leave (G_ "~a: unknown node type~%") name)))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
2016-10-21 23:59:00 +02:00
|
|
|
|
(define (lookup-backend name)
|
|
|
|
|
"Return the graph backend called NAME. Raise an error if it is not found."
|
|
|
|
|
(or (find (lambda (backend)
|
|
|
|
|
(string=? (graph-backend-name backend) name))
|
|
|
|
|
%graph-backends)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(leave (G_ "~a: unknown backend~%") name)))
|
2016-10-21 23:59:00 +02:00
|
|
|
|
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(define (list-node-types)
|
|
|
|
|
"Print the available node types along with their synopsis."
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "The available node types are:\n"))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(newline)
|
|
|
|
|
(for-each (lambda (type)
|
|
|
|
|
(format #t " - ~a: ~a~%"
|
|
|
|
|
(node-type-name type)
|
|
|
|
|
(node-type-description type)))
|
|
|
|
|
%node-types))
|
|
|
|
|
|
2016-10-21 23:59:00 +02:00
|
|
|
|
(define (list-backends)
|
|
|
|
|
"Print the available backends along with their synopsis."
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "The available backend types are:\n"))
|
2016-10-21 23:59:00 +02:00
|
|
|
|
(newline)
|
|
|
|
|
(for-each (lambda (backend)
|
|
|
|
|
(format #t " - ~a: ~a~%"
|
|
|
|
|
(graph-backend-name backend)
|
|
|
|
|
(graph-backend-description backend)))
|
|
|
|
|
%graph-backends))
|
|
|
|
|
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Command-line options.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define %options
|
|
|
|
|
(list (option '(#\t "type") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'node-type (lookup-node-type arg)
|
|
|
|
|
result)))
|
|
|
|
|
(option '("list-types") #f #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(list-node-types)
|
|
|
|
|
(exit 0)))
|
2016-10-21 23:59:00 +02:00
|
|
|
|
(option '(#\b "backend") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'backend (lookup-backend arg)
|
|
|
|
|
result)))
|
|
|
|
|
(option '("list-backends") #f #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(list-backends)
|
|
|
|
|
(exit 0)))
|
2015-09-02 15:23:52 +02:00
|
|
|
|
(option '(#\e "expression") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'expression arg result)))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(option '(#\h "help") #f #f
|
|
|
|
|
(lambda args
|
|
|
|
|
(show-help)
|
|
|
|
|
(exit 0)))
|
|
|
|
|
(option '(#\V "version") #f #f
|
|
|
|
|
(lambda args
|
|
|
|
|
(show-version-and-exit "guix edit")))))
|
|
|
|
|
|
|
|
|
|
(define (show-help)
|
|
|
|
|
;; TRANSLATORS: Here 'dot' is the name of a program; it must not be
|
|
|
|
|
;; translated.
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "Usage: guix graph PACKAGE...
|
2017-10-27 23:53:17 +02:00
|
|
|
|
Emit a representation of the dependency graph of PACKAGE...\n"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2016-10-21 23:59:00 +02:00
|
|
|
|
-b, --backend=TYPE produce a graph with the given backend TYPE"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2016-10-21 23:59:00 +02:00
|
|
|
|
--list-backends list the available graph backends"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2015-08-27 00:36:41 +02:00
|
|
|
|
-t, --type=TYPE represent nodes of the given TYPE"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2015-08-27 00:36:41 +02:00
|
|
|
|
--list-types list the available graph types"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2015-09-02 15:23:52 +02:00
|
|
|
|
-e, --expression=EXPR consider the package EXPR evaluates to"))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(newline)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2015-08-27 00:36:41 +02:00
|
|
|
|
-h, --help display this help and exit"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2015-08-27 00:36:41 +02:00
|
|
|
|
-V, --version display version information and exit"))
|
|
|
|
|
(newline)
|
|
|
|
|
(show-bug-report-information))
|
|
|
|
|
|
|
|
|
|
(define %default-options
|
2016-10-21 23:59:00 +02:00
|
|
|
|
`((node-type . ,%package-node-type)
|
|
|
|
|
(backend . ,%graphviz-backend)))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Entry point.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define (guix-graph . args)
|
|
|
|
|
(with-error-handling
|
2017-10-27 22:28:00 +02:00
|
|
|
|
(let* ((opts (parse-command-line args %options
|
|
|
|
|
(list %default-options)
|
|
|
|
|
#:build-options? #f))
|
2016-10-21 23:59:00 +02:00
|
|
|
|
(backend (assoc-ref opts 'backend))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(type (assoc-ref opts 'node-type))
|
2016-05-20 17:07:23 +02:00
|
|
|
|
(items (filter-map (match-lambda
|
|
|
|
|
(('argument . (? store-path? item))
|
|
|
|
|
item)
|
2015-09-02 15:23:52 +02:00
|
|
|
|
(('argument . spec)
|
|
|
|
|
(specification->package spec))
|
|
|
|
|
(('expression . exp)
|
|
|
|
|
(read/eval-package-expression exp))
|
|
|
|
|
(_ #f))
|
|
|
|
|
opts)))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
(with-store store
|
2016-05-19 23:24:50 +02:00
|
|
|
|
;; Ask for absolute file names so that .drv file names passed from the
|
|
|
|
|
;; user to 'read-derivation' are absolute when it returns.
|
|
|
|
|
(with-fluids ((%file-port-name-canonicalization 'absolute))
|
|
|
|
|
(run-with-store store
|
|
|
|
|
;; XXX: Since grafting can trigger unsolicited builds, disable it.
|
|
|
|
|
(mlet %store-monad ((_ (set-grafting #f))
|
|
|
|
|
(nodes (mapm %store-monad
|
|
|
|
|
(node-type-convert type)
|
2016-05-20 17:07:23 +02:00
|
|
|
|
items)))
|
2016-05-19 23:24:50 +02:00
|
|
|
|
(export-graph (concatenate nodes)
|
|
|
|
|
(current-output-port)
|
2016-10-21 23:59:00 +02:00
|
|
|
|
#:node-type type
|
|
|
|
|
#:backend backend)))))))
|
2015-08-27 00:36:41 +02:00
|
|
|
|
#t)
|
|
|
|
|
|
|
|
|
|
;;; graph.scm ends here
|