Commit Graph

147 Commits

Author SHA1 Message Date
Ludovic Courtès d98a0203b7
shell: ‘--development’ honors ‘--system’.
Fixes a bug whereby ‘package->development-manifest’ would run with the
wrong system in mind, leading to errors like this:

  $ guix shell -s i586-gnu -D shepherd --no-grafts
  guix shell: error: package linux-libre-headers@5.15.49 does not support i586-gnu

* guix/scripts/environment.scm (options/resolve-packages): Define
‘system’ and pass it to ‘package->development-manifest’.’
* tests/guix-shell.sh: Test it.

Change-Id: I95c471c1918913ab80dec7d3ca64fe38583cce78
2023-12-06 23:50:04 +01:00
Ludovic Courtès 6eb147dc31
environment: Fix typo in error messages.
* guix/scripts/environment.scm (guix-environment*): Fix typo in error
messages.

Change-Id: I0b8669cb43267d0456a70f3b157514a6bcc725e8
2023-10-28 01:23:41 +02:00
Ludovic Courtès 661672a7f8
environment: Parameterize ‘%graft?’ early on.
Previously, ‘%graft?’ would be parameterized after ‘package-derivation’
had been called for ‘%guile-for-build’, which is too late.

* guix/scripts/environment.scm (guix-environment*)[with-store/maybe]:
Parameterize ‘%graft?’.
Remove ‘%graft?’ parameterization from body.

Change-Id: I65ef4a8c5f27e19a49196005871e5f7057fabaec
2023-10-28 01:21:56 +02:00
Ludovic Courtès b3ec2a0d37
environment: Honor ‘-s’ for guile-for-build.
Partly fixes <https://issues.guix.gnu.org/65225>.

* guix/scripts/environment.scm (guix-environment*): Pass SYSTEM to
‘package-derivation’ when defining ‘%guile-for-build’.

Reported-by: Simon Tournier <zimon.toutoune@gmail.com>
Change-Id: I9d883f1e61fac72754fdc9dee9b7c8a3dea32add
2023-10-28 00:17:24 +02:00
Ludovic Courtès 69dfdb7bd1
environment: Fix unbound-variable bug with '--symlink'.
Fixes <https://issues.guix.gnu.org/63845>.
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

* guix/scripts/environment.scm (launch-environment/container): Reference
'evaluate-populate-directive' before calling 'call-with-container'.
2023-06-02 16:57:17 +02:00
Ludovic Courtès abdf812acc
environment: Really auto-load (guix scripts pack).
Fixes a performance regression on cache hits introduced in
b31ea797ed, whereby (guix scripts pack)
would be loaded eagerly during startup, leading hundreds of (gnu
packages *) modules to be loaded.

Fixes <https://issues.guix.gnu.org/62899>.

* guix/scripts/environment.scm: Autoload (gnu build install).
(%options): Add indirection when calling 'symlink-spec-option-parser' so
that (guix scripts pack) is auto-loaded only when needed.
2023-04-19 20:12:19 -04:00
Ludovic Courtès 57db09aae7
environment: Add '--nesting'.
* guix/scripts/environment.scm (show-environment-options-help)
(%options): Add '--nesting'.
(options/resolve-packages): Handle it.
(launch-environment/container): Add #:nesting? and honor it.
[nesting-mappings]: New procedure.
(guix-environment*): Add support for '--nesting'.
* guix/scripts/shell.scm (profile-cached-gc-root): Special-case
'nesting?'.
* tests/guix-environment-container.sh: Test it.
* doc/guix.texi (Invoking guix shell): Document it.
2023-04-06 18:34:15 +02:00
Winter 3a7757f1fd
environment: Clear 'TERM' when checking environment.
* guix/scripts/environment.scm (child-shell-environment): Set 'TERM' to
the empty string.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2023-03-13 15:08:33 +01:00
Josselin Poiret aca64d5604
scripts: environment: Fix ordering issue with CWD and --expose.
Fixes <https://issues.guix.gnu.org/46782>.

* guix/scripts/environment.scm (launch-environment/container): Move the CWD
mapping to the front of the file system mappings.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2023-03-06 21:18:57 -05:00
Ludovic Courtès 43c36c5c9f
ui: 'display-hint' quotes extra arguments for Texinfo.
Fixes <https://issues.guix.gnu.org/61201>.

Previously, common practice was to splice arbitrary strings (user names,
file names, etc.) into Texinfo snippets passed to 'display-hint'.  This
is unsafe in the general case because at signs and braces need to be
escaped to produced valid Texinfo.  This commit addresses that.

* guix/ui.scm (texinfo-quote): New procedure.
(display-hint): When ARGUMENTS is non-empty, pass it to 'texinfo-quote'
and call 'format'.
(report-unbound-variable-error, check-module-matches-file)
(display-collision-resolution-hint, run-guix-command): Remove explicit
'format' call; pass 'format' arguments as extra arguments to 'display-hint'.
* gnu/services/monitoring.scm (zabbix-front-end-config): Likewise.
* guix/scripts.scm (warn-about-disk-space): Likewise.
* guix/scripts/build.scm (%standard-cross-build-options)
(%standard-native-build-options): Likewise.
* guix/scripts/describe.scm (display-checkout-info): Likewise.
* guix/scripts/environment.scm (suggest-command-name): Likewise.
* guix/scripts/home.scm (process-command): Likewise.
* guix/scripts/home/edit.scm (service-type-not-found): Likewise.
* guix/scripts/import.scm (guix-import): Likewise.
* guix/scripts/package.scm (display-search-path-hint): Likewise.
* guix/scripts/pull.scm (build-and-install): Likewise.
* guix/scripts/shell.scm (auto-detect-manifest): Likewise.
* guix/scripts/system.scm (check-file-system-availability): Likewise.
(guix-system): Likewise.
* guix/scripts/system/edit.scm (service-type-not-found): Likewise.
* guix/status.scm (print-build-event): Likewise.
2023-02-27 23:40:43 +01:00
John Kehayias 3bfbfa2946
environment: Fix '--emulate-fhs' option overriding $PATH.
Fixes <https://issues.guix.gnu.org/60566> where even if "--preserve='^PATH$'"
was passed to 'guix shell' it would be replaced by just the FHS directories
when '--emulate-fhs' was also set.

* gnu/scripts/environment.scm (launch-environment): Add the FHS directories to
$PATH rather than overriding $PATH completely.
* tests/guix-environment-container.sh: Test that FHS directories are in $PATH
in the container and that $PATH can be preserved.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2023-01-15 17:54:14 -05:00
Ludovic Courtès b5e3701f1a
environment: Avoid false positive on 'PS1' check.
* guix/scripts/environment.scm (validate-child-shell-environment): Do
not warn when 'PS1' refers to 'GUIX_ENVIRONMENT'.
2023-01-05 15:01:29 +01:00
Ludovic Courtès 632e2f7ce1
environment: Simplify 'PS1' suggestion on '--check'.
* guix/scripts/environment.scm (validate-child-shell-environment): In
'PS1' suggestion, remove 'export' and avoid 'if'.
2023-01-05 15:01:29 +01:00
Ludovic Courtès e625e9b194
environment: '-C' doesn't throw when the NSS is dysfunctional.
Previously, if the name service switch was dysfunctional, as can happen
on foreign distros lacking nscd, "guix shell -C" would crash with a
backtrace on the uncaught 'getpwuid' exception.  To address that, catch
the exception and deal with it gracefully.

Reported by remsd1 on #guix.

* guix/scripts/environment.scm (launch-environment/container): Wrap
'getpwuid' call in 'false-if-exception'.
2022-12-09 08:46:21 +01:00
Maxim Cournoyer 788602b37f
shell: Detect --symlink spec problems early.
* guix/scripts/pack.scm (symlink-spec-option-parser): Remove extraneous
char-set.  Raise an exception when the target is an absolute file name.
(guix-pack): Move with-error-handler earlier.
* guix/scripts/shell.scm (guix-shell): Likewise.
* guix/scripts/environment.scm (guix-environment): Wrap the whole
guix-environment* call with the with-error-handling handler.
* tests/guix-environment-container.sh: Add tests.
* tests/guix-pack.sh: Adjust symlink spec.
2022-11-15 14:15:11 -05:00
Maxim Cournoyer b31ea797ed
guix: shell: Add '--symlink' option.
* guix/scripts/pack.scm (%options): Extract symlink parsing logic to...
(symlink-spec-option-parser): ... here.
(self-contained-tarball/builder): Add a comment mentioning why a relative file
name is used for the link target.
* guix/scripts/environment.scm (show-environment-options-help): Document new
--symlink option.
(%default-options): Add default value for symlinks.
(%options): Register new symlink option.
(launch-environment/container): Add #:symlinks argument and extend doc, and
create symlinks using evaluate-populate-directive.
(guix-environment*): Pass symlinks arguments to launch-environment/container.
* doc/guix.texi (Invoking guix shell): Document it.
* tests/guix-shell.sh: Add a --symlink (negative) test.
* tests/guix-environment-container.sh: Add tests.
2022-11-15 14:15:11 -05:00
Ludovic Courtès a3619079f9
Remove now unnecessary uses of (guix grafts).
These modules would use (guix grafts) just to access '%graft?' and
related bindings, which are now in (guix store).

* gnu/ci.scm,
guix/gexp.scm,
guix/lint.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/deploy.scm,
guix/scripts/environment.scm,
guix/scripts/home.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/pull.scm,
guix/scripts/size.scm,
guix/scripts/system.scm,
guix/scripts/weather.scm,
tests/builders.scm,
tests/channels.scm,
tests/cpan.scm,
tests/derivations.scm,
tests/gexp.scm,
tests/graph.scm,
tests/guix-daemon.sh,
tests/monads.scm,
tests/pack.scm,
tests/packages.scm,
tests/profiles.scm,
tests/system.scm: Remove #:use-module (guix grafts).
2022-10-22 01:46:55 +02:00
Ludovic Courtès c5d83bee93
environment: Update docstring of 'launch-environment'.
This is a followup to 78d55b703d.
Reported by Maxim Cournoyer.

* guix/scripts/environment.scm (launch-environment): Update docstring.
2022-10-20 23:07:37 +02:00
Julien Lepiller 82b0f3755d
guix: Fix typos.
These typos were found and reported through weblate.

* gnu/packages/audio.scm (wildmidi)[description]: Fix typo.
* gnu/packages/games.scm (cgoban)[description]: Fix typo.
* gnu/services/version-control.scm (gitolite-service-type)[description]:
  Fix typo.
* gnu/installer/newt/substitutes.scm (run-substitutes-page): Remove full
  stop at end of title.
* gnu/machine/ssh.scm (machine-ssh-configuration-system): Move
  punctuation outside of quotes.
* guix/scripts/home.scm (process-action): Remove trailing space before
  newline.
* guix/scripts/system.scm (show-help): Fix typo.
* guix/scripts/environment.scm (with-store/maybe): Fix typo.
2022-10-17 07:29:09 +02:00
Ludovic Courtès 8b192c5550
shell: Handle '--emulate-fhs' in 'guix shell', not in 'guix environment'.
Previously, using 'guix shell -CF coreutils' twice (such that the
profile is cache) would result in:

  guix shell: error: '--profile' cannot be used with package options

This patch fixes it by moving argument handling to (guix scripts shell),
before 'options-with-caching' is called.

* guix/scripts/environment.scm (show-environment-options-help)
(%options): Remove '--emulate-fhs'.
(guix-environment*): Pass OPTS as-is to 'options/resolve-packages'.
* guix/scripts/shell.scm (show-help, %options): Add '--emulate-fhs'.
Add the (expression . ...) component to RESULT right from the argument
handler.
* tests/guix-environment-container.sh: Change '--emulate-fhs' tests to
use 'guix shell' instead of 'guix environment'.
2022-10-13 15:56:56 +02:00
John Kehayias c7ba5f38b8
environment: Add '--emulate-fhs'.
* guix/scripts/environment.scm (show-environment-options-help, %options): Add
'--emulate-fhs'.
(setup-fhs): New procedure.  Setup for the Filesystem Hierarchy Standard (FHS)
container.  Defines and uses FHS-SYMLINKS and LINK-CONTENTS to create FHS
expected directories and creates /etc/ld.so.conf.
(launch-environment): Add 'emulate-fhs?' key and implement it to set $PATH and
generate /etc/ld.so.cache before calling COMMAND.
(launch-environment/container): Add 'emulate-fhs?' and 'setup-hook' keys and
implement them.  Define and use FHS-MAPPINGS, to set up additional bind mounts
in the container to follow FHS expectations.
(guix-environment*): Add glibc-for-fhs to the container packages when
'emulate-fhs?' key is in OPTS.
* doc/guix.texi (Invoking guix shell): Document '--emulate-fhs'.
(Invoking guix environment): Document '--emulate-fhs'.
* tests/guix-environment-container.sh: Add tests for '--emulate-fhs'.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-10-13 09:19:08 +02:00
Ludovic Courtès ae1f120181
environment: Report "command not found" from the child process.
Fixes a bug whereby, for example:

  guix shell bash -- bash -c xyz

would erroneously print:

  guix shell: error: bash: command not found

simply because the parent process could not distinguish that 127 from a
"genuine" 127 used by convention for "command not found".

* guix/scripts/environment.scm (launch-environment): Before exiting,
report a "command not found" error and suggest a command name.
(validate-exit-status): Remove.
(launch-environment/fork): Remove call
(launch-environment/container)[exit/status*]: Remove.
Call 'exit/status' instead of it.
2022-08-04 12:05:46 +02:00
Mathieu Othacehe ec42d287b4
scripts: Add --list-systems and --list-targets options.
Also factorize the --system and --target build options. Check that the passed
system and target arguments are known platforms.

* doc/guix.texi (Additional Build Options): Document the new --list-systems
and --list-targets options.
* guix/scripts/build.scm (show-cross-build-options-help,
show-emulated-build-options-help, list-systems, list-targets): New procedures.
(%standard-cross-build-options, %standard-emulated-build-options): New
variables.
(show-help): Remove --system and --target entries and use
show-cross-build-options-help and show-emulated-build-options-help procedures instead.
(%options): Remove --system and --target entries and use
%standard-cross-build-options and %standard-emulated-build-options variables instead.
* guix/scripts/archive.scm (show-help, %options): Adapt them.
* guix/scripts/environment.scm: Ditto.
* guix/scripts/graph.scm: Ditto.
* guix/scripts/pack.scm: Ditto.
* guix/scripts/pull.scm: Ditto.
* guix/scripts/size.scm: Ditto.
* guix/scripts/weather.scm: Ditto.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-05-22 15:15:33 +02:00
Ludovic Courtès 6fed836a6f
environment: Export 'load-manifest'.
* guix/scripts/environment.scm (load-manifest): New procedure.
(options/resolve-packages): Use it.
2022-04-04 22:58:03 +02:00
Ludovic Courtès b8743fef8a
environment: '--check' does nothing when used with '--container'.
Partly fixes <https://issues.guix.gnu.org/53355>.
Reported by Chris Marusich <cmmarusich@gmail.com>.

* guix/scripts/environment.scm (guix-environment*): Warn and do nothing
when both '--check' and '--container' are used.
2022-01-25 23:54:43 +01:00
Ludovic Courtès 16e9e53838
environment: Suggestion code gracefully handles empty "/bin" directories.
* guix/scripts/environment.scm (suggest-command-name): Handle the case
where 'scandir' returns #f.
2021-12-10 15:32:44 +01:00
Thiago Jung Bauermann 12c06847f0
environment: Fix ‘--check’ with exported PS1 variable.
If your .bashrc (unnecessarily) exports PS1 and you’re in a non-login
shell, Guix crashes:

user@popigai:~$ guix shell --check coreutils
guix shell: checking the environment variables visible from shell '/bin/bash'...
Backtrace:
          14 (primitive-load "/home/user/.config/guix/current/bin/g…")
In guix/ui.scm:
   2206:7 13 (run-guix . _)
  2169:10 12 (run-guix-command _ . _)
In ice-9/boot-9.scm:
  1752:10 11 (with-exception-handler _ _ #:unwind? _ # _)
  1752:10 10 (with-exception-handler _ _ #:unwind? _ # _)
In guix/store.scm:
   658:37  9 (thunk)
   1320:8  8 (call-with-build-handler _ _)
   1320:8  7 (call-with-build-handler #<procedure 7fe393b7c420 at g…> …)
In guix/status.scm:
    800:4  6 (call-with-status-report _ _)
In guix/scripts/environment.scm:
   951:12  5 (_)
In guix/store.scm:
  2119:24  4 (run-with-store #<store-connection 256.99 7fe39627e500> …)
In guix/scripts/environment.scm:
   521:35  3 (_ _)
In unknown file:
           2 (string=? ("PS1" . "${debian_chroot:+($debian_chroot)…") …)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure string=: Wrong type argument in position 1 (expecting string): ("PS1" . "${debian_chroot:+($debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]${EXTRA}\\$ ")
user@popigai:~$

This is because the match pattern doesn’t expect `(vhash-assoc "PS1" actual)`
to return a pair.

* guix/scripts/environment.scm (validate-child-shell-environment): Change
match pattern to expect a pair.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-11-14 23:18:08 +01:00
Ludovic Courtès 5d2d87fed7
environment: Suggest command upon 'execlp' failure.
* guix/scripts/environment.scm (launch-environment): Call
'primitive-_exit' upon 'system-error.
(suggest-command-name, validate-exit-status): New procedures.
(launch-environment/fork): Call 'validate-exit-status'.
(launch-environment/container)[exit/status*]: New procedure.
Use it instead of 'exit/status'.
2021-11-06 23:01:21 +01:00
Zhu Zihao bcc4aef0db
environment: Fix broken file-local variable.
* guix/scripts/environment.scm (Local Variables): Add missing eval.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-28 00:44:10 +02:00
Ludovic Courtès 9e46942c1c
environment: Add '--check'.
* guix/scripts/environment.scm (show-environment-options-help)
(%options): Add '--check'.
* guix/scripts/environment.scm (child-shell-environment)
(validate-child-shell-environment): New procedures.
(guix-environment*): Call 'validate-child-shell-environment' when
'check?' key is in OPTS.
* doc/guix.texi (Invoking guix shell): Shorten footnote about Bash
startup files.  Document '--check' and mention startup files.
(Invoking guix environment): Document '--check'.
2021-10-26 12:46:27 +02:00
Ludovic Courtès 3c96158438
environment: Autoload some modules.
This further speeds up the 'guix environment -p PROFILE' case.

* guix/scripts/environment.scm: Autoload a bunch of modules.
2021-10-25 19:02:33 +02:00
Ludovic Courtès 99499a2037
environment: Do not connect to the daemon when '--profile' is used.
This further speeds up the 'guix environment -p PROFILE' case.

* guix/scripts/environment.scm (guix-environment*)[store-needed?]: New
variable.
[with-store/maybe]: New macro.
Use it instead of 'with-store', and remove 'with-build-handler' form.
2021-10-25 19:02:33 +02:00
Ludovic Courtès 648a6eb03f
environment: Skip derivation computation when '--profile' is used.
* guix/scripts/environment.scm (guix-environment*): Bypass calls to
'package-derivation' and to 'manifest->derivation' when PROFILE is
true.
2021-10-25 19:02:33 +02:00
Ludovic Courtès 80edb7df65
Add 'guix shell'.
* guix/scripts/shell.scm, tests/guix-shell.sh: New files.
* Makefile.am (MODULES): Add 'shell.scm'.
(SH_TESTS): Add 'tests/guix-shell.sh'.
* guix/scripts/environment.scm (show-environment-options-help): New
procedure.
(show-help): Use it.
(guix-environment*): New procedure.
(guix-environment): Use it.
* po/guix/POTFILES.in: Add it.
* doc/guix.texi (Features): Refer to "guix shell"
(Invoking guix package): Likewise.
(Development): Likewise.
(Invoking guix shell): New node.
(Invoking guix environment): Add deprecation warning.
(Debugging Build Failures): Use 'guix shell' in examples.
(Invoking guix container): Refer to 'guix shell'.
(Invoking guix processes, Virtualization Services): Adjust examples to
use 'guix shell'.
* doc/contributing.texi (Building from Git): Refer to 'guix shell'.
* etc/completion/bash/guix: Handle "shell".
2021-10-25 18:58:18 +02:00
Ludovic Courtès 23f99f1a29
profiles: Add 'package->development-manifest'.
* guix/profiles.scm (package->development-manifest): New procedure.
* guix/scripts/environment.scm (input->manifest-entry)
(package-environment-inputs): Remove.
* guix/scripts/environment.scm (options/resolve-packages): Use
'package->development-manifest' instead of 'package-environment-inputs'.
* tests/profiles.scm ("package->development-manifest"): New test.
2021-10-25 15:29:42 +02:00
Ludovic Courtès fb368f4e76
packages: Add 'package-development-inputs'.
* guix/packages.scm (package-development-inputs): New procedure.
* guix/scripts/environment.scm (package-environment-inputs): Use it.
* tests/packages.scm ("package-development-inputs")
("package-development-inputs, cross-compilation"): New tests.
* doc/guix.texi (package Reference): Document it.
2021-10-25 15:29:39 +02:00
Ludovic Courtès ee61777a32
profiles: Add 'load-profile'.
* guix/profiles.scm (%precious-variables): New variable.
(purify-environment, load-profile): New procedures.
* guix/scripts/environment.scm (%precious-variables)
(purify-environment, create-environment): Remove.
(launch-environment): Call 'load-profile' instead of 'create-environment'.
* tests/profiles.scm ("load-profile"): New test.
2021-06-18 14:18:07 +02:00
Ludovic Courtès 681af1fb78
scripts: Commands warn when passed zero arguments.
This is a followup to 3f8326237d.

* guix/scripts/archive.scm (export-from-store): Warn then FILES is
empty.
* guix/scripts/build.scm (guix-build): Likewise.
* guix/scripts/copy.scm (warn-if-empty): New procedure.
(send-to-remote-host, retrieve-from-remote-host): Call it.
* guix/scripts/edit.scm (guix-edit): Warn when SPECS is empty.
* guix/scripts/environment.scm (guix-environment): Warn when MANIFEST
has zero entries.
* guix/scripts/graph.scm (guix-graph): Warn then ITEMS is empty.
* guix/scripts/package.scm (process-actions): Warn when FILES and TRANS
are both empty.
2021-05-28 11:36:02 +02:00
Ludovic Courtès 9ce78f27a0
environment: Allow compilation with Guile 2.2.
Fixes <https://bugs.gnu.org/46826>.
Reported by cage <cage-dev@twistfold.it>.

* guix/scripts/environment.scm (guix-environment): Move 'manifest'
definition before expression.
2021-03-01 17:45:50 +01:00
Lars-Dominik Braun a643deac2d
environment: Allow starting from existing profile.
* guix/scripts/environment.scm (%options): Add -p/--profile switch.
(show-help): Document new switch.
(guix-environment): Handle new 'profile switch.

Signed-off-by: 宋文武 <iyzsong@member.fsf.org>
2021-02-11 17:59:07 +08:00
JOULAUD François 4d79f072cc
environment: Fix '--root' option with relative file name.
The path normalization of `--root` option of `guix environment` was
buggy as it appended full argument after normalized directory. This
patch fixes it.

* guix/scripts/environment.scm (register-gc-root): Fix gc-root path
normalization.
* tests/guix-environment.sh: Add test.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2021-01-19 17:45:38 +01:00
guy fleury iteriteka 0aed31be66
environment: Remove unused modules.
* guix/scripts/environment.scm: Do not use (ice-9 format) and (ice-9
rdelim).

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-01-04 11:51:48 +01:00
Ludovic Courtès e79ecff045
transformations: Show '--help-transform' only where applicable.
Fixes <https://bugs.gnu.org/44773>.
Reported by Florian Pelz <pelzflorian@pelzflorian.de>.

This fixes a regression introduced in
6701f64f73.

* guix/transformations.scm (%transformation-options): Add
"--help-transform".
(show-transformation-options-help): Rename to...
(show-transformation-options-help/detailed): ... this.
(show-transformation-options-help): New public procedure.
* guix/scripts/build.scm (show-build-options-help): Remove
"--help-transform".
(%standard-build-options): Likewise.
(show-help): Call 'show-transformation-options-help'.
* guix/scripts/environment.scm (show-help): Likewise.
* guix/scripts/graph.scm (show-help): Likewise.
* guix/scripts/install.scm (show-help): Likewise.
* guix/scripts/pack.scm (show-help): Likewise.
* guix/scripts/package.scm (show-help): Likewise.
* guix/scripts/upgrade.scm (show-help): Likewise.
2020-11-21 12:39:14 +01:00
Ludovic Courtès f68b3ba12d
guix build: Move transformation options to (guix transformations).
* guix/transformations.scm: New file.
* tests/scripts-build.scm: Rename to...
* tests/transformations.scm: ... this.
* Makefile.am (MODULES): Add 'guix/transformations.scm'.
(SCM_TESTS): Adjust to rename.
* guix/scripts/build.scm (numeric-extension?)
(tarball-base-name, <downloaded-file>, download-to-store*)
(compile-downloaded-file, package-with-source)
(transform-package-source, evaluate-replacement-specs)
(transform-package-inputs, transform-package-inputs/graft)
(%not-equal, package-git-url, evaluate-git-replacement-specs)
(transform-package-source-branch, transform-package-source-commit)
(transform-package-source-git-url, package-dependents/spec)
(package-toolchain-rewriting, transform-package-toolchain)
(transform-package-with-debug-info, transform-package-tests)
(%transformations, transformation-procedure, %transformation-options)
(show-transformation-options-help, options->transformation)
(package-transformations): Move to (guix transformations).
* guix/scripts/environment.scm: Adjust accordingly.
* guix/scripts/graph.scm: Likewise.
* guix/scripts/install.scm: Likewise.
* guix/scripts/pack.scm: Likewise.
* guix/scripts/package.scm: Likewise.
* guix/scripts/upgrade.scm: Likewise.
* po/guix/POTFILES.in: Add 'guix/transformations.scm'.
2020-10-31 23:16:43 +01:00
Ludovic Courtès 1ae33664a6
guix build: 'options->transformation' no longer takes a 'store' parameter.
* guix/scripts/build.scm (transform-package-source)
(transform-package-inputs, transform-package-inputs/graft)
(transform-package-source-branch, transform-package-source-commit)
(transform-package-source-git-url, transform-package-toolchain)
(transform-package-with-debug-info, transform-package-tests): Remove
'store' parameter.
(options->transformation, options->derivations): Adjust accordingly.
* guix/scripts/environment.scm (options/resolve-packages): Likewise.
* guix/scripts/graph.scm (guix-graph): Likewise.
* guix/scripts/pack.scm (guix-pack): Likewise.
* guix/scripts/package.scm (transaction-upgrade-entry): Likewise.
(process-actions): Likewise.
* tests/scripts-build.scm ("options->transformation, no transformations")
("options->transformation, with-source, replacement"):
Adjust tests.
("options->transformation, with-source")
("options->transformation, with-source, with version")
("options->transformation, with-source, PKG=URI"): Use 'lower-object' to
compute the store file name of the source.
("options->transformation, with-source, no matches"): Remove
'with-store' and adjust accordingly.
("options->transformation, with-input"): Likewise.
("options->transformation, with-graft"): Likewise.
("options->transformation, with-branch"): Likewise.
("options->transformation, with-commit"): Likewise.
("options->transformation, with-git-url"): Likewise.
("options->transformation, with-git-url + with-branch"): Likewise.
("options->transformation, with-c-toolchain"): Likewise.
("options->transformation, with-c-toolchain twice"): Likewise.
("options->transformation, with-c-toolchain, no effect"): Likewise.
("options->transformation, with-debug-info"): Likewise.
("options->transformation, without-tests"): Likewise.
2020-10-31 23:16:43 +01:00
Ludovic Courtès 6701f64f73
guix build: Move package transformation options behind '--help-transform'.
This change declutters the '--help' output.

* guix/scripts/build.scm (show-build-options-help)
(%standard-build-options): Add '--help-transform'.
(show-transformation-options-help): Make private.
(show-help): Remove call to 'show-transformation-options-help'.
* guix/scripts/build.scm (show-help): Likewise.
* guix/scripts/environment.scm (show-help): Likewise.
* guix/scripts/graph.scm (show-help): Likewise.
* guix/scripts/install.scm (show-help): Likewise.
* guix/scripts/pack.scm (show-help): Likewise.
* guix/scripts/package.scm (show-help): Likewise.
* guix/scripts/upgrade.scm (show-help): Likewise.
* doc/guix.texi (Package Transformation Options): Mention '--help-transform'.
2020-10-20 16:30:16 +02:00
Ludovic Courtès b68d410651
environment: Turn "lo" up in network-less containers.
This is a followup to 0f53c801b9.

* guix/scripts/environment.scm (launch-environment/container): Add call
to 'set-network-interface-up'.
* tests/guix-environment-container.sh: Add test.
2020-10-05 10:41:59 +02:00
Ludovic Courtès 0f53c801b9
environment: Provide /etc/hosts in containers without '--network'.
Fixes <https://bugs.gnu.org/43762>.

* guix/scripts/environment.scm (launch-environment/container): Create
/etc/hosts when NETWORK? is false.
* tests/guix-environment-container.sh: Add "localhost" resolution test.
2020-10-02 23:28:09 +02:00
Ludovic Courtès 9b65281de5
environment: '--link-profile' uses ~/.guix-profile for environment variables.
Before this patch, we had:

  $ guix environment -CP --ad-hoc coreutils
  [env]$ echo $PATH
  /gnu/store/…-profile/bin
  [env]$ echo $GUIX_ENVIRONMENT
  /gnu/store/…-profile

After this patch:

  $ guix environment -CP --ad-hoc coreutils
  [env]$ echo $PATH
  /home/ludo/.guix-profile/bin
  [env]$ echo $GUIX_ENVIRONMENT
  /home/ludo/.guix-profile

* guix/scripts/environment.scm (launch-environment/container): When
LINK-PROFILE? is true, pass ~/.guix-profile as the second argument to
'launch-environment'.
* tests/guix-environment-container.sh: Adjust test accordingly.
* doc/guix.texi (Invoking guix environment): Update accordingly.
2020-09-21 23:05:38 +02:00
Ludovic Courtès 3794ce93be
scripts: Use 'define-command' and have 'guix help' use that.
This changes 'guix help' to print a short synopsis for each command and
to group commands by category.

* guix/scripts.scm (synopsis, category): New variables.
(define-command-categories, define-command): New macros.
(%command-categories): New variable.
* guix/ui.scm (<command>): New record type.
(source-file-command): New procedure.
(command-files): Return absolute file names.
(commands): Return a list of <command> records.
(show-guix-help)[display-commands, category-predicate]: New procedures.
Display commands grouped in three categories.
* guix/scripts/archive.scm (guix-archive): Use 'define-command'.
* guix/scripts/authenticate.scm (guix-authenticate): Likewise.
* guix/scripts/build.scm (guix-build): Likewise.
* guix/scripts/challenge.scm (guix-challenge): Likewise.
* guix/scripts/container.scm (guix-container): Likewise.
* guix/scripts/copy.scm (guix-copy): Likewise.
* guix/scripts/deploy.scm (guix-deploy): Likewise.
* guix/scripts/describe.scm (guix-describe): Likewise.
* guix/scripts/download.scm (guix-download): Likewise.
* guix/scripts/edit.scm (guix-edit): Likewise.
* guix/scripts/environment.scm (guix-environment): Likewise.
* guix/scripts/gc.scm (guix-gc): Likewise.
* guix/scripts/git.scm (guix-git): Likewise.
* guix/scripts/graph.scm (guix-graph): Likewise.
* guix/scripts/hash.scm (guix-hash): Likewise.
* guix/scripts/import.scm (guix-import): Likewise.
* guix/scripts/install.scm (guix-install): Likewise.
* guix/scripts/lint.scm (guix-lint): Likewise.
* guix/scripts/offload.scm (guix-offload): Likewise.
* guix/scripts/pack.scm (guix-pack): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/perform-download.scm (guix-perform-download): Likewise.
* guix/scripts/processes.scm (guix-processes): Likewise.
* guix/scripts/publish.scm (guix-publish): Likewise.
* guix/scripts/pull.scm (guix-pull): Likewise.
* guix/scripts/refresh.scm (guix-refresh): Likewise.
* guix/scripts/remove.scm (guix-remove): Likewise.
* guix/scripts/repl.scm (guix-repl): Likewise.
* guix/scripts/search.scm (guix-search): Likewise.
* guix/scripts/show.scm (guix-show): Likewise.
* guix/scripts/size.scm (guix-size): Likewise.
* guix/scripts/substitute.scm (guix-substitute): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* guix/scripts/time-machine.scm (guix-time-machine): Likewise.
* guix/scripts/upgrade.scm (guix-upgrade): Likewise.
* guix/scripts/weather.scm (guix-weather): Likewise.
2020-09-10 12:27:24 +02:00