Commit graph

8230 commits

Author SHA1 Message Date
Maxim Cournoyer
51c5e59ef8
build-system/meson: Make build verbose.
It's useful to see the link directives and other options passed to the
compiler when debugging build issues.

* guix/build/meson-build-system.scm (build): Invoke ninja with its --verbose
option.

Change-Id: Iab11eeb29351a1d6a954576e3a916e2d536058d9
(cherry picked from commit d9b9670b05)
2025-09-30 09:29:53 +09:00
Dariqq
fb091cf948
build-system: meson: Set default wrap-mode to nofallback.
Fixes guix/guix#1162.

This solves two issues: Not having to wait for the network timeout (same as the
nodownload) option and also disabling meson to fall back to predownloaded
subprojects.

If desired, this behaviour can be overridden by adding --wrap-mode=MODE to #:configure-flags.

* guix/build/meson-build-system.scm (configure): Add --wrap-mode=nofallback.

Change-Id: Ibf1d6ac60a4c47cd71574a96ceb8773e6d8cf60b
(cherry picked from commit fe8dded27f)
2025-09-30 09:29:53 +09:00
Giacomo Leidi
40c2edf91b
build-system: mix: Allow passing test flags.
* guix/build-system/mix.scm (mix-build): Add test-flags keyword
argument and pass it on.
* guix/build/mix-build-system.scm (check): Add test-flags keyword
argument and pass it to Mix.

Change-Id: Ib8243aaaf7a7d02df993cee44f33b36566049e83
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-25 22:04:26 +02:00
Simon Tournier
6e12325bf3
git: Fix update cached checkout when not a symref.
Follow up of 66463356ce.

* guix/git.scm (update-cached-checkout)[symref?]: New procedure.
[ref->refspecs]: New procedure.
Use them.

Change-Id: Ia2cb7db45222d59d61a2349bec277fd06456844b
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Modified-by: Ludovic Courtès <ludo@gnu.org>
2025-09-25 22:04:25 +02:00
Nicolas Graves
2d45de1bc4
build-system/pyproject: Handle wheel not found exception.
The current error is very uninformative, use a proper exception to
give more information when this happens:
`In procedure map: Wrong type argument: #f`

After this patch:
`In procedure raise-exception:
ERROR:
  1. &no-wheels-found`

* guix/build/pyproject-build-system.scm (&no-wheels-found): Add exception.
(install): Handle exception.

Change-Id: Ie72d3b50dfededb2d598162672cdb4321c42b632
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
2025-09-25 09:35:34 +01:00
Nicolas Graves
977caf32ef
build-system/pyproject: Avoid PEP427 substitution on binary files.
In some rare cases, the dest-path can be an elf-file, which are
unreadable by substitute*, leading to an error instead of just
continuing which makes more sense in this case.

* guix/build-system/pyproject.scm (check): Guard substitution attempt
with basic readability guarantees.

Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
2025-09-25 09:35:34 +01:00
Nicolas Graves
9a40c5145d
build-system/pyproject: Add stestr, unittest and custom options.
* guix/build-system/pyproject.scm (check): Add stestr, unittest and
custom test-backends.

Change-Id: I2d44b3b8dd928ab844b4479fb073afff845e13ee
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
2025-09-25 09:35:34 +01:00
Nicolas Graves
74a1e9d543
build-system/pyproject: Use copy-recursively instead of merge-dirs.
Using rename-file, the destination had to be empty otherwise it would error
out.  This has been fixed by the use of copy-recursively, really merging them.
Changing this makes merge-directories mostly a duplicate of
copy-recursively, thus fully switch to copy-recursively.

* guix/build/pyproject-build-system.scm (install)
<python-hashbang>: Remove it, used only once.
<merge-directories>: Remove it, replace its calls by copy-recursively
and delete-file-recursively.

Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
2025-09-25 09:35:34 +01:00
Nicolas Graves
e927a071cd
build-system/pyproject: Add python test-backend.
* guix/build/pyproject-build-system(check): Add python test-backend.

This will help in cases where a simple `python -m module args` call has
to be made instead of fully replacing the 'check phase, e.g. unittest
or django. This is never enabled unless #:test-backend 'python is set,
so it doesn't break anything.

As an example, the following snippet...

(arguments
  (list #:phases #~(modify-phases %standard-phases
                     (replace 'check
                       (lambda* (#:key tests? #:allow-other-keys)
                         (when tests?
                           (invoke "python" "-m" "unittest"
                                   "diff_match_patch.tests")))))))

...can be transformed like this:

(arguments
  '(#:test-backend 'python
    #:test-flags (list "-m" "unittest" "diff_match_patch.tests")))

Change-Id: I4919a3e01d64864e3c328609fbcce7df5b3dfe51
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
2025-09-25 09:35:33 +01:00
Maxim Cournoyer
7b65bc85cd
build/pyproject: Fix indentation.
* guix/build/pyproject-build-system.scm: Re-indent file with Emacs.

Change-Id: Ie8a119ce9cf4beccffde93674adb98dc07462ea7
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
2025-09-25 09:35:33 +01:00
Maxim Cournoyer
f3f42af8ae
build/pyproject: Resolve import warning.
* guix/build/pyproject-build-system.scm: Hide the 'delete' symbol from
the imported (guix build utils) module to avoid a naming clash warning.

Change-Id: I48f97bf29b5282de1440c68d533c8300d4d11362
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
2025-09-25 09:35:33 +01:00
Maxim Cournoyer
1d0493e58d
build/pyproject: Update PEP 427 reference URL in comment.
* guix/build/pyproject-build-system.scm (install): Update reference URL.

Change-Id: Icf5dcc7254c33e8e466773ee66a2fd5648d583da
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
2025-09-25 09:35:33 +01:00
Maxim Cournoyer
beb6357463
build/pyproject: Really merge directories in install phase.
Using rename-file, the destination had to be empty otherwise it would
error out.  By using copy-recursively, a directory can be copied onto a
pre-existing directory, really merging them.  This problem manifested
itself attempting to build the python-pyre package.

Solving #596.

* guix/build/pyproject-build-system.scm (install)
<merge-directories>: Use copy-recursively instead of rename-file.

Change-Id: Iceb8609a86f29b17e5fbe6a9629339d0bc26e11f
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
2025-09-25 09:35:33 +01:00
Nicolas Graves
c0ff1be86c
import: utils: Add default-git-error.
* guix/import/utils.scm (default-git-error): Add procedure.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2025-09-24 19:16:53 +02:00
Nicolas Graves via Guix-patches via
bd2470ca4d
import: utils: Add function git->origin.
* guix/import/utils.scm: (git-origin, git->origin): Add procedures.

* guix/import/elpa.scm
(download-git-repository): Remove function download-git-repository.
(git-repository->origin): Remove function git-repository->origin.
(ref): Add function ref.
(melpa-recipe->origin): Use functions git->origin and ref.

* guix/import/go.scm
(git-checkout-hash): Remove function git-checkout-hash.
(transform-version): Add function transform-version.
(vcs->origin): Use functions git->origin and transform-version. Add
optional argument transform-version.

* tests/import/go.scm
(go-module->guix-package): Adapt test case to changes in guix/import/go.scm.

* guix/import/luanti.scm
(download-git-repository): Remove function download-git-repository.
(make-luanti-sexp): Use function git->origin.

* tests/luanti.scm
(make-package-sexp): Refresh function accordingly.

* guix/import/composer.scm
(make-php-sexp): Use function git->origin.

Change-Id: Ied05a63bdd60fbafe26fbbb4e115ff6f0bb9db3c
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2025-09-24 19:16:53 +02:00
Nicolas Graves
68c4eab949
import: utils: Add API to peek procedure bodies.
* guix/import/utils.scm (peekable-lambda, peek-body): Add procedures.
* .dir-locals.el: Add peekable-lambda indentation.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2025-09-24 19:16:51 +02:00
Rutherther
7d1d1d1f7c
guix: update-cached-checkout: Fix fetching remote for branches, commits and tags.
Follow up of 66463356ce.

Because of the mentioned change, update-cached-checkout doesn't
update the checkout for branches, commits or tags.

This means `guix pull` with %default-channels no longer pulls
newer versions. `forward-update-check` no longer fetches the
commit to check relations for, leading to an error that
reference is not available.

* guix/git.scm (update-cached-checkout): Fetch remote even if symref-list is
empty.

Change-Id: Ia6bb1c669065cf19a6dd16c2a403e8590bc07613
2025-09-23 13:20:31 -07:00
Yelninei
d9e2ee3e99
packages: Add x86_64-gnu to %cuirass-supported-systems.
* guix/packages.scm (%cuirass-supported-systems): Add x86_64-gnu.

Change-Id: I5aa8bcc511d3e12364a35ce8dac35965e0d9709b
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-23 11:13:22 +02:00
Ludovic Courtès
d12c4452a4
shell, inferior: Store GC roots under /var/guix/profiles.
Fixes guix/guix#2410.

Until now, ‘guix shell’ and ‘guix time-machine’ would store GC roots under
~/.cache/guix.  However, this directory is unreadable to guix-daemon when it’s
running without root privileges.  This commit changes ‘guix shell’ and ‘guix
time-machine’ so they store GC roots under /var/guix/profiles/per-user/$USER,
in a world-readable directory.

An added benefit is that, in cluster setups, user homes no longer need to be
mounted on the head node for GC to work (assuming ‘guix build -r’ and similar
are not used).

* guix/inferior.scm (%inferior-cache-directory): Change default value to be
under ‘%profile-directory’.
(%legacy-inferior-cache-directory): New variable.
(cached-channel-instance): Add ‘maybe-remove-expired-cache-entries’ call.
* guix/scripts/environment.scm (launch-environment/container)[nesting-mappings]:
Add /inferiors and /profiles sub-directories of ‘%profile-directory’.  Call
‘mkdir-p’ for these two directories.
* guix/scripts/shell.scm (%profile-cache-directory): Change default value to
be under ‘%profile-directory’.
(%legacy-cache-directory): New variable.
(guix-shell): Add call to ‘maybe-remove-expired-cache-entries’.

Change-Id: Ie7d6c16a55b35c7beb18078c967d6fc902bf68d0
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-23 11:13:22 +02:00
Romain GARBAGE
66463356ce
git: Create/update remote references locally when needed.
This allows ‘update-cached-checkout’ to fetch symbolic references such as
those created by the AGit workflow with Forgejo instances.

* guix/git.scm (update-cached-checkout): Create/update remote references
locally.

Change-Id: Ice761d09eebc4f1275381a4eefbdd679d9b95127
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-23 11:13:22 +02:00
Romain GARBAGE
0a670987c7
inferior: Use channel-reference to get a Git reference.
* guix/inferior.scm (channel-full-commit): Use channel-reference to get a Git reference.

Change-Id: Ia07f8d202ba1df1497d2763d8d49d547c6955ca6
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-23 11:13:22 +02:00
Romain GARBAGE
b6a739465d
channels: Export channel-reference.
* guix/channels.scm: Export channel-reference.

Change-Id: I3da7b8d55c0ab563c1669c9e346bb3bd34e7f1db
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-23 11:13:22 +02:00
Ludovic Courtès
e1cf791ddd
Revert "publish: Prevent publication of non-substitutable derivation outputs."
Fixes guix/guix#2450.

This reverts commit b5745a327e, which introduced
discrepancies in how substitutes are served; in particular, narinfos of
non-substitutable items would still be served, and likewise for narinfos and
nars of dependents of non-substitutable items.
2025-09-21 18:47:23 +02:00
Ludovic Courtès
7445776b7e
gc: Open a connection to the daemon only when strictly necessary.
Fixes guix/guix#1901.

Previously, ‘guix gc --list-busy’ (which is invoked by ‘guix-daemon’) would
open a connection to the daemon, which in turn attempts to create
/var/guix/profiles/per-user/$USER.  However, when ‘guix-daemon‘ is running as
an unprivileged user, creating that directory fails with EPERM.  Because of
this, garbage collection would always fail when running the unprivileged
daemon on Guix System.

* guix/scripts/gc.scm (guix-gc): Remove upfront call to ‘open-connection’.
Instead, use ‘with-store’ only for operations that require it.

Change-Id: I1fbfd97cf7ba9e3087f7287b4776ea2f6623400d
2025-09-18 12:14:34 +02:00
Maxim Cournoyer
10482f731e
Reapply "Update Maxim's email address."
This reverts commit a7db92d9b3, this time with
the more careful command, to avoid a world rebuild:

grep -rl --exclude-dir=build --exclude-dir=patches --exclude=ld-wrapper.in \
  --exclude=sitecustomize.py --exclude=guix-emacs.el maxim.cournoyer@gmail.com |
  xargs sed -i 's/maxim.cournoyer@gmail.com/maxim@guixotic.coop/g'

Change-Id: I0871f5cf9ace79e34e78e24154d0da6ea95a3a91
2025-09-18 13:44:12 +09:00
Maxim Cournoyer
a7db92d9b3
Revert "Update Maxim's email address."
This reverts commit d0d87a744d. Oops! This
caused a world rebuild.

Change-Id: I25fff644b2b61d0ee93d69b457b04c72b5b74d15
2025-09-18 12:07:31 +09:00
Maxim Cournoyer
d0d87a744d
Update Maxim's email address.
The change was automated via:

  git grep -l maxim.cournoyer@gmail.com |
    xargs sed -i 's/maxim.cournoyer@gmail.com/maxim@guixotic.coop/g'

* .mailmap: New entry.

Change-Id: Iaa88b1e51c94159c49138fb43910badb990eb169
2025-09-18 08:05:19 +09:00
Ludovic Courtès
75e45d4eea
home: Adjust file system mount options.
* guix/scripts/home.scm (spawn-home-container): Add ‘options’ field to
the /run/user/$UID and ‘home-directory’ file systems.

Change-Id: Ic6d987fe186f9c49718f15c71867953a20f2fb68
2025-09-17 11:55:14 +02:00
Ludovic Courtès
c52a9cee53
linux-container: Export ‘%writable-/tmp’ and use it.
Fixes guix/guix#1994.

* gnu/build/linux-container.scm (%writable-/tmp): New variable.
* guix/scripts/environment.scm (launch-environment/container): Remove ‘tmpfs’
and use it.  Adjust ‘file-system’ declaration for /run/user/$UID.
* guix/scripts/home.scm (spawn-home-container): Likewise.

Reported-by: Romain GARBAGE <romain.garbage@inria.fr>
Change-Id: Ia8289fb5386971738caf2ccc1e815daa6ac28459
2025-09-17 11:55:13 +02:00
Ludovic Courtès
a5ac56f883
packages: ‘package-field-location’ returns a <location> for atoms.
Fixes guix/guix#1975.

When using ‘read’, ‘package-field-location’ would not get source location for
atoms such as symbols, typically making it impossible to get the location of
the value of a field list (build-system gnu-build-system).  This fixes that.

* guix/packages.scm (field-value-location): New procedure.
(package-field-location): Use it instead of inline code.
* tests/packages.scm ("package-field-location"): Test the ‘build-system’
field.

Reported-by: Nicolas Graves <ngraves@ngraves.fr>
Change-Id: I98c694bb6f1999fa9ca80e145fa016640067af55
2025-09-11 22:27:47 +02:00
Liliana Marie Prikler
6c41e4d180
build: emacs-utils: Add emacs-makeinfo.
* guix/build/emacs-utils.scm (emacs-makeinfo): New variable.
* gnu/packages/emacs-xyz.scm (emacs-show-font, emacs-mct, emacs-corfu)
(emacs-cape, emacs-embark, emacs-orderless, emacs-consult, emacs-marginalia)
(emacs-logos, emacs-tmr, emacs-beframe, emacs-tempel, emacs-lin, emacs-pulsar)
(emacs-dired-preview, emacs-modus-themes, emacs-org-glossary, emacs-vertico)
(emacs-org-margin, emacs-osm)[#:phases]<makeinfo>: Use it.
Move before ‘install’ if it was previously after ‘install’.
2025-09-11 08:46:53 +02:00
Liliana Marie Prikler
2bd3129039
build-system: emacs: Use new lisp-mnt primitives.
* guix/build/emacs-build-system.scm (ensure-package-description)
[%write-pkg-file-form]: Use ‘lm-summary’ and ‘lm-package-requires’.

Fixes: guix/guix#736 (Missing `*-pkg.el` files).
2025-09-11 08:46:52 +02:00
Liliana Marie Prikler
8030c91dc2
build-system: emacs: Error if package file could not be generated.
* guix/build/emacs-build-system.scm (ensure-package-description)
[%write-pkg-file-form]: Use ‘error’ for error reporting.
2025-09-11 08:46:51 +02:00
Efraim Flashner
1d931e5778
guix: lint: Add codespell hints.
This hides these lines from codespell so it doesn't try to fix the
spelling of these intentional typos.

* guix/lint.scm (check-description-style)[check-description-typo]: Add
codespell hints to ignore some lines.

Change-Id: I002d2ba6079a5dcf9165d3821eda579f6dfa2ecf
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2025-09-08 10:03:38 +03:00
Nicolas Graves
4a33614dd9
build-system: Introduce @* macro for lazy module resolution.
* guix/build-system.scm (@*): New macro for runtime module resolution.
* guix/build-system/agda.scm (default-agda): Use @* instead of
resolve-interface and module-ref.
* guix/build-system/android-ndk.scm (default-android-build,
default-android-googletest): Likewise.
* guix/build-system/ant.scm (default-jdk, default-ant, default-zip):
Likewise.
* guix/build-system/cargo.scm (default-rust): Likewise.
* guix/build-system/chicken.scm (default-chicken): Likewise.
* guix/build-system/composer.scm (default-php,
default-composer-classloader): Likewise.
* guix/build-system/dub.scm (default-ldc, default-dub,
default-pkg-config, default-ld-gold-wrapper): Likewise.
* guix/build-system/elm.scm (default-elm, default-elm-core,
default-elm-json): Likewise.
* guix/build-system/emacs.scm (default-emacs): Likewise.
* guix/build-system/glib-or-gtk.scm (default-glib): Likewise.
* guix/build-system/go.scm (default-go, default-gccgo, make-go-std):
Likewise.
* guix/build-system/haskell.scm (default-haskell): Likewise.
* guix/build-system/julia.scm (default-julia): Likewise.
* guix/build-system/linux-module.scm (default-linux): Likewise.
* guix/build-system/luanti.scm (default-optipng, default-luanti,
default-luanti-game, default-xvfb-run): Likewise. Remove otherwise
unused individual plugin accessor functions.
* guix/build-system/maven.scm (default-maven, default-jdk,
default-maven-plugins): Likewise. Remove otherwise unused individual
plugin accessor functions.
* guix/build-system/meson.scm (default-ninja, default-meson):
Likewise.
* guix/build-system/minify.scm (default-esbuild): Use @* instead of
resolve-interface and module-ref.
* guix/build-system/mix.scm (default-elixir-hex,
default-rebar3, default-elixir): Likewise.
* guix/build-system/node.scm (default-node): Likewise.
* guix/build-system/ocaml.scm (default-ocaml, default-findlib,
default-dune-build-system, default-ocaml4.07,
default-ocaml4.07-findlib ,default-ocaml4.07-dune, default-ocaml4.09,
default-ocaml4.09-findlib, default-ocaml4.09-dune, default-ocaml5.0,
default-ocaml5.0-findlib, default-ocaml5.0-dune): Likewise.
* guix/build-system/perl.scm (default-perl): Likewise.
* guix/build-system/pyproject.scm (default-python): Likewise.
* guix/build-system/qt.scm (default-qtbase): Likewise.
* guix/build-system/r.scm (default-r): Likewise.
* guix/build-system/rakudo.scm (default-rakudo, default-prove6,
default-zef): Likewise.
* guix/build-system/rebar.scm (default-rebar3, default-erlang):
Likewise.
* guix/build-system/renpy.scm (default-renpy): Likewise.
* guix/build-system/ruby.scm (default-ruby): Likewise.
* guix/build-system/scons.scm (default-scons): Likewise.
* guix/build-system/texlive.scm (default-texlive-bin,
texlive-latex-bin): Likewise.
* guix/build-system/tree-sitter.scm (default-guile-json,
default-node, default-tree-sitter, default-tree-sitter-cli): Likewise.
* guix/build-system/vim.scm (default-vim, default-neovim): Likewise.
* guix/build-system/zig.scm (default-zig): Likewise.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-04 12:19:55 +02:00
Nicolas Graves
97f6cc4389
build-system: rakudo: Clarify private-keywords.
Some arguments used for lower but not for the builder were passed as
arguments to the builders.  Remove this ambiguity.

* guix/build-system/rakudo.scm (lower)[private-keywords]: Add keywords
  with-prove6? and with-zed?,...
  (rakudo-build): ... removed from here.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-04 12:19:55 +02:00
Nicolas Graves
fcdcfa149d
build-system: android-ndk: Improve lower configurability.
* guix/build-system/android-ndk.scm (default-android-build,
default-android-googletest): Add and export variables.
  (lower): Add their respective keywords.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-04 12:19:55 +02:00
Nicolas Graves
9073a7e410
build-system: tree-sitter: Improve lower configurability.
* guix/build-system/tree-sitter.scm (default-node,
default-tree-sitter, default-tree-sitter-cli): Add and export variables.
  (lower): Add their respective keywords.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-04 12:19:55 +02:00
Nicolas Graves
cf05f12cb7
build-system: copy: Remove dead glibc code.
An unused glibc package made its way into the copy-build-system.
It's confusing, so remove it.

* guix/build-system/copy.scm (default-glibc): Remove variable.
  (lower): Remove glibc keyword.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-04 12:19:55 +02:00
Nicolas Graves
571509d5fa
size: Improve error message.
Fixes guix/guix#2429

* guix/scripts/size.scm (file-size): Improve error message.

Change-Id: I0e0f6de1eded8a780d2edc07ce1fbc5c7ff73e25
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-04 12:19:53 +02:00
Brian Kubisiak
325689d036
build-system/tree-sitter: Build with -std=c11.
* guix/build/tree-sitter-build-system.scm (install): Switch to
building with -std=c11.

Fixes: guix/guix#2215
Change-Id: I04f3ede07aeaaa9cf95272611d6346295f603b69
Signed-off-by: Danny Milosavljevic <dannym@friendly-machines.com>
2025-09-04 02:27:57 +02:00
Ludovic Courtès
1c235670d8
tests: Reduce build timeout to 3 minutes for Scheme tests.
* guix/tests.scm (open-connection-for-tests): Reduce #:timeout to 3mn.
(call-with-external-store): Likewise.

Change-Id: I4375e070618a5f38a82a1d26f8424bf4abb607e6
2025-09-03 12:34:13 +02:00
Reepca Russelstein
9202921e81
perform-download: Use (ice-9 sandbox) for mirrors.
"guix perform-download" is used to implement the daemon's "download" and
"git-download" builtin builders.  Because these are builtins, it runs without
any additional isolation beyond merely running as a build user.  In such a
context, allowing arbitrary user-supplied code to be evaluated will easily
lead to the build user being taken over, which can then be used to corrupt
future builds, enable exploitation of certain vulnerabilities, and in the case
of the rootless daemon completely take over guix-daemon.

Use (ice-9 sandbox) to ensure that only safe bindings are available during the
evaluation of the content-addressed-mirrors file.

* guix/perform-download.scm (%safe-bindings, %sandbox-module): new variables.
  (syntax-noop): new syntax.
  (eval-content-addressed-mirrors, assert-store-file,
   call-with-input-file/no-symlinks): new procedures.
  (perform-download): use assert-store-file to ensure files are in the store
  before being read.  Use call-with-input-file/no-symlinks for opening
  untrusted files.  Use eval-content-addressed-mirrors to evaluate the
  content-addressed-mirrors file.

Change-Id: I8ed27a95d84dbcc7d72d0d75f172d113f8be6c79
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-01 16:13:29 +02:00
Reepca Russelstein
f607aaaaaa
download: Handle content-addressed-mirrors returning #f.
* guix/build/download.scm (url-fetch): don't pass the return value from a
  content-addressed-mirror procedure to 'string->uri' if it is #f.

Change-Id: Ic4f94f86fcfebe6f2e60cb3c4330ce57886ab647
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-01 16:13:19 +02:00
Reepca Russelstein
2a333541e8
perform-download: Ensure reading never evaluates code.
Since this is used to implement the "download" and "git-download" builtins,
which are run outside of any chroot, this is trusted code with respect to the
user-supplied strings it reads.

* guix/scripts/perform-download.scm (read/safe): new procedure.
  (perform-download, perform-git-download): use it.
  (guix-perform-download): explicitly set 'read-eval?' to #f and
  'read-hash-procedures' to '().  #f is the default value of 'read-eval?' on
  startup, but set it anyway to be certain.

Change-Id: I93cb8e32607a6f9a559a26c1cbd6b88212ead884
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-09-01 16:13:11 +02:00
Nicolas Graves
d431f4620a
cve: Upgrade to JSON 2.0 feeds.
Fixes guix/guix#2213.  The 1.1-formatted-data is no longer available
from NIST.

* guix/cve.scm (string->date*, <cve-item>,
reference-data->cve-configuration, cpe-match->cve-configuration,
configuration-data->cve-configurations, json->cve-items,
yearly-feed-uri, cve-item->vulnerability): Upgrade to JSON 2.0 feeds
schema.
(<cve>): Remove uneeded record.
* tests/cve-sample.json: Update them. Remove CVE-2019-0005 (no value
added, lots of lines).
* tests/cve.scm (%expected-vulnerabilities): Upgrade accordingly.
(json->cve-items, vulnerabilities->lookup-proc tests): Update accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-08-31 12:39:24 +02:00
Nicolas Graves
8f310b6f27
gnu: mercurial: Add package and rename former to mercurial/pinned.
Mercurial currently has CVEs. IMHO, it's unsafe to carry them around
in a profile.  However, updating mercurial potential leads to a lot of
rebuilds and I don't want to tackle this right now.

As for other packages, the way forward is to add a variant of the
package only used for hg-fetch, here mercurial/pinned.

* gnu/packages/version-control.scm
(mercurial-check-phase): Add helper variable.
(mercurial): Update to 7.1.
[arguments]: Use gexps.
<#:phases>: Refresh them. Add phase 'add-install-to-pythonpath for
running tests. Run tests after install. Add phase 'configure-check.
<#:imported-modules, #:modules>: Add them for
'add-install-for-pythonpath.k
[native-inputs]: Remove python-nose. Add python-setuptools-next,
python-setuptools-scm-next.
(mercurial/pinned): Inherit from mercurial, but build the exact same
derivation as the previous mercurial variable.

* guix/hg-download.scm (hg-package): Use mercurial/pinned.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-08-31 12:21:12 +02:00
Nicolas Graves
6c71c8dc4a
gnu: subversion: Add package and rename former to subversion/pinned.
Subversion currently has CVEs. IMHO, it's unsafe to carry them around
in a profile. However, updating subversion potential leads to a lot of
rebuilds and I don't want to tackle this right now.

As for other packages, the way forward is to add a variant of the
package only used for svn-fetch, here subversion/pinned.

* gnu/packages/version-control.scm (subversion): Update to 1.14.5.
(subversion/pinned): Inherit from subversion, but build the exact same
derivation as the previous subversion variable.

* guix/svn-download.scm (subversion-package): Use subversion/pinned.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2025-08-31 12:21:09 +02:00
Ludovic Courtès
df763d6a2d
git-authenticate: Print a clear error message for malformed keys.
Fixes guix/guix#1141.

* guix/git-authenticate.scm (load-keyring-from-blob): Change ‘oid’ to
‘entry’ and adjust accordingly.  Raise a ‘&formatted-message’ error when
‘read-radix-64’ returns #f or EOF.
(load-keyring-from-reference): Adjust accordingly.

Change-Id: Ib88c94dac543caf6b1e0855242ba50063c944765
2025-08-23 16:57:21 +02:00
Romain GARBAGE
20077256fa
import: pypi: Use autoload instead of use-module.
* guix/import/pypi.scm: Use autoload instead of use-module.

Change-Id: I67001e41c398250e74782c06937dadea8402d4d9
Reviewed-by: zimoun, ngraves
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
2025-08-22 19:27:45 +01:00