Commit Graph

6420 Commits

Author SHA1 Message Date
Ludovic Courtès 54237556ba
ui: 'package->recutils' can split the "system:" line.
Previously, long system lines would not be split, which would confuse
'less', possibly leading it to hide the first line of the package
recutils record (the "name:" line).

* guix/ui.scm (package->recutils)[split-lines]: New procedure.
[dependencies->recutils]: Use it.
Use it for the "systems:" value.
2022-01-11 20:35:00 +01:00
Ludovic Courtès 0552dcb294
shell: Cache profiles even when using package specs.
This enables profile caching not just when '-m' or '-f' is used, but
also when package specs are passed on the command line, as in:

  guix shell -D guix git

It also changes profile cache keys to include the system type, which was
previously ignored.

* guix/scripts/shell.scm (options-with-caching)[single-file-for-caching]:
Remove.
Call 'profile-cached-gc-root' instead; adjust to accept two values.
(profile-cache-primary-key): New procedure.
(profile-cache-key): Remove.
(profile-file-cache-key, profile-spec-cache-key): New procedures.
(profile-cached-gc-root): Rewrite to include functionality formally in
'single-file-for-caching', but extend to handle package specs.
* gnu/packages.scm (cache-is-authoritative?): Export.
* guix/transformations.scm (transformation-option-key?): New procedure.
* doc/guix.texi (Invoking guix shell): Move '--rebuild-cache'
documentation to the bottom, just above '--root'.  Explain caching and
how these two options relate to that.
2022-01-11 20:34:59 +01:00
Ludovic Courtès 6128c27478
build-system: Pass #:make-dynamic-linker-cache? #f when cross-compiling.
Fixes <https://issues.guix.gnu.org/52898>.
Reported by Maxime Devos <maximedevos@telenet.be>.

This is a followup to 1209447ad3.

* guix/build-system/cmake.scm (cmake-cross-build)[builder]: Pass
  #:make-dynamic-linker-cache? #f.
* guix/build-system/go.scm (go-cross-build)[builder]: Ditto.
* guix/build-system/guile.scm (guile-cross-build)[builder]: Ditto.
* guix/build-system/qt.scm (qt-cross-build)[builder]: Ditto.
2022-01-11 20:34:59 +01:00
Ludovic Courtès c1aa0ee9bd
guix hash: Allow '-r' as a non-deprecated alias.
This is a followup to 05c962594c.

Discussed at <https://issues.guix.gnu.org/51307#24>.

* guix/scripts/hash.scm (%options): Warn about deprecation for
"--recursive", but not for '-r' as it's a convenient shorthand.  Mention
'--serializer=nar' in the deprecation message.
* doc/guix.texi (Invoking guix hash): Adjust accordingly.
2022-01-10 19:31:02 +01:00
Ludovic Courtès 5d9a5e2301
style: '-S format' canonicalizes comments.
* guix/scripts/style.scm (canonicalize-comment): New procedure.
(pretty-print-with-comments): Add #:format-comment. and honor it.
(object->string*): Add 'args' and honor them.
(format-package-definition): Pass #:format-comment to
'object->string*'.
* tests/style.scm ("pretty-print-with-comments, canonicalize-comment"):
New test.
2022-01-10 14:59:26 +01:00
Ludovic Courtès c4fe13c294
style: Add '--styling' option.
* guix/scripts/style.scm (format-package-definition): New procedure.
(%options, show-help): Add "--styling".
(%default-options): Add 'styling-procedure'.
(guix-style): Honor it.
* tests/style.scm (with-test-package)
("input labels, 'safe' policy")
("input labels, 'safe' policy, nothing changed")
("input labels, margin comment")
("input labels, margin comment on long list")
("input labels, line comment")
("input labels, modify-inputs and margin comment"): Pass "-S inputs".
* etc/indent-code.el: Remove.
* doc/contributing.texi (Formatting Code): Mention "guix style" instead
of "etc/indent-code.el".
(Submitting Patches): Add item for "guix style".
* doc/guix.texi (Invoking guix style): Document "-S" and update.
2022-01-10 14:59:26 +01:00
Ludovic Courtès 6f892630ae
style: Add support for "newline forms".
This allows us to express cases where a newline should be inserted
immediately after the head symbol of a list.

* guix/scripts/style.scm (%newline-forms): New variable.
(newline-form?): New procedure.
(pretty-print-with-comments): Handle "newline forms".
* tests/style.scm: Add test.
2022-01-10 14:59:18 +01:00
Ludovic Courtès 208a7aa17b
style: Allow special forms to be scoped.
* guix/scripts/style.scm (vhashq): Add clause for 'lst, and change
default clause.
(%special-forms): Add context for 'add-after and 'add-before.  Add
'replace.
(prefix?, special-form-lead): New procedures.
(special-form?): Remove.
(pretty-print-with-comments): Add 'context' to the threaded state.
Adjust 'print-sequence' and adjust 'loop' calls accordingly.
* tests/style.scm: Add tests for 'replace.
2022-01-10 14:25:59 +01:00
Ludovic Courtès 97d0055edb
style: Improve pretty printer and add tests.
* guix/scripts/style.scm (vhashq): New macro.
(%special-forms): New variable.
(special-form?): New procedure.
(pretty-print-with-comments): Add many clauses and tweak existing
rules.
* tests/style.scm (test-pretty-print): New macro.
<top level>: Add 'test-pretty-print' tests.
2022-01-10 14:25:59 +01:00
zimoun a2010ac21b
build: julia-build-system: Create 'Project.toml' file when missing.
* guix/build/julia-build-system.scm (link-depot): Create 'Project.toml' file
when missing using data provided by the user.
(julia-create-package-toml): Remove from export.
* doc/guix.texi (Build Systems): Update julia-build-system section.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2022-01-10 15:15:31 +02:00
Ricardo Wurmus d118b3a5a6
import: texlive: Update error message.
We aren't downloading anything.

* guix/scripts/import/texlive.scm (guix-import-texlive): Update error message.
2022-01-10 12:47:01 +01:00
Ricardo Wurmus 18bd4d12d7
import: texlive: Remove more specific entries with the same prefix.
* guix/import/texlive.scm (files->directories): Ensure that any more specific
directory is removed if a parent directory is in the list of provided
locations.
2022-01-10 12:46:47 +01:00
Ludovic Courtès c1db66fa0a
import: go: Correctly report diagnostics upon version mismatch.
* guix/import/go.scm (strip-v-prefix, ensure-v-prefix)
(validate-version): New procedures.
(go-module->guix-package): Use 'validate-version' when defining
'version*'.  Remove 'else' clause in SRFI-34 guard.
2022-01-09 23:17:17 +01:00
Ludovic Courtès d1e3c96759
scripts: import: go: Wrap body in 'with-error-handling'.
This ensures proper error reporting and an exception reaches the top
level.

* guix/scripts/import/go.scm (guix-import-go): Wrap body in
'with-error-handling'.
2022-01-09 23:17:17 +01:00
Philip McGrath a62e6e3220
guix: node-build-system: Add 'delete-dependencies' helper function.
Many node packages currently skip the configure phase, because they lack
both dependencies and a convenient way to build without all of them, e.g.
for the purposes of bootstrapping.  This patch adds a big hammer to flatten
these nails.

* guix/build/node-build-system.scm (delete-dependencies): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2022-01-09 02:07:12 +01:00
Philip McGrath df7d787ba4
guix: node-build-system: Add avoid-node-gyp-rebuild phase.
Packages with native addons currently try to write to store paths
when used as dependecies.  This patch adds a phase to replace that
behaviour with a no-op.

* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New
variable.
(%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2022-01-09 02:07:11 +01:00
Philip McGrath 2ef3fe9f35
guix: node-build-system: Add JSON utilities.
This commit adds several utility functions for non-destructive
transformation of the JSON representation used by (guix build json),
particularly for purely functional update of JSON objects.  They ought
to eventually be exported from their own module, but for now are kept
private to allow experimentation.

* guix/build/node-build-system.scm (assoc-ref*, jsobject-ref, alist-pop)
(alist-update, jsobject-update*, jsobject-union): New variables.
(with-atomic-json-file-replacement): New public variable.
(module-name, build, patch-dependencies): Use them.  Do not resort to
unsafe alist primitives from Guile core.

Co-authored-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2022-01-09 02:07:11 +01:00
Philip McGrath 75416be16b
guix: node-build-system: Add implicit libuv input.
* guix/build-system/node.scm (lower): Add the version of libuv
used as an input to the #:node package as an additional implicit
input, so that packages needing libuv always get the correct version.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2022-01-09 02:07:11 +01:00
Philip McGrath 5add4af6fc
guix: node-build-system: Add delete-lockfiles phase.
Guix does not use any of these lock files to determine the package versions
used during the build, so they only serve to cause problems.

* guix/build/node-build-system.scm (delete-lockfiles): New variable.
(%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2022-01-09 02:07:10 +01:00
Ludovic Courtès a9268216e4
guix home, system: Use 'leave' to report missing generations.
Fixes <https://issues.guix.gnu.org/50982>.
Reported by Xinglu Chen <public@yoctocell.xyz>.

Fixes a typo ('error' instead of 'leave') introduced in
158032bd7d and copied in
89e05a6955.

* guix/scripts/system.scm (process-command): Use 'leave', not 'error'.
* guix/scripts/home.scm (process-command): Likewise.
2022-01-06 16:27:30 +01:00
Sarah Morgensen 9f526f5dad
upstream: Support updating and fetching 'git-fetch' origins.
Updaters need to be modified to return 'git-reference' objects.
This patch modifies the 'generic-git' and 'minetest' updater,
but others might need to be modified as well.

* guix/git.scm (git-reference->git-checkout): New procedure.
* guix/upstream.scm (package-update/git-fetch): New procedure.
  (<upstream-source>)[urls]: Document it can be a 'git-reference'.
  (%method-updates): Add 'git-fetch' mapping.
  (update-package-source): Support 'git-reference' sources.
  (upstream-source-compiler/url-fetch): Split off from ...
  (upstream-source-compiler): ... this, and call ...
  (upstream-source-compiler/git-fetch): ... this new procedure if the URL
  field contains a 'git-reference'.
* guix/import/git.scm
  (latest-git-tag-version): Always return two values and document that the tag
  is returned as well.
  (latest-git-release)[urls]: Use the 'git-reference' instead of the
  repository URL.
* guix/import/minetest.scm (latest-minetest-release)[urls]: Don't wrap the
  'git-reference' in a list.
* tests/minetest.scm (upstream-source->sexp): Adjust to new convention.

Co-authored-by: Maxime Devos <maximedevos@telenet.be>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-06 16:27:30 +01:00
Sarah Morgensen 1c32b4c965
refresh: Support non-tarball sources.
* guix/scripts/refresh.scm (update-package): Use 'file-hash*' instead of
'port-sha256'.  Rename TARBALL to OUTPUT.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-06 16:27:30 +01:00
Sarah Morgensen b4c677c2ed
import: Factorize file hashing.
* guix/import/cran.scm (vcs-file?, file-hash): Remove procedures.
  (description->package): Use 'file-hash*' instead.
* guix/import/elpa.scm (vcs-file?, file-hash): Remove procedures.
  (git-repository->origin, elpa-package->sexp): Use 'file-hash* instead'.
* guix/import/go.scm (vcs-file?, file-hash): Remove procedures.
  (git-checkout-hash): Use 'file-hash*' instead.
* guix/import/minetest.scm (file-hash): Remove procedure.
  (make-minetest-sexp): Use 'file-hash*' instead.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-06 16:27:30 +01:00
Sarah Morgensen 064c367716
guix hash: Extract file hashing procedures.
* guix/scripts/hash.scm (guix-hash)[vcs-file?] (nar-hash, default-hash):
  Extract hashing logic to...
* guix/hash.scm (vcs-file?, file-hash*): ... these new procedures in this
  new file.

Modified-by: Maxime Devos <maximedevos@telenet.be>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-06 16:27:30 +01:00
Xinglu Chen 82eb05c398
import: elpa: Also check NonGNU ELPA for updates.
* guix/import/elpa.scm (latest-release): Determine the repository based
on the URL of the source.
(package-from-gnu.org?): Rename to ...
(elpa-repository): ...this; memoize.
(package-from-elpa-repository?): New procedure.
(%elpa-updater): Adjust accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-05 23:44:18 +01:00
Arjan Adriaanse d7fb57bcd5
home: import: Fix handling of manifest entries with specific output.
specification->package fails on manifest entries with specific outputs,
resulting in an invalid home configuration.  This changes the import command
to use specification->package+output instead.

* guix/scripts/home/import.scm (manifest+configuration-files->code): Make sure
manifest entries with specific output are also handled.
* tests/home-import.scm: Specify output in home environment manifest entry.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-05 23:44:18 +01:00
Ryan Sundberg bfdeba11f8
linux-container: Handle CLONE_NEWCGROUP and use it by default.
Adds low-level support for launching Linux containers with cgroup namespaces.

* gnu/build/linux-container.scm (%namespaces): Add 'cgroup.
(namespaces->bit-mask): Handle it.
* guix/build/syscalls.scm (CLONE_NEWCGROUP): New variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-05 23:44:18 +01:00
Ricardo Wurmus e86afe58ff
guix/upstream: Let changed-inputs support the new input lists.
* guix/upstream.scm (changed-inputs): Add match clauses for new-style input
lists.
2022-01-05 21:17:58 +01:00
zimoun 8646f1f7a5
guix hash: Allow '--exclude-vcs' option using 'git' serializer.
* guix/scripts/hash.scm (git-hash): Use '#:select?' with
'git-hash-directory'.
* tests/guix-hash.sh: Adjust accordingly.

Signed-off-by: Timothy Sample <samplet@ngyro.com>
2022-01-04 20:37:29 -05:00
Ludovic Courtès 861bac1dfb
offload: Do not read ~/.ssh/config.
Fixes <https://issues.guix.gnu.org/39366>.
Reported by zimoun <zimon.toutoune@gmail.com>.

* guix/scripts/offload.scm (open-ssh-session): Pass #:config.
2022-01-03 19:32:08 +01:00
Ludovic Courtès d090e9c37d
transformations: Add '--tune'.
* guix/transformations.scm (tuning-compiler)
(tuned-package, tunable-package?, package-tuning)
(transform-package-tuning)
(build-system-with-tuning-compiler): New procedures.
(%transformations): Add 'tune'.
(%transformation-options): Add "--tune".
* tests/transformations.scm ("options->transformation, tune")
("options->transformations, tune, wrong micro-architecture"): New
tests.
* doc/guix.texi (Package Transformation Options): Document '--tune'.
2022-01-01 15:23:24 +01:00
Ludovic Courtès a644f88d28
Add (guix cpu).
* guix/cpu.scm: New file.
* Makefile.am (MODULES): Add it.
2022-01-01 15:23:24 +01:00
Leo Famulari 806a4e986d
ui: It's 2022!
Happy new year!

* guix/ui.scm (show-version-and-exit): Change the year to 2022.
2022-01-01 02:02:44 -05:00
Tobias Geerinckx-Rice ea2fd313d5
utils: Fix URL in comment.
* guix/utils.scm (target-x86-32?): Fix Wikipedia URL.
2021-12-30 13:41:27 +01:00
Tobias Geerinckx-Rice ae39d76e97
substitute: Document the limited UI.
* guix/scripts/substitute.scm (show-help): Accept exactly one OPTION.
2021-12-29 01:43:24 +01:00
Brice Waegeneire b891f8519d
channels: Add 'branch' to 'channel->code' output.
* guix/channels.scm (channel->code): Add 'branch' to output.
2021-12-25 19:12:37 +01:00
Sarah Morgensen d6121d7dd6
build-system/go: Add pre-built standard library as implicit input.
* gnu/packages/golang.scm (make-go-std): New procedure.
* guix/build-system/go.scm (make-go-std): New procedure.
(lower): Use it.  Add pre-built standard library to inputs.

Signed-off-by: Leo Famulari <leo@famulari.name>
2021-12-24 16:32:25 -05:00
Sarah Morgensen c90f73f816
build-system/go: Initialize build cache from input packages.
* guix/build/go-build-system.com (setup-go-environment): Set GOCACHE to
a location within the build directory.  Union "/var/cache/go/build"
input directories to initialize the cache.  Generate "trim.txt" within
the cache, with the current time.

Signed-off-by: Leo Famulari <leo@famulari.name>
2021-12-24 16:32:25 -05:00
Sarah Morgensen d0050ea8ad
build-system/go: Add #:substitutable? argument.
* guix/build-system/go.scm (go-build): Add 'substitutable?' argument.
(go-cross-build): Likewise.

Signed-off-by: Leo Famulari <leo@famulari.name>
2021-12-24 16:32:21 -05:00
Leo Famulari ba744faeb1
tests: git: Avoid ambiguous module import.
Fixes this warning:

WARNING: (guix tests git): `reset' imported from both (git) and (ice-9 control)

This is a followup to commit 07145c8a8c.

* guix/tests/git.scm: Only import LET/EC from (ice-9 control).
2021-12-23 18:49:05 -05:00
Attila Lendvai 037c2b6d3a
tests: gnupg: Factor out and export KEY-FINGERPRINT-VECTOR.
* guix/tests/gnupg.scm (key-fingerprint-vector): New procedure.  Export it.
(key-fingerprint): Use it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-12-23 17:31:51 +01:00
Attila Lendvai 07145c8a8c
tests: Smarten up git repository testing framework.
* guix/tests/git.scm (with-git-repository): New macro, exported.  It can be used
repeatedly inside a WITH-TEMPORARY-GIT-REPOSITORY.
(populate-git-repository): Extend the DSL with (ADD "some-noise"), (RESET
"[commit hash]"), (CHECKOUT "branch" ORPHAN).

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-12-23 17:31:44 +01:00
Timothy Sample 05b1f024be
self: Add guile-lzma as a dependency.
This is a follow-up to 35ce3e5de6, fixing
Disarchive recovery when the download script is run from a 'guix pull'
profile.

* guix/self.scm (specification->package): Add "guile-lzma".
(compiled-guix): Add GUILE-LZMA to DEPENDENCIES in
the #:dependencies argument to 'guix-command'.
2021-12-23 08:59:44 -05:00
Mathieu Othacehe c717f27c5f
scripts: system: Add a missing module.
* guix/scripts/system.scm: Add a missing module.
2021-12-23 10:54:01 +01:00
Mathieu Othacehe bce55cec88
scripts: system: Use the disk-image size argument for VM generation.
* guix/scripts/system.scm (system-derivation-for-action): Use the given
image-size unconditionnaly when calling system-qemu-image/shared-store-script.
2021-12-23 10:54:00 +01:00
Mathieu Othacehe c37cd41764
scripts: system: Pass the volatile field to VM generation.
* guix/scripts/system.scm (system-derivation-for-action): Add new volatile?
argument and pass it to system-qemu-image/shared-store-script.
(perform-action): Add new volatile? argument and pass it to
system-derivation-for-action.
(process-action): Pass the volatile? argument to perform-action.
2021-12-23 10:54:00 +01:00
Mathieu Othacehe 3ed8ddd606
scripts: system: Deprecate the docker-image command.
* guix/scripts/system.scm (system-derivation-for-action): Use the image API to
generate the docker images and deprecate the docker-image command.
(process-action): Ditto.
* doc/guix.texi (Invoking guix system): Adapt it.
2021-12-23 10:54:00 +01:00
Ludovic Courtès e89f767ce8
packages: Avoid #:re-export-and-replace to allow upgrades from 1.2.0.
Fixes <https://issues.guix.gnu.org/52694>.
Reported by Carl Dong <contact@carldong.me>.

Use of #:re-export-and-replace would prevent upgrades from 1.2.0, whose
'source-module-closure' procedure did not recognize #:re-export-and-replace.

* guix/packages.scm: Remove #:re-export-and-replace and add top-level
call to 'module-re-export!'
2021-12-22 23:23:16 +01:00
Attila Lendvai 9ebc9ca070
tests: Move keys into ./tests/keys/ and add a third ed25519 key.
The third key will be used in an upcoming commit.

Rename public keys to .pub.

* guix/tests/gnupg.scm (%ed25519-3-public-key-file): New variable.
(%ed25519-3-secret-key-file): New variable.
(%ed25519-2-public-key-file): Renamed from %ed25519bis-public-key-file.
(%ed25519-2-secret-key-file): Renamed from %ed25519bis-secret-key-file.
* tests/keys/ed25519-3.key: New file.
* tests/keys/ed25519-3.sec: New file.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-12-22 10:53:19 +01:00
Ludovic Courtès ddf9345dfe
combinators: Add 'define-compile-time-procedure'.
* guix/combinators.scm (procedure-call-location): New syntax parameter.
(define-compile-time-procedure): New macro.
2021-12-20 16:21:40 +01:00