From 8524349f78c37439698f29d43049c2b21df6370f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 20 May 2021 15:46:08 +0200 Subject: packages: Allow inputs to be plain package lists. * guix/packages.scm (add-input-label, sanitize-inputs): New procedures. ()[inputs, propagated-inputs, native-inputs]: Add 'sanitize' property. * doc/guix.texi (Defining Packages, package Reference): (Defining Package Variants): Adjust examples accordingly. * tests/packages.scm ("transaction-upgrade-entry, zero upgrades, propagated inputs") ("transaction-upgrade-entry, grafts") ("package-transitive-inputs") ("package-transitive-supported-systems") ("package-closure") ("supported-package?") ("package-derivation, inputs deduplicated") ("package-transitive-native-search-paths") ("package-grafts, indirect grafts") ("package-grafts, indirect grafts, propagated inputs") ("package-grafts, same replacement twice") ("package-grafts, dependency on several outputs") ("replacement also grafted") ("package->bag, sensitivity to %current-target-system") ("package->bag, propagated inputs") ("package->bag, sensitivity to %current-system") ("package-input-rewriting/spec, identity") ("package-input-rewriting, identity"): Use the label-less input style. --- doc/guix.texi | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 808b2af664..da00d1e429 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -6476,7 +6476,7 @@ package looks like this: "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) (build-system gnu-build-system) (arguments '(#:configure-flags '("--enable-silent-rules"))) - (inputs `(("gawk" ,gawk))) + (inputs (list gawk)) (synopsis "Hello, GNU world: An example GNU package") (description "Guess what GNU Hello prints!") (home-page "https://www.gnu.org/software/hello/") @@ -6564,8 +6564,8 @@ Reference Manual}). @item The @code{inputs} field specifies inputs to the build process---i.e., -build-time or run-time dependencies of the package. Here, we define an -input called @code{"gawk"} whose value is that of the @code{gawk} +build-time or run-time dependencies of the package. Here, we add +an input, a reference to the @code{gawk} variable; @code{gawk} is itself bound to a @code{} object. @cindex backquote (quasiquote) @@ -6690,20 +6690,41 @@ list, typically containing sequential keyword-value pairs. @itemx @code{native-inputs} (default: @code{'()}) @itemx @code{propagated-inputs} (default: @code{'()}) @cindex inputs, of packages -These fields list dependencies of the package. Each one is a list of -tuples, where each tuple has a label for the input (a string) as its +These fields list dependencies of the package. Each element of these +lists is either a package, origin, or other ``file-like object'' +(@pxref{G-Expressions}); to specify the output of that file-like object +that should be used, pass a two-element list where the second element is +the output (@pxref{Packages with Multiple Outputs}, for more on package +outputs). For example, the list below specifies three inputs: + +@lisp +(list libffi libunistring + `(,glib "bin")) ;the "bin" output of GLib +@end lisp + +In the example above, the @code{"out"} output of @code{libffi} and +@code{libunistring} is used. + +@quotation Compatibility Note +Until version 1.3.0, input lists were a list of tuples, +where each tuple has a label for the input (a string) as its first element, a package, origin, or derivation as its second element, and optionally the name of the output thereof that should be used, which -defaults to @code{"out"} (@pxref{Packages with Multiple Outputs}, for -more on package outputs). For example, the list below specifies three -inputs: +defaults to @code{"out"}. For example, the list below is equivalent to +the one above, but using the @dfn{old input style}: @lisp +;; Old input style (deprecated). `(("libffi" ,libffi) ("libunistring" ,libunistring) - ("glib:bin" ,glib "bin")) ;the "bin" output of Glib + ("glib:bin" ,glib "bin")) ;the "bin" output of GLib @end lisp +This style is now deprecated; it is still supported but support will be +removed in a future version. It should not be used for new package +definitions. +@end quotation + @cindex cross compilation, package dependencies The distinction between @code{native-inputs} and @code{inputs} is necessary when considering cross-compilation. When cross-compiling, @@ -6789,7 +6810,7 @@ cross-compiling: ;; When cross-compiled, Guile, for example, depends on ;; a native version of itself. Add it here. (native-inputs (if (%current-target-system) - `(("self" ,this-package)) + (list this-package) '()))) @end lisp @@ -7105,8 +7126,7 @@ depends on it: (name name) (version "3.0") ;; several fields omitted - (inputs - `(("lua" ,lua))) + (inputs (list lua)) (synopsis "Socket library for Lua"))) (define-public lua5.1-socket -- cgit v1.2.3