Commit graph

1987 commits

Author SHA1 Message Date
Maxim Cournoyer
933051281f
Revert "tests: pack: Fix indentation."
This reverts commit ac1d530d56.
2023-03-17 12:14:14 -04:00
Ludovic Courtès
83128f00e9
read-print: 'read-with-comments' reads comments within gexps.
Fixes <https://issues.guix.gnu.org/62059>.
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

* guix/read-print.scm (read-with-comments): Special-case #~, #$, and #+.
* tests/read-print.scm: Add two tests.
2023-03-16 23:03:18 +01:00
Ludovic Courtès
eee95b5a87
packages: 'package-input-rewriting/spec' ignores hidden packages.
The primary motivation is to support things like:

  guix build guix --with-input=guile=guile-next

without triggering a rebuild of (@@ (gnu packages commencement)
guile-final) and similar things.

It is also consistent with package name resolution on the command line:
a package that cannot be named cannot be replaced.

* guix/packages.scm (package-input-rewriting/spec)[rewrite]: When P is
hidden, return it as-is.
* tests/packages.scm ("package-input-rewriting/spec, hidden package"):
New test.
* doc/guix.texi (Defining Package Variants): Update.
(Package Transformation Options): Update '--with-input' example.
2023-03-13 15:08:33 +01:00
Simon Tournier
9fb8a480d5
packages: Consider 'patches' by 'package-direct-sources'.
* guix/packages.scm (package-direct-sources): Return 'origin' from 'patches'.
* tests/packages.scm: Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-03-13 15:08:32 +01:00
Ludovic Courtès
0a37921d85
read-print: Correctly handle comments that follow a list head.
Fixes <https://issues.guix.gnu.org/61013>.
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

* guix/read-print.scm (pretty-print-with-comments)[starts-with-line-comment?]:
New procedure.
Use it when printing a list.
* tests/read-print.scm: Add two tests.
2023-03-07 11:39:50 +01:00
Ludovic Courtès
92a0e60a96
pack: Adjust shell tests to read-only tarball root.
Fixes <https://issues.guix.gnu.org/61853>.

Fixes a regression introduced in
68380db4c4, whereby the tarball's root
entry is now read-only, due to the creation of "profile-directory" in
the store.

* tests/guix-pack.sh: Remove and recreate $test_directory before
transformation option test.
* tests/guix-pack-relocatable.sh: Add "chmod +w $test_directory" lines
before attempts to write to it.
2023-02-27 23:40:43 +01:00
Ludovic Courtès
fee1d08f0d
pack: Make sure tests can run without a world rebuild.
Commit 68380db4c4 moved from
'gexp->derivation', which as a side effect, would lead tests to require
a "world rebuild"--specifically, they'd have to build (default-guile).

This was mitigated by 68775338a5, but that
change introduced another regression.

* guix/scripts/pack.scm (populate-profile-root): Define 'bootstrap?'.
Pass #:guile to 'computed-file', with a value depending on 'bootstrap?'.
* tests/pack.scm ("self-contained-tarball + localstatedir")
("docker-image + localstatedir", "squashfs-image + localstatedir")
("deb archive with symlinks and control files")
("rpm archive can be installed/uninstalled"): Use a <profile> record
instead of a derivation.
2023-02-27 15:54:09 +01:00
Lars-Dominik Braun
84549dcf38
import: hackage: Add upstream-name property.
* guix/import/hackage.scm (hackage-module->sexp): Add property
upstream-name to imported package.
* tests/hackage.scm (match-ghc-foo): Add upstream-name property.
(match-ghc-foo-6): Ditto.
(match-ghc-elif): Ditto.
(match-ghc-foo-revision): Ditto.
(match-ghc-foo-import): Ditto.
2023-02-26 10:19:36 +01:00
Maxim Cournoyer
598f4c509b
pack: Add RPM format.
* guix/rpm.scm: New file.
* guix/scripts/pack.scm (rpm-archive): New procedure.
(%formats): Register it.
(show-formats): Add it.
(guix-pack): Register supported extra-options for the rpm format.
* tests/pack.scm (rpm-for-tests): New variable.
("rpm archive can be installed/uninstalled"): New test.
* tests/rpm.scm: New test.
* doc/guix.texi (Invoking guix pack): Document it.
2023-02-19 21:13:23 -05:00
Maxim Cournoyer
ac1d530d56
tests: pack: Fix indentation.
* tests/pack.scm: Fix indentation.
2023-02-19 21:13:23 -05:00
Ludovic Courtès
0ef8fe22ed
linux-container: 'container-excursion' forks to join the PID namespace.
Fixes <https://issues.guix.gnu.org/61156>.

* gnu/build/linux-container.scm (container-excursion): Add extra call to
'primitive-fork' and invoke THUNK in the child process.
* tests/containers.scm ("container-excursion"): Remove extra
'primitive-fork' call, now unnecessary.
("container-excursion*, /proc"): New test.
2023-01-30 22:24:27 +01:00
Ludovic Courtès
52eb3db19c
container: Correctly report exit status.
* gnu/build/linux-container.scm (container-excursion): Return the raw
status value.
* tests/containers.scm ("container-excursion, same namespaces"): Add
'status:exit-val' call.
* guix/scripts/container/exec.scm (guix-container-exec): Correctly
handle the different cases.
2023-01-30 22:24:27 +01:00
Ludovic Courtès
ebcb5c8e12
tests: Do not try to create "$HOME/.config".
Previously this test would fail when HOME=/homeless-shelter and said
directory cannot be created.

* tests/guix-refresh.sh: Pass '--keyring' together with '-u'.
2023-01-25 22:53:20 +01:00
Ludovic Courtès
137b91f03b
transformations: Add '--with-version'.
This is a followup to 8aeccc6240.

* guix/transformations.scm (package-with-upstream-version): New procedure.
(transform-package-latest)[package-with-latest-upstream]: Remove.
Use 'package-with-upstream-version' instead.
(transform-package-version): New procedure.
(%transformations, %transformation-options)
(show-transformation-options-help/detailed): Add '-with-version'.
* tests/transformations.scm ("options->transformation, with-version"):
New test.
* doc/guix.texi (Package Transformation Options): Document '--with-version'.
(Defining Package Variants): Mention it.
2023-01-16 13:41:27 +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
6c343d0d0f
read-print: Do not use extended notation when printing '1+', '1-', etc.
* guix/read-print.scm (%special-non-extended-symbols): New variable.
(symbol->display-string): New procedure.
(pretty-print-with-comments): Use it in lieu of 'string->symbol'.
* tests/read-print.scm: Add test.
2023-01-09 17:40:54 +01:00
Ludovic Courtès
407175a1d0
daemon: Improve error message for wrong hash sizes.
* nix/libutil/hash.cc (parseHash): Show the hash algorithm name and
expected size in the error message.
* tests/derivations.scm ("fixed-output derivation, invalid hash size"):
New test.
2023-01-09 17:40:54 +01:00
Ludovic Courtès
5d24e57a61
derivations: 'read-derivation' correctly handles case with empty hash.
Reported by Stephen Paul Weber <singpolyma@singpolyma.net> at
<https://lists.gnu.org/archive/html/guix-devel/2023-01/msg00035.html>.

* guix/derivations.scm (read-derivation)[outputs->alist]: Treat the
empty hash case as non-fixed-output whether or not the hash algorithm is
the empty string, and preserve the hash algorithm in <derivation-output>.
* tests/derivations.scm ("'download' built-in builder, no fixed-output hash")
("fixed-output-derivation?, no hash", "read-derivation with hash = #f"): New tests.
2023-01-09 17:40:53 +01:00
Andrew Tropin
35ecbb418c
home: environment-variables: Fix escaping.
* gnu/home/services.scm (environment-variable-shell-definitions): Fix
escaping.
* tests/guix-home.sh: Add STRING_WITH_ESCAPES environment variable and test
its value.

Reported-by: elevnkb
2023-01-09 12:22:56 +04:00
Andrew Tropin
2acce55a00
home: environment-variables: Return support for file-likes and gexps.
* gnu/home/services.scm (environment-variable-shell-definitions): Add support
for file-likes and gexps.
* tests/guix-home.sh: Add SHELL environment variable and test its value.  Add
BUILDHOSTTIME environment variable.
2023-01-09 12:03:32 +04:00
Ludovic Courtès
04f247be81
refresh: Add CLI tests.
* guix/import/test.scm, tests/guix-refresh.sh: New files.
* Makefile.am (MODULES, SH_TESTS): Add them.
2023-01-08 16:11:45 +01:00
Ludovic Courtès
73684dc90e
home: services: environment-variables: Add support for literal strings.
* gnu/home/services.scm (<literal-string>): New record type.
(environment-variable-shell-definitions): Split 'shell-quote' into
'quote-string' and 'shell-double-quote'.  Add 'shell-single-quote'.
Add clause for 'literal-string' records.
* tests/guix-home.sh: Test it.
* doc/guix.texi (Essential Home Services): Document it.
2023-01-05 14:20:23 +01:00
Hartmut Goebel
d7a9d72bb0
tests: Fix gnu-maintenance tests.
The regression was introduce with commit
a274a6a1ac ("upstream-updater: Rename record
field.")

* tests/tests/gnu-maintenance.scm: ("latest-html-release, scheme-less URIs",
  "latest-html-release, no signature", "latest-html-release, signature"):
  Replace upstream-updater-latest by upstream-updater-import.

Reported-by: Ricardo Wurmus <rekado@elephly.net>
2023-01-02 00:06:51 +01:00
Ricardo Wurmus
4046405f73
tests: import-utils: Ignore extra keyword arguments.
* tests/import-utils.scm ("recursive-import", "recursive-import: skip false
packages (toplevel)", "recursive-import: skip false packages (dependency)"):
Do not try to match all arguments.
2022-12-31 14:48:46 +01:00
Attila Lendvai
363b20b685
records: match-record supports specifying a different variable name.
An example:

(match-record obj <my-type>
  (field1 (field2 custom-var-name) field3)
  ...)

* guix/records.scm (match-record-inner): Add support for the new syntax.
* tests/records.scm ("match-record, simple"): Add a simple test case for the
new syntax.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-12-27 23:53:42 +01:00
Hartmut Goebel
a274a6a1ac
upstream-updater: Rename record field.
The next commits will make the functions, which are currently importing the
latest version of a package, change into importing the latest or a given
version of the package (for those updaters supporting specifying a version).
Thus the name ‘latest‘ is no longer appropriate.

* guix/upstream.scm (upstream-updater) Rename field [latest] to
  [import]. (lookup-updater, package-latest-release) Adjust fieldname
  accordingly.
* guix/gnu-maintenance.scm (%gnu-updater, %gnu-ftp-updater,
  %savannah-updater, %sourceforge-updater, %xorg-updater,
  %kernel.org-updater, %generic-html-updater),
  guix/import/cpan.scm (%cpan-updater),
  guix/import/cran.scm (%cran-updater, %bioconductor-updater),
  guix/import/crate.scm (%crate-updater),
  guix/import/egg.scm (%egg-updater),
  guix/import/elpa.scm (%elpa-updater),
  guix/import/gem.scm (%gem-updater),
  guix/import/git.scm (%generic-git-updater),
  guix/import/github.scm (%github-updater),
  guix/import/gnome.scm (%gnome-updater),
  guix/import/hackage.scm (%hackage-updater),
  guix/import/hexpm.scm (%hexpm-updater),
  guix/import/kde.scm (%kde-updater),
  guix/import/launchpad.scm (%launchpad-updater),
  guix/import/minetest.scm (%minetest-updater),
  guix/import/opam.scm (%opam-updater),
  guix/import/pypi.scm (%pypi-updater),
  guix/import/stackage.scm (%stackage-updater),
  tests/import-github.scm (found-sexp)
  tests/transformations.scm ("options->transformation, with-latest"):
  Adjust fieldname accordingly.
2022-12-26 17:15:06 +01:00
Ludovic Courtès
2880dc3046
cpio: Skip test on inode numbers that don't fit on 32 bits.
Fixes <https://issues.guix.gnu.org/60202>.
Reported by Christopher Baines <mail@cbaines.net>.

* tests/cpio.scm (%test-file): New variable.
("file->cpio-header + write-cpio-header + read-cpio-header"): Use it.
Skip test when the inode number of %TEST-FILE is too big.
2022-12-20 16:56:03 +01:00
Ludovic Courtès
680970490c
tests: Adjust 'guix package' test to latest package search metrics.
With commit bbcd06e56c, the command
"guix package -s '^fileutils$'" would match the 'ocaml-fileutils'
package, because its 'package-upstream-name*' is "fileutils".  Work
around it.

Reported by Vagrant Cascadian.

* tests/guix-package.sh: Change "fileutils" example to use a different
package name.
2022-12-20 16:56:03 +01:00
Lars-Dominik Braun
bbcd06e56c
ui: Take package upstream name into account when searching.
* guix/ui.scm (%package-metrics): Add PACKAGE-UPSTREAM-NAME*.
* tests/ui.scm ("package-relevance and upstream name"): New test.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-12-13 17:46:39 +01:00
Lars-Dominik Braun
052faadde7
packages: Add 'package-upstream-name*'.
* guix/packages.scm (package-upstream-name*): New procedure.
* tests/packages.scm ("package-upstream-name*"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-12-13 17:46:39 +01:00
Ludovic Courtès
302a84a593
Merge branch 'version-1.4.0' 2022-12-12 15:03:35 +01:00
Ludovic Courtès
3677b97030
pki: 'public-keys->acl' deduplicates entries.
Reported by Tobias Geerinckx-Rice <me@tobias.gr>
in <https://issues.guix.gnu.org/50892>.

* guix/pki.scm (public-keys->acl): Add call to 'delete-duplicates'.
* tests/pki.scm ("public-keys->acl deduplication"): New test.
2022-12-12 15:03:05 +01:00
Ludovic Courtès
b129026e2e
deduplicate: Use 'sendfile' for small file copies.
* guix/store/deduplication.scm (dump-file/deduplicate): Use 'sendfile'
instead of 'dump-port'.
* tests/store-deduplication.scm ("copy-file/deduplicate, below %deduplication-minimum-size"):
New test.
2022-12-10 10:56:48 +01:00
Ludovic Courtès
754a7660a1
records: 'match-record' checks fields at macro-expansion time.
This allows 'match-record' to be more efficient (field offsets are
computed at compilation time) and to report unknown fields at
macro-expansion time.

* guix/records.scm (map-fields): New macro.
(define-record-type*)[rtd-identifier]: New procedure.
Define TYPE as a macro and use a separate identifier for the RTD.
(lookup-field, match-record-inner): New macros.
(match-record): Rewrite in terms of 'match-error-inner'.
* tests/records.scm ("match-record, simple")
("match-record, unknown field"): New tests.
* gnu/services/cuirass.scm (cuirass-shepherd-service): Rename 'log-file'
local variable to 'main-log-file'.
* gnu/services/getmail.scm (serialize-getmail-configuration-file): Move
after <getmail-configuration-file> definition.
2022-12-08 13:21:23 +01:00
Maxim Cournoyer
93309efdce
tests: Fix guix-system.sh test.
The regression was introduce with commit
c7793b82ef ("gnu: raspberry-pi: Add a
bootloader-chain for the Raspberry Pi and os examples.") due to the examples
needing to be built for the aarch64-linux system.

* tests/guix-system.sh: Invoke guix system build with '--system=aarch64-linux'
to build the Raspberry Pi systems.
2022-12-04 00:50:28 -05:00
Ludovic Courtès
7c1161dba4
records: 'match-record' checks fields at macro-expansion time.
This allows 'match-record' to be more efficient (field offsets are
computed at compilation time) and to report unknown fields at
macro-expansion time.

* guix/records.scm (map-fields): New macro.
(define-record-type*)[rtd-identifier]: New procedure.
Define TYPE as a macro and use a separate identifier for the RTD.
(lookup-field, match-record-inner): New macros.
(match-record): Rewrite in terms of 'match-error-inner'.
* tests/records.scm ("match-record, simple")
("match-record, unknown field"): New tests.
* gnu/services/cuirass.scm (cuirass-shepherd-service): Rename 'log-file'
local variable to 'main-log-file'.
* gnu/services/getmail.scm (serialize-getmail-configuration-file): Move
after <getmail-configuration-file> definition.
2022-12-02 00:02:12 +01:00
Philip McGrath
fd5e642513
import/utils: spdx-string->license: Support '+' operator.
Previously, '+' was supported only via special cases for deprecated
GNU identifiers like 'GPL-N+'.  This commit adds support
for other uses of '+', such as 'AFL-2.0+' and 'LPPL-1.0+'.

Strictly speaking, '+' is an operator, not part of the SPDX license
identifier, but it is useful to handle it here.

* guix/import/utils.scm (spdx-string->license): Support '+' operator.
* tests/import-utils.scm ("spdx-string->license"): Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-11-18 15:44:38 +01:00
Philip McGrath
07482dc051
import/utils: spdx-string->license: Match case-insensitively.
SPDX specifies that license identifiers (unlike the 'AND', 'OR', and
'WITH' operators) are matched case-insensitively.

* guix/import/utils.scm (%spdx-license-identifiers): New variable.
(spdx-string->license): Search in '%spdx-license-identifiers' using
'string-ci=?'.
* tests/import-utils.scm ("spdx-string->license"): New test.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-11-18 15:44:38 +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
c6cb7243fb
gnu-maintenance: 'release-file?' excludes "valgrind-3.20.0.RC1.tar.bz2".
* guix/gnu-maintenance.scm (%alpha-tarball-rx): Add "." before
"(alpha|beta|...)".
* tests/gnu-maintenance.scm ("release-file?"): Add test for Valgrind.
2022-11-11 23:17:43 +01:00
Ludovic Courtès
19206eee69
grafts: Run with a UTF-8 locale.
Fixes <https://issues.guix.gnu.org/55968>.
Reported by Maxime Devos <maximedevos@telenet.be>.

* guix/grafts.scm (%graft-with-utf8-locale?): New parameter.
(graft-derivation/shallow)[glibc-locales, set-utf8-locale]: New
variables.
[build]: Use 'set-utf8-locale'.
* tests/gexp.scm, tests/grafts.scm, tests/packages.scm: Set
'%graft-with-utf8-locale?' to #f.
2022-11-11 23:17:42 +01:00
John Kehayias
905443abb7
shell: Fix '--emulate-fhs' sometimes not including 'glibc-for-fhs'.
Fixes <https://issues.guix.gnu.org/58861>.

Previously the order of the options giving to 'guix shell' could mean that the
'glibc-for-fhs' package included with the '--emulate-fhs' option would not
appear in the container.  For example, using the development option with a
package using the 'gnu-build-system', e.g. 'guix shell -CFD hello', would
include the regular 'glibc' package.  The option ordered mattered: 'guix shell
-CD hello -F' would include the expected 'glibc-for-fhs'.  We fix this by
having 'glibc-for-fhs' added to the package list just before calling
'options-with-caching' so the option order given by the user does not matter.

* guix/scripts/shell.scm (%options): Move the '--emulate-fhs' (expression
. ...) component from here...
(parse-args): ... to here.
* tests/guix-environment-container.sh: Add a test to check that
'glibc-for-fhs' is in the container even when 'glibc' is included in the 'guix
shell' package list.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-11-06 12:38:02 +01:00
Lars-Dominik Braun
c485a9d8af
gnu: python-setuptools: Move to python-build.
* gnu/packages/python-xyz.scm (python-setuptools): Move…
* gnu/packages/python-build.scm: …here.
* gnu/packages/chemistry.scm,
gnu/packages/messaging.scm,
gnu/packages/sequoia.scm,
tests/lint.scm: Adjust module imports accordingly.

Co-authored-by: Marius Bakke <marius@gnu.org>
2022-10-27 19:43:06 +02: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
fa6566bdc0
tests: 'guix build --with-commit' output no longer refers to the tag ID.
This is a followup to 46f7011591.

* tests/guix-build-branch.sh: Replace tag ID by commit ID.
2022-10-22 01:46:54 +02:00
Ludovic Courtès
2383e14518
lint: source: Add check for <svn-reference> over HTTP(S).
* guix/lint.scm (svn-reference-uri-with-userinfo): New procedure.
(check-source): Add 'svn-reference?' clause.
* tests/lint.scm ("source: svn-reference, HTTP 200")
("source: svn-reference, HTTP 404"): New tests.
2022-10-17 23:15:08 +02:00
Ludovic Courtès
46f7011591
git: 'update-cached-checkout' returns the commit ID when given a tag.
Previously, starting with commit
efa578ecae, 'update-cached-checkout' would
return the OID of the annotated tag the tag points to.  With this change
it returns the OID of the commit object in all cases.

* guix/git.scm (resolve-reference): In the 'tag' case, call
'tag-target-id' and 'tag-lookup' when OID designates an annotated tag.
* tests/git.scm ("update-cached-checkout, tag"): New test.
2022-10-17 09:37:27 +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