This allows for direct program invokation without needing a shell to act
as a command interpreter.
* guix/scripts/environment.scm (%default-shell): New variable.
(show-help): Adjust description. Remove '--exec' reference.
(%default-options): Use '%default-shell'.
(%options): Adjust '--exec' to run command via the default shell.
(parse-args): New procedure.
(guix-environment): Use 'parse-args'. Use 'system*' instead of
'system'.
* tests/guix-environment.sh: Add test for '--' command invokation.
* doc/guix.texi ("Invoking guix environment"): Use new syntax. Remove
'--exec' documentation.
This fixes two problems:
1. Load errors would print an ugly backtrace.
2. When FILE was an absolute name, 'load' was passed an incorrect file
name.
* guix/scripts/environment.scm (options/resolve-packages): Use 'load*' instead
of 'load'.
* guix/scripts/environment.scm (package+propagated-inputs): Add 'output'
parameter. Use it in return value.
(options/resolve-packages): Use 'append-map' instead of 'map'. For 'load'
and 'expression', return all the outputs of the resulting package. For
'package', use 'specification->package+output' instead of
'specification->package'.
(guix-environment): Adjust uses of PACKAGES accordingly.
* doc/guix.texi (Invoking guix environment): Document it.
* tests/guix-environment.sh: Add test for --ad-hoc guile-bootstrap:out.
Before that, 'guix environment guile' (for instance) would define environment
variables that would refer to the "include" output of Bash, the "debug" output
of libgc, etc., even though these are not listed as inputs in the recipe of
'guile'.
* guix/gexp.scm (lower-inputs): Export.
* guix/scripts/environment.scm (evaluate-input-search-paths): Remove
'derivations' parameter; add 'search-paths'. Expect 'inputs' to be
a list of tuples. Adjust callers.
(create-environment): Remove 'derivations' parameter; add 'search-paths'.
(show-search-paths): Likewise.
(package+propagated-inputs): New procedure.
(packages->transitive-inputs, packages+propagated-inputs): Remove.
(build-inputs): Expect INPUTS to be a list of derivation tuples.
(guix-environment): Compute INPUTS using 'package+propagated-inputs',
'package->bag', and 'bag-transitive-inputs'. Move 'run-with-store' higher.
* tests/guix-environment.sh: Add test with FINDUTILS-BOOT0.
* guix/scripts/environment.scm (guix-environment): Call 'parse-command-line'
outside of 'with-store'. This allows things like --help to run even if the
daemon is not running.
* guix/scripts/environment.scm (%options): Add "ad-hoc" option.
(show-help): Display help for "--ad-hoc".
(packages+propagated-inputs): New procedure.
(guix-environment): Create ad hoc environment when asked.
* doc/guix.texi ("invoking guix environment"): Document it.
* guix/search-paths.scm (search-path-definition): New procedure.
* guix/scripts/environment.scm (for-each-search-path): Rename to...
(evaluate-input-search-paths): ... this. Remove 'proc' and 'pure?'
parameters, and return directly the list of search-path/value pairs.
(create-environment): Use 'for-each' and 'evaluate-input-search-paths'
instead of 'for-each-search-path'.
(show-search-paths): Use 'for-each', 'search-path-definition', and
'evaluate-search-paths' instead of 'for-each-search-path'.
This allows 'guix environment' to correctly handle non-directory
and/or pattern search-path specifications, such as that for
'XML_CATALOG_FILES'.
* guix/scripts/environment.scm (for-each-search-path): Use
'evaluate-search-paths' instead of 'search-path-as-list' & co.
* guix/scripts/environment.scm (for-each-search-path): Iterate over all
derivation output paths.
(packages->transitive-inputs): Process inputs that specify an output, too.
Appending to "raw" args broke optional parameters in 'guix package -I'
and 'guix package -A', and possibly other places. Therefore, switch to
parsing each set of options on its own and append resulting alists
together afterwards.
* guix/scripts/archive.scm (parse-options-from): Rename from
(parse-options) and add explicit argument. New form of (parse-options)
using its old algorithm via -from function.
* guix/scripts/build.scm: Ditto.
* guix/scripts/environment.scm: Ditto.
* guix/scripts/package.scm: Ditto.
* guix/scripts/system.scm: Ditto.
* tests/guix-package.sh: Add test.
* doc/guix.texi (Invoking guix build): Make it clear that the options
are parsed independently.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* guix/scripts/environment.scm (show-help): Align --pure and
--search-paths with other long options; add 'newline' call before
'show-bug-report-information' call.