me
/
guix
Archived
1
0
Fork 0
Commit Graph

2131 Commits (master)

Author SHA1 Message Date
Ludovic Courtès 885d524f79
substitute: Gracefully retry after failed partial downloads.
Fixes <https://issues.guix.gnu.org/63443>.
Reported by Attila Lendvai <attila@lendvai.name>.

* guix/scripts/substitute.scm (catch-system-error): New macro.
(download-nar): Add call to 'delete-file-recursively'.
* tests/substitute.scm ("substitute, previous partial download around"):
New test.
2023-06-08 22:54:58 +02:00
Ludovic Courtès 1819512073
services: 'modify-services' preserves service ordering.
Fixes <https://issues.guix.gnu.org/63921>.

The regression was introduced in
dbbc7e9461, which changed the order of
services.  As a result, someone using 'modify-services' could find
themselves with incorrect ordering of expressions in the "boot" script,
whereby the cleanup expressions would come after (execl ".../shepherd").
This, in turn, would lead shepherd to error out at boot with EADDRINUSE
on /var/run/shepherd/socket.

* gnu/services.scm (%delete-service, %apply-clauses): Remove.
(clause-alist): New macro.
(apply-clauses): New procedure.
(modify-services): Use it.  Adjust docstring.
* tests/services.scm ("modify-services: do nothing"): Remove 'sort' call.
("modify-services: delete service"): Likewise, and add 't4' service.
("modify-services: change value"): Remove 'sort' call and fix expected value.
2023-06-06 11:54:39 +02:00
Josselin Poiret 178ffed3b7
tests: records: Add test for ellipsis in body.
* tests/records.scm ("match-record, ellipsis in body"): New test.
2023-06-04 10:59:28 +02:00
(unmatched-parenthesis ew syntax 4cd5293621
records: Add MATCH-RECORD-LAMBDA.
* guix/records.scm (match-record-lambda): New syntax.
* tests/records.scm ("match-record-lambda"): New test.

Signed-off-by: Josselin Poiret <dev@jpoiret.xyz>
2023-06-04 10:59:25 +02:00
(unmatched-parenthesis d b88e38d4b5
records: match-record: Support thunked and delayed fields.
* guix/records.scm (match-record): Unwrap matched thunked and delayed fields.
* tests/records.scm ("match-record, thunked field",
"match-record, delayed field"): New tests.

Signed-off-by: Josselin Poiret <dev@jpoiret.xyz>
2023-06-04 10:34:35 +02:00
Brian Cully ae707b62e7
tests: Check for service existence in MODIFY-SERVICES
* tests/services.scm ("modify-services: delete non-existing service")
("modify-services: change value for non-existing service"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-06-02 16:16:12 +02:00
Brian Cully 09fcf261c1
tests: Add tests for MODIFY-SERVICES procedure
* tests/services.scm ("modify-services: do nothing")
("modify-services: delete service")
("modify-services: change value"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-06-02 16:16:07 +02:00
Ludovic Courtès 654fcf9971
tests: Use quasiquoted 'match' patterns for package sexps.
Turns out it's easier to read.

* tests/cpan.scm ("cpan->guix-package"): Use a quasiquoted pattern.
* tests/elpa.scm (eval-test-with-elpa): Likewise.
* tests/gem.scm ("gem->guix-package")
("gem->guix-package with a specific version")
("gem-recursive-import")
("gem-recursive-import with a specific version"): Likewise.
* tests/hexpm.scm ("hexpm-recursive-import"): Likewise.
* tests/opam.scm ("opam->guix-package"): Likewise.
* tests/pypi.scm ("pypi->guix-package, no wheel")
("pypi->guix-package, wheels")
("pypi->guix-package, no usable requirement file.")
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
* tests/texlive.scm ("texlive->guix-package"): Likewise.
2023-05-31 23:50:06 +02:00
Ludovic Courtès 57ceb64e34
upstream: Honor package properties for ignored and extra inputs.
* guix/upstream.scm (update-package-inputs)[filtered-inputs]
[regular-inputs, native-inputs, propagated-inputs]: New procedures.
Use them in 'update-field' calls.
* tests/guix-refresh.sh (GUIX_TEST_UPDATER_TARGETS): Add "libreoffice"
to the dependencies of "the-test-package".  Add 'updater-ignored-inputs'
property to "the-test-package".
* doc/guix.texi (Invoking guix refresh): Document it.
2023-05-31 23:25:26 +02:00
Ludovic Courtès 9e237fe0bd
import: gem: Updater provides input list.
* guix/import/gem.scm (import-release): Add 'inputs' field.
* tests/gem.scm ("package-latest-release"): New test.
2023-05-31 23:25:26 +02:00
Ludovic Courtès e6f82fcd5f
import: gem: Factorize "bundler" special case for name mapping.
* guix/import/gem.scm (ruby-package-name): Add "bundler" special case.
(gem->guix-package): Adjust accordingly.
* tests/gem.scm ("gem-recursive-import")
("gem-recursive-import with a specific version"): Remove "ruby-bundler"
from the expected packages.
2023-05-31 23:25:26 +02:00
Ludovic Courtès d46d1bee1e
import: elpa: Updater provides input list.
* guix/import/elpa.scm (elpa-dependency->upstream-input): New
procedure.
(latest-release): Add 'inputs' field.
* tests/elpa.scm ("package-latest-release"): New test.
2023-05-31 23:25:26 +02:00
Ludovic Courtès a738c1a0c7
import: cpan: Updater provides input list.
* guix/import/cpan.scm (latest-release): Add 'inputs' field.
* tests/cpan.scm ("package-latest-release"): New test.
2023-05-31 23:25:25 +02:00
Ludovic Courtès c4fe4e7eb8
import: cpan: Represent dependencies as <upstream-input> records.
* guix/import/cpan.scm (cpan-name->downstream-name)
(cran-dependency->upstream-input, cran-module-inputs): New procedures.
(cpan-module->sexp)[guix-name, convert-inputs]: Remove.
[maybe-inputs]: Adjust to deal with <upstream-input>.
Use 'cpan-name->downstream-name' instead of 'guix-name'.  Add call to
'cpan-module-inputs' and adjust calls to 'maybe-inputs'.  No longer emit
input labels.
* tests/cpan.scm ("cpan->guix-package"): Adjust test accordingly.
2023-05-31 23:25:25 +02:00
Ludovic Courtès 5d022d5563
tests: upstream: Restore test that was skipped.
This test was being skipped since
ea6fb108f6.

* tests/upstream.scm ("coalesce-sources same version"): Compare a
serialized form of <upstream-source>.
2023-05-31 23:25:25 +02:00
Ludovic Courtès cd262c403f
upstream: Remove <upstream-input-change> and related code.
* guix/upstream.scm (<upstream-input-change>): Remove.
(changed-inputs): Remove.
* tests/upstream.scm (test-package, test-new-package)
("changed-inputs returns no changes")
("changed-inputs returns changes to plain input list")
("changed-inputs returns changes to all plain input lists"): Remove.
2023-05-31 23:25:25 +02:00
Ludovic Courtès ec0a2fc87b
upstream: 'update-package-source' edits input fields.
Previously, 'guix refresh r-ggplot2 -u' and similar commands would print
of list of input changes that would have to be made manually.  With this
change, 'guix refresh -u' takes care of updating input fields
automatically.

* guix/upstream.scm (update-package-inputs): New procedure.
(update-package-source): Call it when 'upstream-source-inputs' returns
true.
* guix/scripts/refresh.scm (update-package): Remove iteration over the
result of 'changed-inputs'.
* guix/import/test.scm (available-updates): Add support for input
lists.
* tests/guix-refresh.sh (GUIX_TEST_UPDATER_TARGETS): Add input list for
"the-test-package".
Make sure 'guix refresh -u' updates 'inputs' accordingly.
* doc/guix.texi (Invoking guix refresh): Mention it.
2023-05-31 23:25:25 +02:00
Ludovic Courtès e6223017d9
upstream: Replace 'input-changes' field by 'inputs'.
Returning the expected list of inputs rather than changes relative to
the current package definition is less ambiguous and offers more
possibilities for further processing.

* guix/upstream.scm (<upstream-source>)[input-changes]: Remove.
[inputs]: New field.
(<upstream-input>): New record type.
* guix/upstream.scm (upstream-input-type-predicate)
(input-type-filter, upstream-source-regular-inputs)
(upstream-source-native-inputs, upstream-source-propagated-inputs): New
procedures.
(changed-inputs): Expect an <upstream-source> as its second argument.
Adjust accordingly.
* guix/import/pypi.scm (distribution-sha256): New procedure.
(maybe-inputs): Expect a list of <upstream-input>.
(compute-inputs): Rewrite to return a list of <upstream-input>.
(pypi-package-inputs, pypi-package->upstream-source): New procedures.
(make-pypi-sexp): Use it.
* guix/import/stackage.scm (latest-lts-release): Define 'cabal'.
Replace 'input-changes' field by 'inputs'.
* guix/scripts/refresh.scm (update-package): Use 'changed-inputs'
instead of 'upstream-source-input-changes'.
* tests/cran.scm ("description->package"): Adjust order of inputs.
* tests/pypi.scm (default-sha256, default-sha256/base32): New variables.
(foo-json): Add 'digests' entry.
("pypi->guix-package, no wheel"): Check HASH against DEFAULT-SHA256/BASE32.
("pypi->guix-package, wheels"): Likewise.
("pypi->guix-package, no usable requirement file."): Likewise.
("pypi->guix-package, package name contains \"-\" followed by digits"):
Likewise.
("package-latest-release"): New test.
* tests/upstream.scm (test-package-sexp): Remove.
("changed-inputs returns no changes"): Rewrite to use <upstream-source>.
(test-new-package-sexp): Remove.
("changed-inputs returns changes to plain input list"): Rewrite.
("changed-inputs returns changes to all plain input lists"): Likewise.
("changed-inputs returns changes to labelled input list")
("changed-inputs returns changes to all labelled input lists"): Remove.
* guix/import/cran.scm (maybe-inputs): Expect PACKAGE-INPUTS to be a
list of <upstream-input>.
(source-dir->dependencies): Return a list of <upstream-input>.
(vignette-builders): Likewise.
(uri-helper, cran-package-source-url)
(cran-package-propagated-inputs, cran-package-inputs): New procedures.
(description->package): Use them instead of local definitions.
(latest-cran-release): Replace 'input-changes' field by 'inputs'.
(latest-bioconductor-release): Likewise.
(format-inputs): Remove.
* guix/import/hackage.scm (cabal-package-inputs): New procedure.
(hackage-module->sexp): Use it.
[maybe-inputs]: Expect a list of <upstream-input>.
2023-05-31 23:25:24 +02:00
Ludovic Courtès d2f36abd02
tests: pypi: Rewrite tests using a local HTTP server.
* guix/import/pypi.scm (%pypi-base-url): New variable.
(pypi-fetch): Use it.
* tests/pypi.scm (foo-json): Compute URLs relative to '%local-url'.
(test-json-1, test-json-2, test-source-hash): Remove.
(file-dump): New procedure.
(with-pypi): New macro.
("pypi->guix-package, no wheel")
("pypi->guix-package, wheels")
("pypi->guix-package, no usable requirement file.")
("pypi->guix-package, package name contains \"-\" followed by digits"):
Rewrite using 'with-pypi'.
2023-05-31 23:25:24 +02:00
Ludovic Courtès 58da6b297c
tests: pypi: Factorize tarball and wheel file creation.
* tests/pypi.scm (sample-directory): New variable.
(pypi-tarball, wheel-file): New procedures.
("pypi->guix-package, no wheel")
("pypi->guix-package, wheels")
("pypi->guix-package, no usable requirement file.")
("pypi->guix-package, package name contains \"-\" followed by digits"):
Use them.
2023-05-31 23:25:24 +02:00
Ludovic Courtès 8af9a2aa5f
substitute: If a server's nar URL is 404, try the next one(s).
If a substitute server advertises in its narinfo, for example, both a
/zstd and a /lzip URL but the /zstd URL is unreachable, try the /lzip
URL.

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

* guix/narinfo.scm (narinfo-preferred-uris): New procedure.
(narinfo-best-uri): Rebase on top of it.
* guix/scripts/substitute.scm (download-nar)[try-fetch]: New procedure.
Use 'narinfo-preferred-uris' and 'try-fetch' to attempt all the URLs of
NARINFO.
* tests/substitute.scm (request-substitution): Remove 'parameterize'.
Delete DESTINATION.
("substitute, preferred nar URL is 404, other is 200"): New test.
2023-05-30 00:15:29 +02:00
Ludovic Courtès ba5da5125a
style: Add 'arguments' styling rule.
* guix/scripts/style.scm (unquote->ungexp, gexpify-argument-value)
(quote-argument-value, gexpify-argument-tail)
(gexpify-package-arguments): New procedures.
(%gexp-keywords): New variable.
(%options): Add "arguments" case for 'styling-procedure.
(show-stylings): Update.
* tests/style.scm ("gexpify arguments, already gexpified")
("gexpify arguments, non-gexp arguments, margin comment")
("gexpify arguments, phases and flags")
("gexpify arguments, append arguments")
("gexpify arguments, substitute-keyword-arguments")
("gexpify arguments, append substitute-keyword-arguments"): New tests.
* doc/guix.texi (package Reference): For 'arguments', add compatibility
note and link to 'guix style'.
(Invoking guix style): Document the 'arguments' styling rule.
2023-05-18 20:01:32 +02:00
Ludovic Courtès 71fd35c1d5
lint: archival: Warn against non-origin package sources.
Suggested by Maxim Cournoyer <maxim.cournoyer@gmail.com>
and Simon Tournier <zimon.toutoune@gmail.com>.

* guix/lint.scm (check-archival): Add 'local-file?' clause.  Clarify
message in case (package-source package) is not an origin.
* tests/lint.scm ("archival: not an origin"): New test.
2023-05-06 17:12:45 +02:00
Ludovic Courtès 8749f31485
read-print: Correctly read "(. x)".
* guix/read-print.scm (read-with-comments): Check whether REST is a pair
before calling 'set-cdr!'.
* tests/read-print.scm ("read-with-comments: half dot notation"): New test.
2023-05-05 23:47:48 +02:00
Sarthak Shah ae11fcb84a
transformations: Add '--with-configure-flag'.
* guix/transformations.scm (transform-package-configure-flag): New
procedure.
(%transformation-options, %transformation-options)
(show-transformation-options-help/detailed): Add it.
* tests/transformations.scm ("options->transformation,
with-configure-flag"): New test.
* doc/guix.texi (Package Transformation Options): Document it.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2023-05-04 17:06:44 +02:00
Ludovic Courtès 68fa28b3c3
style: Make 'safe' policy less conservative.
Previously, a mere (arguments '(#:tests? #f)) would lead

  guix style -S inputs --input-simplification=safe

to bail out.  It now recognizes such trivial argument lists and
proceeds.

* guix/scripts/style.scm (trivial-package-arguments?): New procedure.
(simplify-package-inputs): Use it in the 'safe case instead of 'null?'.
* tests/style.scm ("input labels, 'safe' policy, trivial arguments"):
New test.
2023-05-04 17:06:43 +02:00
Ludovic Courtès 1ad52e2eeb
import: pypi: Adjust tests for new build system.
This is a followup to cb8d080349.

* tests/pypi.scm ("pypi->guix-package, no wheel")
("pypi->guix-package, wheels")
("pypi->guix-package, no usable requirement file.")
("pypi->guix-package, package name contains \"-\" followed by digits"):
Replace 'python-build-system' by 'pyproject-build-system'.
2023-04-30 22:30:49 +02:00
Josselin Poiret ee88acc6e2
tests: guix-graph.sh: Fix expected path from emacs to libffi.
* tests/guix-graph.sh: Change the expected path from emacs to libffi.  `guix
graph --path` outputs only one possible path, and the one it outputs for this
case has changed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-04-28 19:50:39 +02:00
Josselin Poiret 5c26e69118
tests: guix-build.sh: Don't use hidden gcc for transformation tests.
* tests/guix-build.sh: Do not try to rewrite gcc, it is hidden and so will not
be rewritten, as per eee95b5a87.  Instead, try
to build grep with coreutils rewritten to hello.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-04-28 19:50:36 +02:00
Ludovic Courtès 7931ac810b
read-print: 'pretty-print-with-comments' keeps newlines on long strings.
* guix/read-print.scm (printed-string)[preserve-newlines?]: New
procedure.
Use it to preserve newlines on long strings.
* tests/read-print.scm: Add test.
2023-04-24 10:27:13 +02:00
Ludovic Courtès 61a6b05850
tests: Relax two tests that expected a non-zero error code.
* tests/guix-package-aliases.sh: "guix upgrade foo bar" has always
returned zero; adjust accordingly.
* tests/guix-refresh.sh: "guix refresh -t test idutils" and similar
return zero; adjust accordingly.
2023-04-21 17:09:46 +02:00
Eric Bavier 37dd69b445
tests: Fix checks for expected failures.
Addresses <https://issues.guix.gnu.org/62406>.

With 'set -e', a return status inverted with '!' does not cause the shell to
exit immediately.  Instead use '&& false' to indicate an expected failure.

* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh,
tests/guix-daemon.sh, tests/guix-download.sh,
tests/guix-environment-container.sh, tests/guix-environment.sh,
tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh,
tests/guix-hash.sh, tests/guix-home.sh, tests/guix-pack-relocatable.sh,
tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh,
tests/guix-package.sh, tests/guix-refresh.sh, tests/guix-shell.sh,
tests/guix-style.sh, tests/guix-system.sh: Replace uses of '! ...' with
'... && false' or `test ! ...` as appropriate.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-04-21 16:16:38 +02:00
Maxim Cournoyer 286cdf0bc5
tests: guix-system: Drop the i686-linux desktop image test.
Desktop these days means having Rust support (GNOME), which i686 currently
lacks on Guix.

* tests/guix-system.sh: Do not attempt to build the desktop.tmpl image for
i686-linux.
2023-04-18 11:43:14 -04:00
Maxim Cournoyer 04cccedba5
tests: Fix texlive->guix-package test.
The home page for the package had changed.

* tests/texlive.scm ("texlive->guix-package"): Match the home-page and
synopsis inexactly to avoid future similar breakages.
2023-04-18 11:23:47 -04:00
Maxim Cournoyer edffb3554f
tests: Re-add debug output to a package tests.
* tests/packages.scm ("fold-available-packages with/without cache"):
Re-introduce debugging output.
2023-04-18 11:23:47 -04:00
Bruno Victal 5481aaacb5
packages: Remove 'origin-sha256' procedure.
* guix/packages.scm (origin-sha256): Remove procedure.
* tests/import-utils.scm (test-import-utils)
[alist->package with explicit source]: Use content-hash-value.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-04-07 18:00:08 +02:00
Bruno Victal b92880d011
services: ntp-service-type: Remove deprecated server as strings support.
* gnu/services/networking.scm (<ntp-configuration>)[servers]: Rename accessor to ntp-configuration-servers.
(ntp-configuration-servers): Remove helper procedure.
(ntp-shepherd-service): Remove helper procedure usage.
* tests/networking.scm: Remove obsolete test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-04-07 17:56:07 +02:00
Bruno Victal acdb42e5d0
gnu: Purge pre-1.3.0 deprecated packages.
* gnu/packages/bioinformatics.scm (deeptools): Remove variable.
* gnu/packages/efi.scm (efi_analyzer): Ditto.
* gnu/packages/guile.scm (guile-2.2/bug-fix, guile-json): Ditto.
* gnu/packages/image.scm (libjpeg): Ditto.
* gnu/packages/kde.scm (kdevplatform): Ditto
* gnu/packages/linphone.scm (linphoneqt): Ditto.
* gnu/packages/maths.scm (blis-sandybridge, blis-haswell, blis-knl): Ditto.
* gnu/packages/mpi.scm (hwloc-2.0): Ditto.
* gnu/packages/music.scm (python-abjad, zlfo): Ditto.
* gnu/packages/perl.scm (perl-base, perl-parent): Ditto.
* gnu/packages/tryton.scm (python-trytond): Ditto.
* gnu/packages/video.scm (gnome-mpv): Ditto.
* tests/graph.scm: Use guile-json-1.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-04-07 17:53:37 +02: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
Bruno Victal 0fbb356714
services: replace bare serializers with (serializer ...)
* gnu/home/services/shells.scm
(home-zsh-configuration)[environment-variables]: Use (serializer ...).
(home-bash-configuration)[aliases, environment-variables]: Likewise.
(home-fish-configuration)[abbreviations, aliases]
[environment-variables]: Likewise.
* gnu/services/audio.scm (mpd-configuration)[music-dir, playlist-dir]
[endpoints, address, inputs, archive-plugins, input-cache-size]
[decoders, filters, playlist-plugins]: Likewise.
* gnu/services/linux.scm (fstrim-configuration)[extra-arguments]:
Likewise.
* gnu/services/security.scm (fail2ban-jail-configuration)[backend]
[log-encoding, extra-content]: Likewise.
* tests/services/configuration.scm: Update tests.
("serialize-configuration [deprecated]"): New test.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2023-04-02 12:35:30 +02:00
Bruno Victal 6f48efa9b8
services: configuration: Add user-defined sanitizer support.
This changes the 'custom-serializer' field into a generic
'extra-args' field that can be extended to support new literals.
Within extra-args, the literals 'sanitizer' and 'serializer' allow
for user-defined sanitization and serialization procedures respectively.
The 'empty-serializer' was also added as a literal to be used as before.

To prevent confusion between the new “explicit” style of specifying
a sanitizer, and the old “implicit” style, the latter has been
deprecated, and a warning is issued if it is encountered.

* gnu/services/configuration.scm (define-configuration-helper):
Rename 'custom-serializer' to 'extra-args'.  Add support for literals
'sanitizer', 'serializer' and 'empty-serializer'.  Rename procedure
'field-sanitizer' to 'default-field-sanitizer' to avoid syntax clash.
Only define default field sanitizers if user-defined ones are absent.
(normalize-extra-args): New variable.
(<configuration-field>)[sanitizer]: New field.
* doc/guix.texi (Complex Configurations): Document the newly added
literals.
* tests/services/configuration.scm: Add tests for the new literals.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2023-04-02 12:31:51 +02:00
Maxim Cournoyer cc7a79a8ad
Revert "lint: Append "/info/refs" to git-reference-url."
This reverts commit c9af27d4ca.

The change causes 'guix lint' to print URI not reachable (403) errors for
GitHub every URLs.
2023-03-28 22:22:50 -04:00
Felix Lechner c9af27d4ca
lint: Append "/info/refs" to git-reference-url.
For the atftp package added in the preceeding commit, lint produced this
warning:

  gnu/packages/networking.scm:2924:5: atftp@0.8.0:
    URI https://git.code.sf.net/p/atftp/code not reachable:
      404 ("Not Found")

Thanks to Sergey Trofimov for suggesting a fix! [1]

  [1]  https://issues.guix.gnu.org/62156#3

It was implemented here, and the warning disappeared.

* guix/lint.scm (check-source): Append "/info/refs" to git-reference-url.

Co-authored-by: Sergey Trofimov <sarg@sarg.org.ru>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-03-27 18:48:53 +02:00
Ting-Wei Lan f5c62f106d
tests: Fix guix-home.sh when guix isn't installed
* tests/guix-home.sh: Reorder NIX_STORE_DIR variable definition to
prevent guix from crashing due to missing /gnu/store.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-03-26 23:25:34 +02:00
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
Ludovic Courtès b6bc4c109b
packages: Raise an exception for invalid 'license' values.
This is written in such a way that the type check turns into a no-op at
macro-expansion time for trivial cases:

  > ,optimize (validate-license gpl3+)
  $18 = gpl3+
  > ,optimize (validate-license (list gpl3+ gpl2+))
  $19 = (list gpl3+ gpl2+)

* guix/packages.scm (valid-license-value?, validate-license): New
macros.
(<package>)[license]: Add 'sanitize' option.
(&package-license-error): New error condition type.
* tests/packages.scm ("license type checking"): New test.
2022-10-10 11:16:07 +02:00
Ludovic Courtès 31708431c5
tests: Attempt to build 'desktop.tmpl' on all major architectures.
Partly fixes <https://issues.guix.gnu.org/58352>.

* tests/guix-system.sh: Try to build 'desktop.tmpl' for x86_64, i686, and aarch64.
2022-10-07 16:01:39 +02:00
Ricardo Wurmus 421a87a68a
tests: Add new test cases for beautify-description.
* tests/import-utils.scm ("beautify-description: use double spacing"): Update.
("beautify-description: remove single quotes",
"beautify-description: escape @"): New tests.
2022-10-05 23:59:48 +02:00
Ludovic Courtès 28ade1bab2
transformations: '--with-source' now operates in depth.
The '--with-source' option is the first one that was implemented, and
it's the only one that would operate only on leaf packages rather than
traversing the dependency graph.  This change makes it consistent with
the rest of the transformation options.

* guix/transformations.scm (evaluate-source-replacement-specs): New
procedure.
(transform-package-source): Rewrite using it.
* tests/transformations.scm ("options->transformation, with-source, no
matches"): Rewrite since we no longer get a warning.
("options->transformation, with-source, in depth"): New test.
* doc/guix.texi (Package Transformation Options): Adjust examples.
2022-09-29 22:59:49 +02:00
itd 8b2119a5e4
import: print: Quasiquote properties
* guix/import/print.scm (package->code): Quasiquote properties.
* tests/print.scm (pkg-with-properties, pkg-with-properties-source):
New variables.
("package with properties"): New test

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-09-29 22:59:48 +02:00
itd 61bd7bf469
import/utils: alist->package: Include properties.
* guix/import/utils.scm (alist->package): Process properties field in input
data and include it in the generated package.
* tests/import-utils.scm ("alist->package with properties"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-09-29 22:59:48 +02:00
Ludovic Courtès 8bd4126917
substitute: Retry downloading when a nar is unavailable.
Fixes <https://issues.guix.gnu.org/57978>
Reported by Attila Lendvai <attila@lendvai.name>.

Previously, if a narinfo was available but its corresponding nar was
missing (for instance because the narinfo was cached and the server
became unreachable in the meantime), 'guix substitute --substitute'
would try to download the nar from its preferred location and abort when
that fails.  This change forces one retry with each of the URLs.

* guix/scripts/substitute.scm (download-nar): Do not catch
'http-get-error?' exceptions.
(system-error?, network-error?, process-substitution/fallback): New
procedures.
(process-substitution): Call 'process-substitution/fallback' upon
'network-error?'.
* tests/substitute.scm ("substitute, first URL has narinfo but lacks nar, second URL unauthorized")
("substitute, first URL has narinfo but nar is 404, both URLs authorized")
("substitute, first URL has narinfo but nar is 404, one URL authorized")
("substitute, narinfo is available but nar is missing"): New tests.
2022-09-28 22:28:27 +02:00
Maxime Devos 5c37ad812b
gnu-maintenance: Test latest-html-release.
* tests/gnu-maintenance.scm ("latest-html-release, no signature")
("latest-html-release, signature): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-09-26 23:29:37 +02:00
Ludovic Courtès 08023bcab3
substitute: Test behavior with unroutable substitute server addresses.
* tests/substitute.scm (%unroutable-substitute-url): New variable.
("query narinfo signed with authorized key, unroutable URL first")
("substitute, authorized key, first substitute URL is unroutable"): New
tests.
2022-09-24 17:59:04 +02:00
Ludovic Courtès 76c58ed59c
home: import: Use (guix read-print) to render the config file.
* guix/scripts/home/import.scm (manifest+configuration-files->code):
Insert calls to 'comment' and 'vertical-space'.
(import-manifest): Use 'pretty-print-with-comments/splice' instead of a
loop on 'pretty-print'.
* tests/home-import.scm (remove-recursively): New procedure.
(eval-test-with-home-environment): Use it.
2022-09-20 19:24:31 +02:00
Ludovic Courtès 7a698da0d0
read-print: Correctly support multiple same-named newline forms.
Previously (home-environment (services ...)) would not be considered a
"newline form".  This fixes it.

* guix/read-print.scm (newline-form?): Use 'vhash-foldq*' instead of
'vhash-assq' and iterate over candidates.
* tests/read-print.scm: Add test.
2022-09-20 19:24:31 +02:00
Maxime Devos c967d1153c
gnu-maintenance: Support // URLs in latest-html-release.
This makes "./pre-inst-env guix refresh -u" download the release tarball from
the right place -- previously, it downloaded from

https://www.libreoffice.org//download.documentfoundation.org/libreoffice/src/7.4.0/libreoffice-7.4.0.3.tar.xz?idx=1

whereas it should download from

https://download.documentfoundation.org/libreoffice/src/7.4.0/libreoffice-7.4.0.3.tar.xz?idx=1

instead.

* guix/gnu-maintenance.scm (latest-html-release)[url-release]: Adjust
computation in the case of an absolute URI-reference without a scheme.
* tests/gnu-maintenance.scm ("latest-html-release, scheme-less URIs"):
Test it.

Signed-off-by: Christopher Baines <mail@cbaines.net>
2022-09-17 19:09:45 +02:00
Taiju HIGASHI 5d22261db3
import: gem: Support importing a specific version of a gem.
* guix/import/gem.scm: (rubygems-fetch, gem->guix-package)
(gem-recursive-import): Fix to fetch the specified version of the gem.
* guix/scripts/import/gem.scm (show-help): Update the help message.
(guix-import-gem): Modify so the version number to be passed to subsequent
procedures.
* tests/gem.scm: Add tests.
* doc/guix.texi (Invoking guix import): Document.

Signed-off-by: Christopher Baines <mail@cbaines.net>
2022-09-17 19:09:27 +02:00
Ludovic Courtès f1bbb06dad
guix system: Do not use 'vm-image.tmpl' in tests.
This is a followup to 95a03aa5c5.  Since
that commit, merely evaluating 'vm-image.tmpl' would trigger the build
of 'current-guix' so skip it.

* tests/guix-system.sh: Do not try to build 'vm-image.tmpl'.
2022-09-04 23:10:10 +02:00
Ludovic Courtès 9e59dbcd6c
guix describe: Adjust test to latest changes.
This is a followup to 64a070717c.

* tests/guix-describe.sh: Add trailing slash when checking URL.
2022-09-04 23:10:10 +02:00
Ludovic Courtès 7a2acbdc5a
store: Open daemon connections with SOCK_CLOEXEC.
Previously, 'guix shell' for example would leak the socket that's
connected to the daemon.

* guix/store.scm (open-unix-domain-socket, open-inet-socket): Pass
SOCK_CLOEXEC to 'socket'.
* tests/guix-shell.sh: Add test.
2022-09-04 23:10:10 +02:00
Ludovic Courtès 82968362ea
read-print: Define forms for which \n, \t, etc. are not escaped.
Previously, the pretty-printer would unconditionally leave everything
but double-quotes and backslashes unescaped when rendering a string.
With this change, the previous behavior only applies to forms listed in
%NATURAL-WHITESPACE-STRING-FORMS.

* guix/read-print.scm (%natural-whitespace-string-forms): New variable.
(printed-string): New procedure.
(pretty-print-with-comments): Use it instead of 'escaped-string'.
* tests/read-print.scm: Add test.
2022-09-02 10:49:35 +02:00
Ludovic Courtès c3b1cfe76b
read-print: Guess the base to use for integers being printed.
Fixes <https://issues.guix.gnu.org/57090>.
Reported by Christopher Rodriguez <yewscion@gmail.com>.

* guix/read-print.scm (%symbols-followed-by-octal-integers)
(%symbols-followed-by-hexadecimal-integers): New variables.
* guix/read-print.scm (integer->string): New procedure.
(pretty-print-with-comments): Use it.
* tests/read-print.scm: Add test.
2022-09-01 18:31:26 +02:00
Maxim Cournoyer 0ea62e84a7
services: Add lightdm-service-type.
* gnu/services/lightdm.scm: New service.
* tests/services/lightdm.scm: Test it.
* doc/guix.texi (X Window): Document it.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register it.

Co-authored-by: L p R n d n <guix@lprndn.info>
Co-authored-by: Ricardo Wurmus <rekado@elephly.net>
2022-08-28 22:28:47 -04:00
Josselin Poiret 3294fa2ba4
tests: Add test for menu-entry roundtrips as sexps.
* tests/boot-parameters.scm (%uuid-menu-entry,
%file-system-label-menu-entry): New variables.
("menu-entry roundtrip, uuid", "menu-entry roundtrip,
file-system-label"): New tests.

Signed-off-by: Marius Bakke <marius@gnu.org>
2022-08-28 23:37:28 +02:00
Attila Lendvai 6fb9759ef3
services: configuration: Change the value of the unset marker.
The new value of %unset-value sticks out more when something goes wrong, and
is also more unique; i.e. easier to search for.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-08-25 00:10:42 -04:00
Attila Lendvai ee08277a70
services: Use the new maybe/unset API.
* gnu/home/services/ssh.scm (serialize-address-family): Use the public API of
the maybe infrastructure.
* gnu/services/file-sharing.scm (serialize-maybe-string): Use maybe-value.
(serialize-maybe-file-object): Use maybe-value-set?.
* gnu/services/getmail.scm (getmail-retriever-configuration): Don't use
internals in unset field declarations.
(getmail-destination-configuration): Ditto.
* gnu/services/messaging.scm (raw-content?): Use maybe-value-set?.
(prosody-configuration): Use %unset-value.
* gnu/services/telephony.scm (jami-shepherd-services): Use maybe-value-set?.
(archive-name->username): Use maybe-value-set?.
* tests/services/configuration.scm ("maybe type, no default"): Use
%unset-value.

Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-08-25 00:10:32 -04:00
Ludovic Courtès ebda12e1d2
read-print: Report missing closing parens instead of looping.
Fixes <https://issues.guix.gnu.org/57093>.
Reported by Mohammed AMAR-BENSABER <renken@shione.net>.

Previously 'read-with-comments' would enter an infinite loop.

* guix/read-print.scm (read-with-comments)[missing-closing-paren-error]:
New procedure.
Call it when 'loop' as called from 'liip' returns EOF.
* tests/read-print.scm ("read-with-comments: missing closing paren"):
New test.
2022-08-10 16:53:58 +02:00
Maxim Cournoyer 97cb43e732
tests: configuration: Add a test to cover 'unset regression.
The regression was introduced with a2b89a3319,
and introduce a risk that 'unset leaks to serialized configuration files.

* tests/services/configuration.scm (maybe-symbol): New type.
(config-with-maybe-symbol): New configuration.
("symbol maybe value serialization, unspecified"): New test.

Reported-by: Attila Lendvai <attila@lendvai.name>
2022-08-09 23:14:42 -04:00
Ludovic Courtès 6db3b34d72
read-print: Add 'case' and 'cond' special forms.
* guix/read-print.scm (%special-forms): Add 'case' and 'cond'.
* tests/read-print.scm: Add tests.
2022-08-08 11:54:25 +02:00
Ludovic Courtès 445a0d134c
read-print: Support printing multi-line comments.
* guix/read-print.scm (%not-newline): New variable.
(print-multi-line-comment): New procedure.
(pretty-print-with-comments): Use it.
* tests/read-print.scm ("pretty-print-with-comments, multi-line
comment"): New test.
2022-08-08 11:54:24 +02:00
Ludovic Courtès a15542d26d
style: Add '--whole-file' option.
* guix/scripts/style.scm (format-whole-file): New procedure.
(%options, show-help): Add '--whole-file'.
(guix-style): Honor it.
* tests/guix-style.sh: New file.
* Makefile.am (SH_TESTS): Add it.
* doc/guix.texi (Invoking guix style): Document it.
2022-08-08 11:53:33 +02:00
Ludovic Courtès 90ef692e9b
read-print: 'canonicalize-comment' leaves top-level comments unchanged.
This lets users use three leading semicolons, for instance, in top-level
comments.

* guix/read-print.scm (canonicalize-comment): Add INDENT parameter and
honor it.
(pretty-print-with-comments): Change default value of #:format-comment.
Call FORMAT-COMMENT with INDENT as the second argument.
* tests/read-print.scm: Adjust test accordingly.
2022-08-08 11:22:32 +02:00
Ludovic Courtès 9b00c97de4
read-print: Add code to read and write sequences of expressions/blanks.
* guix/read-print.scm (read-with-comments): Add #:blank-line? and honor it.
(read-with-comments/sequence, pretty-print-with-comments/splice): New
procedures.
* tests/read-print.scm (test-pretty-print/sequence): New macro.
Add tests using it.
2022-08-08 11:22:32 +02:00
Ludovic Courtès 077324a16f
read-print: Recognize page breaks.
* guix/read-print.scm (<page-break>, page-break?, page-break)
(char-set:whitespace-sans-page-break): New variables.
(space?): New procedure.
(read-vertical-space): Use it.
(read-until-end-of-line): New procedure.
(read-with-comments): Add #\page case.
(pretty-print-with-comments): Add 'page-break?' case.
* tests/read-print.scm ("read-with-comments: top-level page break"): New
test.
Add round-trip test with page break within an sexp.
2022-08-08 11:22:32 +02:00
Ludovic Courtès f687e27e03
read-print: Read and render vertical space.
* guix/read-print.scm (<vertical-space>, vertical-space?)
(vertical-space, vertical-space-height): New variables.
(combine-vertical-space, canonicalize-vertical-space)
(read-vertical-space): New procedures.
(read-with-comments): Use it in the #\newline case.
(pretty-print-with-comments): Add #:format-vertical-space and honor it.
Add case for 'vertical-space?'.
* guix/scripts/style.scm (format-package-definition): Pass
 #:format-vertical-space to 'object->string*'.
* tests/read-print.scm ("read-with-comments: list with blank line")
("read-with-comments: list with multiple blank lines")
("read-with-comments: top-level blank lines")
("pretty-print-with-comments, canonicalize-vertical-space"): New tests.
Add a couple of additional round-trip tests.
2022-08-08 11:22:32 +02:00
Ludovic Courtès 3eb3901d7f
style: Adjust test to not emit blank lines.
Previously this test would produce a file containing blank lines between
inputs.

* tests/style.scm ("input labels, modify-inputs and margin comment"):
Remove trailing newlines in replacement strings of 'substitute*'
expression.
2022-08-08 11:22:32 +02:00
Ludovic Courtès 5817e222fa
style: Move reader and printer to (guix read-print).
* guix/scripts/style.scm (<comment>, read-with-comments)
(vhashq, %special-forms, %newline-forms, prefix?)
(special-form-lead, newline-form?, escaped-string)
(string-width, canonicalize-comment, pretty-print-with-comments)
(object->string*): Move to...
* guix/read-print.scm: ... here.  New file.
* guix/scripts/import.scm: Adjust accordingly.
* tests/style.scm: Move 'test-pretty-print' and tests to...
* tests/read-print.scm: ... here.  New file.
* Makefile.am (MODULES): Add 'guix/read-print.scm'.
(SCM_TESTS): Add 'tests/read-print.scm'.
2022-08-08 11:22:31 +02:00
Andrew Tropin 4337e8466e
tests: Make tests inside container reproducible.
* tests/guix-home.sh: Make tests inside container reproducible.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-08-05 15:28:03 +02:00
Maxim Cournoyer a2b89a3319
services: configuration: Step back from *unspecified*.
Fixes <https://issues.guix.gnu.org/56799>.

This partially reverts 8cb1a49a39.

Rationale: *unspecified* cannot be serialized thus used as a G-Expression
input, which is problematic/inconvenient when using deeply nested records.  As
an example, jami-service-type was broken when using partially defined
<jami-account> records.

* gnu/services/configuration.scm (define-maybe-helper): Check against the
'unset symbol.
(normalize-field-type+def): Adjust value to 'unset.
(define-configuration-helper): Use 'unset as the default value thunk.
* gnu/services/file-sharing.scm (serialize-maybe-string): Check against the
'unset symbol.
(serialize-maybe-file-object): Likewise.
* gnu/services/messaging.scm (define-all-configurations): Use 'unset as
value.
(raw-content?): Check against 'unset symbol.
(prosody-configuration)[http-max-content-size]: Default to 'unset.
[http-external-url]: Likewise.
[mod-muc]: Likewise.
[raw-content]: Likewise.
* gnu/services/networking.scm (opendht-configuration): Adjust documentation.
* gnu/services/telephony.scm (jami-shepherd-services): Replace *undefined*
with the 'unset symbol.
* tests/services/configuration.scm ("maybe type, no default"): Check against
the 'unset symbol.
* doc/guix.texi: Regenerate the opendht-configuration,
openvpn-client-configuration and openvpn-server-configuration documentation.
2022-08-01 12:49:35 -04:00
Ricardo Wurmus c9a37f57cb
tests: Adjust texlive importer tests.
This is a follow-up to commit be7b314f3f.

* tests/texlive.scm: Add version field to expected output.
2022-07-22 23:03:46 +02:00
Ludovic Courtès af4c103595
home: services: environment-variables: Double-quote values.
Fixes <https://issues.guix.gnu.org/54469>.
Reported by Maxime Devos <maximedevos@telenet.be>.

* gnu/home/services.scm (environment-variable-shell-definitions): New
procedure, with code formerly in 'serialize-posix-env-vars'.
(environment-variables->setup-environment-script): Change
"setup-environment" from 'mixed-text-file' to 'computed-file', and use
'environment-variable-shell-definitions'.
* tests/guix-home.sh: Test it.
* gnu/home/services/shells.scm (serialize-posix-env-vars): Delegate to
'environment-variable-shell-definitions'.
2022-07-14 01:05:34 +02:00
Ludovic Courtès 8af749224f
home: services: shells: Double-quote environment variable values.
Fixes <https://issues.guix.gnu.org/56540>.

Until now, environment variable values were emitted unquoted, producing
invalid shell code if the value contains spaces for example.

* gnu/home/services/shells.scm (serialize-posix-env-vars): Define
'shell-quote' procedure in staged code and use it for #$value.
* tests/guix-home.sh: Add test for PS1 variable with a value containing
spaces.
2022-07-14 01:05:34 +02:00
Maxim Cournoyer dcf133587a
tests: build-emacs-utils: Allow test to pass on Emacs 27 too.
* tests/build-emacs-utils.scm
("emacs-batch-script: raise &emacs-batch-error on failure"): More loosely
match expected error string, which differs between Emacs 27 and Emacs 28.
2022-07-13 10:49:40 -04:00
Ludovic Courtès 9fdc4b6c28
monads: Add 'mparameterize'.
* etc/system-tests.scm (mparameterize): Move to...
* guix/monads.scm (mparameterize): ... here.
* tests/monads.scm ("mparameterize"): New test.
* .dir-locals.el (c-mode): Add it.
2022-07-10 23:57:14 +02:00
Ludovic Courtès 89e2288751
profiles: Support the creation of profiles with version 3 manifests.
* guix/profiles.scm (%manifest-format-version): New variable.
(manifest->gexp): Add optional 'format-version' parameter.
[optional, entry->gexp]: Honor it.
(profile-derivation): Add #:format-version parameter and honor it.
(<profile>)[format-version]: New field.
(profile-compiler): Honor it.
* guix/build/profiles.scm (manifest-sexp->inputs+search-paths): Support
both versions 3 and 4.  Remove unused 'properties' variable.
* tests/profiles.scm ("profile-derivation format version 3"): New test.
2022-07-08 23:58:11 +02:00
Christopher Baines b4c4a6acb1
guix: inferior: Fix the behaviour of open-inferior #:error-port.
I'm looking at this as the Guix Data Service uses this behaviour to record and
display logs from inferior processes.

* guix/inferior.scm (open-bidirectional-pipe): Call dup2 for file descriptor
2, passing either the file number for the current error port, or a file
descriptor for /dev/null.
* tests/inferior.scm ("#:error-port stderr", "#:error-port pipe"): Add two new
tests that cover some of the #:error-port behaviour.
2022-07-08 13:51:34 +01:00
Maxim Cournoyer 258bc4c4e6
tests: telephony: Remove obsolete parsing tests.
Fixes <https://issues.guix.gnu.org/56343>.

* tests/services/telephony.scm (parse-dbus-reply, parse-account-ids)
(parse-account-details, parse-contacts, getAccountList-reply): Delete
procedures.
("parse-account-ids"): Delete test.
(getAccountDetails-reply): Delete procedure.
("parse-account-details; username, alias and display name"): Delete test.
(getContacts-reply): Delete procedure.
("parse-account-contacts"): Delete test.
(getContacts-empty-reply): Delete procedure.
("parse-account-contacts, empty array"): Delete test.

Reported-by: Ludovic Courtès <ludo@gnu.org>
2022-07-07 10:43:08 -04:00
Ludovic Courtès 8d9291bd2c
style: For 'let' and similar forms, emit one binding per line.
Previously, 'let' bindings could be rendered like this:

  (let ((x 1) (y 2)
        (z 3))
    ...)

With this change, each bindings goes in its own line.

Partly fixes <https://issues.guix.gnu.org/56297>.
Reported by Maxime Devos <maximedevos@telenet.be>.

* guix/scripts/style.scm (pretty-print-with-comments)[list-of-lists?]:
New procedure.
Use it.
* tests/style.scm: Add tests with 'let' and 'substitute-keyword-arguments'.
2022-07-04 23:38:38 +02:00
Ludovic Courtès bee2c369fa
tests: Adjust 'guix graph' test to latest OCaml changes.
* tests/graph.scm ("reverse bag DAG"): Adjust to latest OCaml changes by
looking at dune/ocaml-camomile/ocaml-utop.
2022-07-01 23:29:16 +02:00
Ludovic Courtès 4ff12d1de7
profiles: Do not repeat entries in 'manifest' file.
Fixes <https://issues.guix.gnu.org/55499>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

With this change, the manifest file created for:

  guix install r r-seurat r-cistopic r-monocle3 r-cicero-monocle3 r-assertthat

goes from 5.7M to 176K.  Likewise, on this profile, wall-clock time of:

  GUIX_PROFILING=gc guix package -I

goes from 0.7s to 0.1s, with heap usage going from 55M to 9M.

* guix/profiles.scm (manifest->gexp)[optional]: New procedure.
[entry->gexp]: Turn into a monadic procedure.  Return a 'repeated' sexp
if ENTRY was already visited before.
Adjust caller accordingly.  Bump manifest version.
(sexp->manifest)[sexp->manifest-entry]: Turn into a monadic procedure.
Add case for 'repeated' nodes.  Add each entry to the current state
vhash.
Add clause for version 4 manifests.
[sexp->manifest-entry/v3]: New procedure, with former
'sexp->manifest-entry' code.
* tests/profiles.scm ("deduplication of repeated entries"): New test.
* guix/build/profiles.scm (manifest-sexp->inputs+search-paths)[let-fields]:
New macro.
Use it.  Expect version 4.  Add clause for 'repeated' nodes.
2022-07-01 23:29:16 +02:00
Ludovic Courtès 9b8c442b25
tests: Augment profile collision test.
* tests/profiles.scm ("collision of propagated inputs"): Check the
parents of ENTRY1 and ENTRY2.
2022-07-01 23:29:16 +02:00
Ludovic Courtès 741895676b
tests: Add sanitizer test.
* tests/records.scm ("define-record-type* & sanitize without default
value"): New test.
2022-07-01 12:10:29 +02:00
Ludovic Courtès f99f00fc81
status: Relay "updating substitutes" messages.
Until now, those messages would be accumulated and displayed all at
once, when a '\n' was finally emitted by 'guix substitute'.  In the
meantime, clients would remain silent.

* guix/status.scm (bytevector-index): Change 'number' parameter to
'numbers' and adjust accordingly.
(build-event-output-port): Pass both #\newline and #\return to
'bytevector-index'.
* tests/status.scm ("build-output-port, daemon messages with LF"): New
test.
2022-06-26 23:19:14 +02:00
Ludovic Courtès c31605b582
status: Change tests from SRFI-11 to SRFI-71.
* tests/status.scm: Use SRFI-71 'let' instead of SRFI-11 'let-values'.
2022-06-26 23:19:13 +02:00
Ludovic Courtès fb7e6ccba7
services: configuration: Report the location of field type errors.
Previously field type errors would be reported in a non-standard way,
and without any source location information.  This fixes it.

* gnu/services/configuration.scm (configuration-field-error): Add a
'loc' parameter and honor it.  Use 'formatted-message' instead of plain
'format'.
(define-configuration-helper)[field-sanitizer]: New procedure.
Use it.  Use STEM as the identifier of the syntactic constructor of the
record type.  Add a 'sanitize' property to each field.  Remove now
useless STEM macro that would call 'validate-configuration'.
* gnu/services/mail.scm (serialize-listener-configuration): Adjust to
new 'configuration-field-error' prototype.
* tests/services/configuration.scm ("wrong type for a field"): New test.
* po/guix/POTFILES.in: Add gnu/services/configuration.scm.
2022-06-24 23:18:20 +02:00
Ludovic Courtès 2ccbf3a45c
style: Keep values next to their keyword.
This ensures we print '#:key value' rather than insert a newline
between '#:key' and 'value' as was the case before.

* guix/scripts/style.scm (pretty-print-with-comments)[print-sequence]:
When ITEM is a keyword, loop with FIRST? = true.
* tests/style.scm: Add test.
2022-06-22 23:42:30 +02:00
Fredrik Salomonsson c3afbd05bf
guix: emacs-utils: Add emacs-header-parse.
* guix/build/emacs-utils.scm (emacs-header-parse): New procedure.

* tests/build-emacs-utils.scm ("emacs-header-parse: fetch version",
  "emacs-header-parse: fetch keywords", "emacs-header-parse: fetch
  nonexistent author"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-17 23:39:32 +02:00
Fredrik Salomonsson f8275916fc
guix: emacs-utils: Add emacs-batch-script.
* guix/build/emacs-utils.scm (emacs-batch-script): New procedure.

* tests/build-emacs-utils.scm: New file.

* Makefile.am (TESTS): Add `tests/build-emacs-utils.scm'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-17 23:39:31 +02:00
Taiju HIGASHI c8803d89fe
ui: Improve pager selection logic when less is not installed.
* guix/ui.scm (find-available-pager): New procedure.
(call-with-paginated-output-port): Use it.
* guix/utils.scm (call-with-environment-variables): Allow clearing of
specified environment variables.
* tests/ui.scm (make-empty-file, assert-equals-find-available-pager):
New procedures.
("find-available-pager, GUIX_PAGER takes precedence")
("find-available-pager, PAGER takes precedence")
("find-available-pager, 'less' takes precedence")
("find-available-pager, 'more' takes precedence")
("find-available-pager, no pager"): New tests.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16 23:57:41 +02:00
Ludovic Courtès 925a57c5d0
shell: Fix '--export-manifest' for cached profiles and when '-p' is used.
Fixes <https://issues.guix.gnu.org/55521>.

* guix/scripts/shell.scm (export-manifest): When computing 'manifest',
honor the 'profile key.
* tests/guix-shell-export-manifest.sh: Add test.
2022-06-16 23:57:40 +02:00