diff options
author | Ludovic Courtès <ludo@gnu.org> | 2021-06-16 23:19:16 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-07-11 00:49:14 +0200 |
commit | ba32f6363878165b3ca53113f6c95b8677b8537b (patch) | |
tree | 87e66d5f8bb9f828c7f062a7389b5ce415febce0 /doc | |
parent | b7f1b4c1d072c6da92e20ddadb24e54da0ddd142 (diff) | |
download | guix-ba32f6363878165b3ca53113f6c95b8677b8537b.tar.gz |
packages: Add 'lookup-package-input' & co.
* guix/packages.scm (lookup-input, lookup-package-input) (lookup-package-native-input, lookup-package-propagated-input) (lookup-package-direct-input): New procedures. * doc/guix.texi (package Reference): Document them.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/guix.texi | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 32bfd29dbe..9cb7ac53f9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -6817,6 +6817,30 @@ cross-compiling: It is an error to refer to @code{this-package} outside a package definition. @end deffn +The following helper procedures are provided to help deal with package +inputs. + +@deffn {Scheme Procedure} lookup-package-input @var{package} @var{name} +@deffnx {Scheme Procedure} lookup-package-native-input @var{package} @var{name} +@deffnx {Scheme Procedure} lookup-package-propagated-input @var{package} @var{name} +@deffnx {Scheme Procedure} lookup-package-direct-input @var{package} @var{name} +Look up @var{name} among @var{package}'s inputs (or native, propagated, +or direct inputs). Return it if found, @code{#f} otherwise. + +@var{name} is the name of a package depended on. Here's how you might +use it: + +@lisp +(use-modules (guix packages) (gnu packages base)) + +(lookup-package-direct-input coreutils "gmp") +@result{} #<package gmp@@6.2.1 @dots{}> +@end lisp + +In this example we obtain the @code{gmp} package that is among the +direct inputs of @code{coreutils}. +@end deffn + Because packages are regular Scheme objects that capture a complete dependency graph and associated build procedures, it is often useful to write procedures that take a package and return a modified version |