Commit Graph

7702 Commits

Author SHA1 Message Date
Christopher Baines
3db1a8341c
store: Add with-store/non-blocking.
For some applications, it's important to establish a non-blocking connection
rather than just making the socket non-blocking after the connection is
established. This is because there is I/O on the socket that will block during
the handshake.

I've noticed this blocking during the handshake causing issues in the build
coordinator for example.

This commit adds a new with-store variant to avoid changing the behaviour of
with-store/open-connection to ensure that this change can't break anything
that depends on the blocking nature of the socket.

* guix/store.scm (open-unix-domain-socket, open-inet-socket): Take
 #:non-blocking? and use SOCK_NONBLOCK when calling socket if appropriate.
(connect-to-daemon, open-connection, call-with-store): Take #:non-blocking?
and pass it on.
(with-store/non-blocking): New syntax rule.
* .dir-locals.el (scheme-mode): Add entry for with-store/non-blocking.

Change-Id: I8225762b78448bc1f7b698c8de5d736e13f577bf
2024-05-13 19:31:17 +01:00
Christopher Baines
7b0f145802
Use po4a-minimal for guix.
As this avoids the indirect dependency on nss, which has a testsuite that
takes a long time to run.

* gnu/packages/package-management.scm (guix)[native-inputs]: Use po4a-minimal.
* guix/self.scm (%packages, translate-texi-manuals): Use po4a-minimal.

Change-Id: Iac7555cc850c1618d3d54f1b290faa4f9cfb4f8a
2024-05-13 12:01:49 +01:00
Rostislav Svoboda
e5fa18b628
guix: channels: Handle single case with authenticating message.
* guix/channels.scm (authenticate-channel): Handle single case with
authenticating message.

Change-Id: I7759607f37405e6d3bd4b7f5958fd11d908db204
Reviewed-by: Dale Mellor <guix-devel-0brg6a@rdmp.org>
Signed-off-by: Christopher Baines <mail@cbaines.net>
2024-05-13 09:11:05 +01:00
Ricardo Wurmus
9cf0f71463
import/cran: Use CRAN mirrors.
* guix/import/cran.scm (%cran-url): Use mirror URL instead of primary project
domain name.

Change-Id: I23a51147d785d6cb645f953ca5ce0ff72f8bd367
2024-05-09 00:02:39 +02:00
Ricardo Wurmus
53555dac1c
guix: Update Bioconductor version to 3.19.
* guix/build-system/r.scm (bioconductor-uri): Use 3.19 URL.
* guix/import/cran.scm (%bioconductor-version): Set to 3.19.

Change-Id: I7a2c4dfcdb2c4cdfef581f823d87e73acc163549
2024-05-08 12:53:14 +02:00
Ludovic Courtès
49232eff56
packages: ‘sanitize-inputs’ does not add labels when unnecessary.
Fixes a bug introduced in 402d0a9b9d
whereby labels would be added in cases like:

  (inputs (list `("label" ,whatever)))

This idiom is found for example in the ‘nmon’ package.

* guix/packages.scm (add-input-labels): Call ‘maybe-add-input-labels’
instead of (map add-input-label …).

Change-Id: I3e86d4607f19482a4e461ef8e7a20cde2a41ead7
2024-05-05 12:06:23 +02:00
Ludovic Courtès
402d0a9b9d
packages: Reduce code bloat due to list allocation in input fields.
* guix/packages.scm (add-input-labels): New procedure.
(sanitize-inputs): Add case for (list …).

Change-Id: Ice8241508ded51efd38867b97ca19c262b8c4363
2024-05-04 19:14:25 +02:00
Ludovic Courtès
76127069e0
packages: ‘define-public’ replacement calls ‘module-export!’ directly.
This reduces code bloat and loading overhead for package modules, which
use ‘define-public’ extensively.

* guix/packages.scm (define-public*): Use ‘define’ followed by
‘module-export!’ directly instead of ‘define-public’.

Change-Id: I7f56d46b391c1e3eeeb0b9a08a9d34b5de341245
2024-05-04 19:14:24 +02:00
Ludovic Courtès
c14b8636fb
records: Do not inline the constructor.
Struct initialization uses one instruction per field, which contributes
to code bloat in the case of package modules.  With this change, the
‘.rtl-text’ section of ‘gnu/packages/tex.go’ goes from 7,334,508 B to
6,356,592 B (-13%; -7% on the whole file size), which alone is still
larger than the source file (4,2 MB).

* guix/records.scm (make-syntactic-constructor)[record-inheritance]: Use
CTOR instead of ‘make-struct/no-tail’.
Pass ABI-COOKIE as the first argument to CTOR.
(define-record-type*): Define CTOR-PROCEDURE and pass it to
‘make-syntactic-constructor’.

Change-Id: Ifd7b4e884e9fbf21c43fb4c3ad963126ef5cb476
2024-05-04 19:14:24 +02:00
Ludovic Courtès
b011ef4378
packages: Reduce bloat induced by ‘sanitize-inputs’.
At -O1, peval does the bulk of the optimization work and it cannot
reduce things like (null? (list 1 2)), unlike what happens in CPS at
-O2.  Thus, reduce the part of ‘sanitize-inputs’ that’s inlined.

* guix/packages.scm (maybe-add-input-labels): New procedure.
(sanitize-inputs): Turn into a macro; use ‘maybe-add-input-labels’.

Change-Id: Id2283bb5a2f5d714722200bdcfe0b0bfa606923f
2024-05-04 19:14:24 +02:00
Ludovic Courtès
2f93e1682a
records: Do not inline throws for ABI mismatches.
* guix/records.scm (record-abi-mismatch-error): New procedure.
(abi-check): Use it.

Change-Id: I49936599716e117b8fbf26fb9d8f462bbbb8e88b
2024-05-04 19:14:24 +02:00
Ludovic Courtès
8d1d98a3aa
git authenticate: Install pre-push and post-checkout hooks.
* guix/scripts/git/authenticate.scm (install-hooks): New procedure.
(guix-git-authenticate): Use it.
* doc/guix.texi (Invoking guix git authenticate): Document it.

Change-Id: I4464a33193186e85b476a12740e54412bd58429c
2024-05-01 17:26:19 +02:00
Ludovic Courtès
1a5041a502
git authenticate: Print something upon success.
Until now the command would be silent and exit with 0.

* guix/scripts/git/authenticate.scm (guix-git-authenticate): Print
something upon success.

Change-Id: I08d086c35df6ac74ee847df0479660293c68987d
2024-05-01 17:26:19 +02:00
Ludovic Courtès
88573dd928
git authenticate: Discover the repository.
This allows one to run ‘guix git authenticate’ from a sub-directory of
the checkout.

* guix/scripts/git/authenticate.scm (%default-options): Remove
‘directory’ key.
(guix-git-authenticate): Use ‘repository-discover’ when ‘directory’
option is missing.

Change-Id: Ifada00d559254971ed7eeb8c0a8d4ae74ff3defc
2024-05-01 17:26:18 +02:00
Ludovic Courtès
7b4bf4ee88
git authenticate: Record introduction and keyring in ‘.git/config’.
* guix/scripts/git/authenticate.scm (%default-options): Remove
‘keyring-reference’.
(config-value, configured-introduction, configured-keyring-reference)
(configured?, record-configuration, current-branch): New procedures.
(guix-git-authenticate)[missing-arguments]: New procedure.
Use ‘configured-introduction’ when zero arguments are given.
Use ‘configured-keyring-reference’ when ‘-k’ is not passed.  Add call to
‘record-configuration’.
* doc/guix.texi (Invoking guix git authenticate): Document it.

Change-Id: I66e111a83f50407b52da71662629947f83a78bbc
2024-05-01 17:26:18 +02:00
Ludovic Courtès
5d2d081af0
svn-download: Add dependency on tar+gzip for SWH retrieval.
Fixes a bug whereby ‘swh-download-directory-by-nar-hash’ would fail due
to ‘tar’ not being found in $PATH:

  $ GUIX_DOWNLOAD_METHODS=swh guix build -S texlive-geometry --check
  In execvp of tar: No such file or directory
  SWH: found directory with nar-sha256 hash 217e1c8d33aa6fd063f205453a946509b059b85fa7e8d32b7e80054d5e6e5c26 at 'swh:1:dir:ccb56476fb36b2ba0298e57f2b2e69c735ac0a2f'
  […]

* guix/svn-download.scm (svn-fetch)[tar+gzip]: New variable.
[build]: Use it.
(svn-multi-fetch): Likewise.

Change-Id: I37ba9824a5feb6d38f85743519cbd2b2c3e1a9e8
2024-05-01 17:26:18 +02:00
Nicolas Graves
5f03cfacd8
import: beautify-description: Fix ". ." case.
* guix/import/utils.scm (beautify-description): Ensure the matched
string pre is long enough not to fail.

Change-Id: I3172d9a41350b98222cd9ab758487485f26650b3
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-04-29 23:56:29 +02:00
Ludovic Courtès
a15db2ee50
pack: ‘-R’ (once) does not include fakechroot fallback.
Previously, ‘guix pack -R’ would build a wrapper containing both the
“userns” and “fakechroot” engines, instead of providing nothing but the
“userns” engine as the manual says.  This patch fixes it.

* guix/scripts/pack.scm (wrapped-package): Add #:fakechroot?
[build]: When FAKECHROOT? is false, ‘elf-loader-compile-flags’ always
returns '().

Change-Id: Ic75cc8c36bf0a3881f299b274d78bd9fc2d4e2bb
2024-04-29 22:54:15 +02:00
Ludovic Courtès
f7f31c8595
publish: Catch all compression errors.
* guix/scripts/publish.scm (swallow-zlib-error): Remove.
(exception-with-kind-and-args?): New variable.
(swallow-compression-error): New macro.
(http-write): Use it instead of ‘swallow-zlib-error’.

Change-Id: I835a1eddd9686741d48365ed37f82b1e1d6f6bdd
2024-04-28 23:19:40 +02:00
Jean-Pierre De Jesus DIAZ
9a60894156
guix: Add xtensa-ath9k-elf platform.
* Makefile.am (MODULES): Add guix/platforms/xtensa.scm.
* guix/platforms/xtensa.scm (xtensa-ath9k-elf): New variable.
* doc/guix.texi: Add xtensa-ath9k-elf documentation.

Change-Id: I51eef245142ed58613340c16d4bf7266e6bf6adb
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-04-17 12:13:02 +02:00
Giacomo Leidi
320f28390f
import: github: Recognize more URLs.
Fixes <https://issues.guix.gnu.org/66396>.

This allows more packages to be refreshed, such as launchmon, love,
retux, preseq, edgar, antlr3, and runc.

* guix/import/github.scm (updated-github-url)[updated-url]: Add
additional heuristics to Github url updater.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Change-Id: I6409b3f61872a954f53480afd63b307d16d0b9c0
2024-04-17 12:13:01 +02:00
Ludovic Courtès
8a74bb8030
Autoload (gcrypt hash).
* guix/derivations.scm: Autoload (guix utils) and (gcrypt hash).
* guix/git.scm, guix/store.scm: Autoload (gcrypt hash).

Change-Id: I6145231d41c61f2d8c36e28f29e91074910bdd15
2024-04-15 22:36:42 +02:00
Ludovic Courtès
ee975926ec
Autoload (guix build syscalls).
* guix/discovery.scm, guix/git.scm, guix/nar.scm,
guix/scripts.scm, guix/scripts/build.scm: Autoload (guix build syscalls).
* guix/packages.scm: Autoload (guix build utils).

Change-Id: Ia7703b5f46e55fbfadff63b13c35bfe097ce2220
2024-04-15 22:36:42 +02:00
Ludovic Courtès
657107cb90
ui: Delay use of (guix build syscalls).
This ensures (guix build syscalls) is loaded only when needed.

* guix/ui.scm (%text-width): Unconditionally alias ‘*line-width*’.
Remove initialization.
<top level>: Remove code for Guile < 2.2.7.
(package->recutils): Change default #:width to (terminal-columns).

Change-Id: I990a1b5b0f20a6243e47e314d1d3d4f8298b7151
2024-04-15 22:36:42 +02:00
Ludovic Courtès
44de6d3990
guix: Delay loading of (gnutls).
(web …) modules pull in (gnutls) indirectly.  Arrange to load them
lazily, thereby reducing I/O and allocations when GnuTLS is not needed
such as when running ‘guix describe’ or ‘guix shell’ on a cache hit.

* guix/download.scm: Autoload (web uri).
* guix/scripts/describe.scm: Likewise.
* guix/store.scm: Likewise.
(%default-substitute-urls): Remove ‘resolve-interface’ call and use
https URLs unconditionally.

Change-Id: Ide470c556a14866e8740966d25821df487a79859
2024-04-15 22:36:42 +02:00
Ludovic Courtès
54be7795b5
utils: Don’t re-export ‘call-with-temporary-output-file’.
* guix/utils.scm: Remove re-export of ‘call-with-temporary-output-file’.
Autoload a number of modules.
* guix/download.scm, guix/import/hackage.scm,
guix/import/hexpm.scm, guix/import/opam.scm,
guix/import/pypi.scm, tests/cpio.scm, tests/egg.scm,
tests/opam.scm, tests/publish.scm, tests/store-database.scm,
tests/utils.scm: Adjust imports accordingly.

Change-Id: I3f5e94631397996a30be2ea4ff8b50a3371e8ee7
2024-04-15 22:36:42 +02:00
Ludovic Courtès
6dc238f261
guix system: Autoload some more.
* guix/scripts/system.scm: Autoload more modules.

Change-Id: I665857109bbfd1e3755135daacc01affcb3eb2eb
2024-04-15 22:36:42 +02:00
Ludovic Courtès
276e658943
channels: Autoload (git …) modules.
Autoloading Guile-Git is important in cases where (guix channels) is
used for little more than the <channel> definition.  This is the case,
for example, of ‘guix describe’ or ‘guix shell’.

This reduces from 177 to 121 the number of .go files loaded when
running:

  ./pre-inst-env strace -e openat -o /tmp/log.strace \
     guix describe -p /var/guix/profiles/per-user/$USER/current-guix
  grep 'openat.*\.go.* = [0-9]' < /tmp/log.strace |wc -l

Likewise, it reduces the max RSS (as measured by ‘time -f %M guix
describe -p …’) from 54 to 37 MiB.

* guix/channels.scm: Autoload (git …) modules.

Change-Id: Ia58a99c865bf0f6fe461a1e71390d075e760f8d6
2024-04-15 22:36:42 +02:00
Ludovic Courtès
96d2de0185
git: Add ‘tag->commit’ and use it in (guix channels).
* guix/git.scm (tag->commit): New procedure, taken from…
(resolve-reference): … here.  Use it in the ‘tag’ case.
* guix/channels.scm (resolve-channel-news-entry-tag): Use ‘tag->commit’
instead of custom code.

Change-Id: I46ea387345dc1b695ce0702991a52d0cde29e2f0
2024-04-15 22:36:41 +02:00
Ludovic Courtès
088e181c0a
channels: Move ‘commit-short-id’ to (guix git).
* guix/channels.scm (commit-short-id): Move to…
* guix/git.scm (commit-short-id): … here.

Change-Id: If4b34b1d82b1aa5068d157f26e57e8aecc967061
2024-04-15 22:36:41 +02:00
Ludovic Courtès
a57518484e
git: Add ‘repository-info’ and use it in (guix channels).
* guix/git.scm (repository-info): New procedure.
* guix/channels.scm (repository->guix-channel): Use it instead of local
code.

Change-Id: I74c758c73a22e16031571ca4271cc9cab0492f6e
2024-04-15 22:36:41 +02:00
Ludovic Courtès
3cadb61963
channels: Use SRFI-71 instead of SRFI-11.
* guix/channels.scm (latest-channel-instance): Use SRFI-71.

Change-Id: I73531c98b3034e228006ed91518cc7bfedc784fd
2024-04-15 22:36:41 +02:00
Ludovic Courtès
b30b838d50
gexp: Add #:guile parameter to ‘gexp->file’ and ‘scheme-file’.
This brings ‘gexp->file’ in line with its documentation and mirrors
what’s done for ‘gexp->script’ and ‘program-file’.

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

* guix/gexp.scm (gexp->file): Add #:guile, as was already documented.
(<scheme-file>)[guile]: New field.
(scheme-file): Add #:guile.
(scheme-file-compiler): Honor ‘guile’ field.
* tests/gexp.scm ("gexp->file")
("gexp->file + file-append", "gexp->file + #:splice?")
("gexp->file, cross-compilation")
("gexp->file, cross-compilation with default target")
Add #:guile to ‘gexp->file’ calls.
("gexp-modules deletes duplicates")
("gexp->derivation & with-imported-module & computed module")
("gexp->derivation & with-extensions", "scheme-file"): Likewise for
‘scheme-file’ calls.

Change-Id: I47536063d5e411e561ec321e535267e92dd06044

Reported-by: Efraim Flashner <efraim@flashner.co.il>
Change-Id: I58d653c7fbe65c665bafcbd332ac9b264ddeab64
2024-04-08 00:05:48 +02:00
Ludovic Courtès
a7f15c9ecf
reconfigure: /run/current-system points to generation.
* guix/scripts/system/reconfigure.scm (switch-system-program): Set
‘GUIX_NEW_SYSTEM’ to GENERATION rather than OS, for consistency with
what ‘boot-system’ does.
* gnu/tests/reconfigure.scm (run-switch-to-system-test)
["script activated the new generation"]: Adjust accordingly.

Change-Id: I57b693606a41b8c952df32bbdc2b9120c6dbfd6a
2024-04-08 00:05:48 +02:00
Ian Eure
298aed72a2
gnu: open-ssh-session: Don’t require public key.
Public keys aren’t required for client connections, and this binding is
unused.  The behavior of assuming a ".pub"-suffixed file exists in the same
directory as the secret key is undocumented and surprising.

* guix/scripts/offload.scm (open-ssh-session): Delete `public' binding.

Signed-off-by: Christopher Baines <mail@cbaines.net>
Change-Id: I9b532be2abe68dae0323e4ef6e1ceab1e5603359
2024-04-07 19:43:07 +01:00
Christopher Baines
acd3cb258f
guix: nar: Update path-id to valid-path-id.
To match the change in (guix store database).

* guix/nar.scm (finalize-store-file): Update path-id to valid-path-id.

Change-Id: I69255c7acc1ea4e4855a4621bfcec54f595dd24d
2024-04-07 19:32:33 +01:00
Wojtek Kosior
c3dfb14f9b
store: database: Use correct function name in assertion.
* guix/store/database.scm (register-valid-path): Replace "sqlite-register"
with "register-valid-path" as argument to `assert-integer'.

Change-Id: Id93687e90d0a806d715006ca0b2498a1d10cfba6
Signed-off-by: Christopher Baines <mail@cbaines.net>
2024-04-07 19:07:26 +01:00
Wojtek Kosior
a3c28d7f7e
scripts: system: Rename `sqlite-register'.
* guix/scripts/system.scm (define-module): #:autoload `register-valid-path'
instead of `sqlite-register'.
(copy-item): Call it with the new name.

Change-Id: I24f71f822a5f400a47adee43f61184a4fbcb9741
Signed-off-by: Christopher Baines <mail@cbaines.net>
2024-04-07 19:07:15 +01:00
Zheng Junjie
91ad8a1444
build: qt-utils: Use QML_IMPORT_PATH2 for Qt 5 (fixup).
This follows a499d1772d ("build: qt-utils: Use
QML_IMPORT_PATH for Qt 6.").

* guix/build/qt-utils.scm (variables-for-wrapping): Use QML_IMPORT_PATH2 when
the Qt major version is <= 6, QML_IMPORT_PATH otherwise.

Change-Id: I2dd1d426aef117105708cc4004078deaa28c15cd
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2024-04-06 11:42:56 -04:00
Ludovic Courtès
d6a3818761
build-system/channel: Add support for additional channels.
Until now, ‘channel-build-system’ would assume a single channel, the
‘guix’ channel.  This change lets users specify additional channels
using the #:channels parameter.

* guix/build-system/channel.scm (build-channels): Add #:channels and
honor it.
(channel-build-system): In ‘lower’, add #:channels and honor it.
* doc/guix.texi (Build Systems): Document it.

Change-Id: I36c1d19cbeee02a4d1144de089b78df0390774a0
2024-04-05 18:21:23 +02:00
Ludovic Courtès
96802f490d
ssh: ‘open-ssh-session’ displays the port number upon error.
* guix/ssh.scm (open-ssh-session): Show the port number in error message.

Change-Id: I18a3dc54223bb29782dcdd43d3252c720525c31d
2024-04-04 15:48:47 +02:00
Maxim Cournoyer
a499d1772d
build: qt-utils: Use QML_IMPORT_PATH for Qt 6.
* guix/build/qt-utils.scm (variables-for-wrapping): Use QML_IMPORT_PATH
instead of QML2_IMPORT_PATH when the major version is greater or equal to 6.

Change-Id: I3480b540d3c0caafd3cc3d6574442dc97f540953
2024-04-03 18:05:10 -04:00
Christopher Baines
c9cd16c630
store: database: Rename a couple of procedures.
These names should be more descriptive.

* guix/store/database.scm (path-id): Rename to select-valid-path-id.
(sqlite-register): Rename to register-valid-path.
(register-items): Update accordingly.

Change-Id: I6d4a14d4cde9d71ab34d6ffdbfbfde51b2c0e1db
2024-04-03 17:30:53 +01:00
Christopher Baines
c6cc9aeb87
store: database: Refactor sqlite-register.
The update-or-insert procedure name was unhelpfully generic, and these changes
should improve the code readability.

* guix/store/database.scm (update-or-insert): Remove procedure and inline
functionality in to sqlite-register.

Change-Id: Ifab0cdb7972d095460cc1f79b8b2f0e9b958059c
2024-04-03 17:30:43 +01:00
Christopher Baines
511d68c71d
store: database: Stop finalizing prepared statements.
Especially since we're asking for these to be cached.

Management of prepared statements isn't trivial, since you don't want to keep
them forever as this can lead to poor query performance, but I don't think
that finalizing them immediately is the right solution.

Change-Id: I61706b4d09d771835bb8f074b8f6a6ee871f5e2d

* guix/store/database.scm (sqlite-step-and-reset): New procedure.
(last-insert-row, path-id, update-or-insert, add-references): Don't finalize
prepared statements.

Change-Id: I2a2c6deb43935d67df9e43000a5105343d72b3e6
2024-04-03 17:18:39 +01:00
Christopher Baines
cdd4a0c3c9
store: database: Inline SQL to where it's used.
This makes the code easier to read, as you don't have to keep jumping between
the two places.

* guix/store/database.scm (path-id-sql, update-sql, insert-sql,
add-reference-sql): Remove variables.
(path-id, update-or-insert, add-references): Include SQL.

Change-Id: I53b4ab973be8d0cd10a0f35ba25972f1c9680353
2024-04-03 17:18:39 +01:00
Christopher Baines
b914fb9b70
store: database: Remove with-statement and associated code.
I think using dynamic-wind to finalize all statements is the wrong
approach. Firstly it would be good to allow reseting statements rather than
finalizing them. Then for the problem of handling errors, the approach I've
settled on in the build coordinator is to close the database connection, since
that'll trigger guile-sqlite3 to finalize all the cached statements.

This reverts commit 5d6e225528.

* .dir-locals.el (scheme-mode): Remove with-statement.
* guix/store/database.scm (call-with-statement): Remove procedure.
(with-statement): Remove syntax rule.
(call-with-transaction, last-insert-row-id, path-id, update-or-insert,
add-references): Don't use with-statement.

Change-Id: I2fd976b3f12ec8105cc56350933a953cf53647e8
2024-04-03 17:18:38 +01:00
Christopher Baines
22fa92cf28
store: database: Remove call-with-savepoint and associated code.
While care does need to be taken with making updates or inserts to the
ValidPaths table, I think that trying to ensure this within update-or-insert
is the wrong approach. Instead, when working with the store database, only one
connection should be used to make changes to the database and those changes
should happen in transactions that ideally begin immediately.

This reverts commit 37545de4a3.

* .dir-locals.el (scheme-mode): Remove entries for call-with-savepoint and
call-with-retrying-savepoint.
* guix/store/database.scm (call-with-savepoint, call-with-retrying-savepoint):
Remove procedures.
(update-or-insert): Remove use of call-with-savepoint.

Change-Id: I2f986e8623d8235a90c40d5f219c1292c1ab157b
2024-04-03 17:18:38 +01:00
Christopher Baines
ecbab97f07
scripts: substitute: Replace some leave calls with raise.
These calls happen inside of with-error-handling, so the effect should be the
same, but this opens up the possibility of using this code in a program that
doesn't want to exit when one of these error conditions is met.

Change-Id: I15d963615d85d419559fa0f4333fa4dc1dfbfd3b

* guix/scripts/substitute.scm (download-nar, process-substitution): Use raise
formatted-message rather than leave.

Change-Id: Idd0880206b69e3903e19e0536b87d65a52c200d5
2024-04-03 17:18:38 +01:00
Christopher Baines
dcf0cca8d7
scripts: substitute: Allow not using with-timeout in download-nar.
I don't think the approach of using SIGALARM here for the timeout will work
well in all cases (e.g. when using Guile Fibers), so make it possible to avoid
this.

* guix/scripts/substitute.scm (download-nar): Pass the fetch timeout in as an
option.

Change-Id: I8cbe6cdfa10cdaa7d41974cbea56a95f5efecfe6
2024-04-03 17:18:38 +01:00
Christopher Baines
d9276a46bf
scripts: substitute: Remove side effect warning from network-error?.
Instead, display the warning from process-substitution and
process-substitution/fallback in the relevant places.

I'm looking at this because I want to make the substitute code less tied to
the script and usable in the Guile guix-daemon.

* guix/scripts/substitute.scm (network-error?): Move warning to…
(process-substitution/fallback, process-substitution): here.

Change-Id: I082b482c0e6ec7e02a8d437ba22dcefca5c40787
2024-04-03 17:18:38 +01:00
Christopher Baines
ac19e038b4
Switch order of the default substitute servers.
The aim here is to improve the user experience.  There's anecdotal evidence
that the network performance for bordeaux is better compared to ci at least
for some users, and I don't know of any issues with rate limiting or access
restriction for bordeaux compared to ci.  It also has IPv6 support.

Additionally, bordeaux generally had more substitutes than ci, particularly
for aarch64-linux and armhf-linux.  This change will offer a very slight
speedup for those substitutes that only bordeaux has.

Bordeaux has been a default substitute server for nearly 3 years now and I
think this change is overdue.  I'm also hopeful that we'll be able to build on
the testing regarding mirrors for bordeaux, and that'll allow potentially
improving the hosting setup (through providing more redundancy) and further
improving substitute fetching for users who currently have issues with
substitute access.

* config-daemon.ac: Switch substitute urls order.
* doc/guix.texi: Ditto.
* etc/guix-install.sh: Ditto.
* gnu/installer/newt/network.scm (wait-service-online): Ditto.
* guix/store.scm (%default-substitute-urls): Ditto.

Change-Id: I4f6d93ae1fc8b03d80b47b18b5749a51f1fde17b
Signed-off-by: Christopher Baines <mail@cbaines.net>
2024-04-03 17:18:38 +01:00
Ludovic Courtès
7bc1f7be62
ui: Autoload some more.
* guix/ui.scm: Autoload a number of modules.

Change-Id: I22d4f719dae73594499522ce6dc8464948f564ec
2024-03-31 18:39:57 +02:00
Liliana Marie Prikler
72ca1a336a
Merge branch 'emacs-team' 2024-03-30 10:02:52 +01:00
Liliana Marie Prikler
a915a57d91
Merge branch 'gnome-team' 2024-03-30 09:47:43 +01:00
Ludovic Courtès
ddc9d66f2b
substitute: Retry nar download upon networking error.
This allows ‘guix substitute’ to gracefully handle errors like:

  TLS error in procedure 'write_to_session_record_port': Error in the push function

instead of exiting (“`guix substitute' died unexpectedly”).

* guix/scripts/substitute.scm (download-nar)[try-fetch]: Catch
‘network-error?’ too.

Reported-by: Ada Stevenson <adanskana@gmail.com>
Change-Id: I91b92183b0165832645ee37d50c13445f9322525
2024-03-30 01:01:31 +01:00
Ludovic Courtès
80a135d64b
channels: Autoload several modules.
* guix/channels.scm: Autoload several Git-related modules.

Change-Id: I23e46eabdbfa9db340e26006419b4b87bb446853
2024-03-30 01:01:31 +01:00
Liliana Marie Prikler
4c70f5242b
Merge branch 'master' into emacs-team 2024-03-27 05:22:31 +01:00
Richard Sent
d282a31f52
reconfigure: Skip starting new shepherd services with auto-start? #f
Fixes <https://bugs.gnu.org/68093>.

* guix/scripts/system/reconfigure.scm (upgrade-shepherd-services): Only add
new shepherd services with auto-start? #t to to-start list.

Change-Id: I268b921336fb1195ed76746eb6178889dbc258b4
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-03-21 17:43:16 +01:00
Christopher Baines
8fa0761264
Merge remote-tracking branch 'savannah/master' into gnome-team
Change-Id: Iec8e15b79c6fde516294c2bfcaf8ee3575b1f745
2024-03-20 14:54:26 +00:00
Ludovic Courtès
b7931e6f5d
git authenticate: Document ‘--end’.
* guix/scripts/git/authenticate.scm (show-help): Document ‘--end’.
* doc/guix.texi (Invoking guix git authenticate): Likewise.

Reported-by: Tomas Volf <~@wolfsden.cz>
Change-Id: Ia646203ce2f721487de547c76b9488754c70db66
2024-03-19 17:02:14 +01:00
Ludovic Courtès
c90a4e8dcd
describe: Try harder to find the ‘guix pull’ profile.
Fixes <https://issues.guix.gnu.org/66705>.

The strategy used by ‘current-profile’ so far would fail to find the
right profile (the one created by ‘guix pull’ or ‘guix time-machine’) in
cases where said profile is itself included in another profile.  This
happens, for instance, when running ‘guix shell -CW -- guix describe’,
which, as a result, would display nothing but the ‘guix’ channel.

This patch fixes that by having ‘current-profile’ not just check for the
presence of a ‘manifest’ file but also parse it to determine whether
it’s a ‘guix pull’ kind of manifest.

* guix/describe.scm (find-profile): New procedure.
(current-profile): Adjust to use it.

Change-Id: I9194f54ce1496a6591e247c76203f497f28c330b
2024-03-19 17:02:14 +01:00
Ludovic Courtès
06baf4d6ba
profiles: ‘read-manifest’ raises to ‘&profile-error’ upon version mismatch.
* guix/profiles.scm (sexp->manifest): In the catch-all clause, raise to
‘&profile-error’ in addition to ‘&message’.

Change-Id: Ieb08187b388531c2157bfe67fb1b7319dbbb4ff3
2024-03-19 17:02:14 +01:00
Christopher Baines
618cae45dc
Merge remote-tracking branch 'savannah/master' into gnome-team
Change-Id: I775274c2693536e2efa36c9abca4c54c5c458e26
2024-03-16 10:19:30 +00:00
Ludovic Courtès
a26bce55e6
time-machine: Allow time travels to v0.16.0.
* guix/scripts/time-machine.scm (%oldest-possible-commit): Change to
v0.16.0.
* tests/guix-time-machine.sh: Adjust comment.

Change-Id: I9ad82bd45fee0d172b5348a8ae16e990338a3a97
2024-03-11 22:12:34 +01:00
Efraim Flashner
92bd81a96f
transformations: Add support for rust.
* guix/transformations.scm (tuning-compiler): Add support for rustc.

Change-Id: I6db596a586eda648666550cdcadaa5e1704cb79c
2024-03-10 12:50:13 +02:00
Liliana Marie Prikler
2ee5451319
Merge branch 'master' into gnome-team 2024-03-10 00:05:58 +01:00
Ludovic Courtès
2f441fc738
download: Honor ‘GUIX_DOWNLOAD_METHODS’ environment variable.
This replaces ‘GUIX_DOWNLOAD_FALLBACK_TEST’ and allows you to test
various download methods, like so:

  GUIX_DOWNLOAD_METHODS=nar guix build guile-gcrypt -S --check
  GUIX_DOWNLOAD_METHODS=disarchive guix build hello -S --check

* guix/build/download.scm (%download-methods): New variable.
(download-method-enabled?): New procedure.
(url-fetch): Define ‘initial-uris’; honor ‘download-method-enabled?’.
Call ‘disarchive-fetch/any’ only when the 'disarchive method is enabled.
* guix/build/git.scm (git-fetch-with-fallback): Honor
‘download-method-enabled?’.
* guix/download.scm (%download-methods): New variable.
(%download-fallback-test): Remove.
(built-in-download): Add #:download-methods parameter and honor it.
(url-fetch*): Pass #:content-addressed-mirrors and #:disarchive-mirrors
unconditionally.
* guix/git-download.scm (git-fetch/in-band*): Pass “git url”
unconditionally.
(git-fetch/built-in): Likewise.  Pass “download-methods”.
* guix/bzr-download.scm (bzr-fetch)[build]: Honor ‘download-method-enabled?’.
Pass ‘GUIX_DOWNLOAD_METHODS’ to #:env-vars.
* guix/cvs-download.scm (cvs-fetch)[build]: Honor ‘download-method-enabled?’.
Pass ‘GUIX_DOWNLOAD_METHODS’ to #:env-vars.
* guix/hg-download.scm (hg-fetch): Honor ‘download-method-enabled?’.
Pass #:env-vars to ‘gexp->derivation’.
* guix/scripts/perform-download.scm (perform-download): Honor
“download-methods” from DRV.  Parameterize ‘%download-methods’ before
calling ‘url-fetch’.
(perform-git-download): Likewise.
* guix/svn-download.scm (svn-fetch): Honor ‘download-method-enabled?’.
Pass ‘GUIX_DOWNLOAD_METHODS’ to #:env-vars.
(svn-multi-fetch): Likewise.

Change-Id: Ia3402e17f0303dfa964bdc761265efe8a1dd69ab
2024-03-09 18:55:50 +01:00
Ludovic Courtès
abd0cca2a9
perform-download: Allow use of ‘download-nar’ for ‘--check’ builds.
Previously, the nar fallback would always fail on ‘--check’ build
because the output directory in that case is different from the store
file name.  This change fixes that.

* guix/build/git.scm (git-fetch-with-fallback): Add #:item parameter and
pass it to ‘download-nar’.
* guix/scripts/perform-download.scm (perform-git-download): Pass #:item
to ‘git-fetch-with-fallback’.

Change-Id: I30fc948718e99574005150bba5215a51ef153c49
2024-03-09 18:55:50 +01:00
Ludovic Courtès
3e9bea7ee3
download-nar: Distinguish ‘output’ and ‘item’ parameter.
This is useful when running a ‘--check’ build, where the output file
name differs from the store file name we are trying to restore.

* guix/build/download-nar.scm (download-nar): Add ‘output’ parameter and
distinguish it from ‘item’.

Change-Id: I42219b6d4c8fd1ed506720301384efc1aa351561
2024-03-09 18:55:50 +01:00
Ludovic Courtès
8a42fc7140
bzr-download: Implement nar fallback.
* guix/bzr-download.scm (bzr-fetch)[guile-json, guile-lzlib,
guile-gnutls]: New variables.
[build]: Add ‘with-extensions’ and import more modules.  Invoke
‘download-nar’ when ‘bzr-fetch’ returns #f.
* guix/build/bzr.scm (bzr-fetch): Actually return #t on success.

Change-Id: Id5d4ebd0f9ddc3c44b6456d3b46c0000cc7b9997
2024-03-09 18:55:49 +01:00
Ludovic Courtès
0e73f933b2
svn-download: Use ‘swh-download-directory-by-nar-hash’.
Fixes <https://issues.guix.gnu.org/43442>.

* guix/svn-download.scm (svn-fetch)[build]: Add
‘swh-download-directory-by-nar-hash’ call as a last resort.
Import (guix swh).
* guix/svn-download.scm (svn-multi-fetch)[build]: Likewise.

Change-Id: Ifcb9be1e9c2b05ce172c44e45dcf3a3ea6df8e76
2024-03-09 18:55:49 +01:00
Ludovic Courtès
2a9f817ffd
hg-download: Use ‘swh-download-directory-by-nar-hash’.
This allows content-addressed access to the checkout, which is
preferable.

* guix/hg-download.scm (hg-fetch): Add call to
‘swh-download-directory-by-nar-hash’ before ‘swh-download’ call.

Change-Id: I2afc8badc1f8bb2c8bdd3a47abbb72d455d93e64
2024-03-09 18:55:49 +01:00
Ludovic Courtès
ddd455c0dd
swh: ‘lookup-origin-revision’ handles branches pointing to directories.
Fixes <https://issues.guix.gnu.org/69070>.

* guix/swh.scm (branch-target): Add clause for 'directory and 'alias.
(lookup-origin-revision): Iterate over all the visits of ORIGIN instead
of just the first one.  Handle the case where ‘branch-target’ returns
something other than a release or revision.
* tests/swh.scm ("lookup-origin-revision"): New test.

Change-Id: I7f636739a719908763bca1d3e7376341dd62e816
2024-03-09 18:55:49 +01:00
Ludovic Courtès
ed9d7d8431
swh: ‘origin-visits’ takes an optional ‘max’ parameter.
* guix/swh.scm (origin-visits): Add optional ‘max’ parameter and honor
it.

Change-Id: I642d7d4b0672b68fb5c7ce2b49161307e13d3c95
2024-03-09 18:55:49 +01:00
Ludovic Courtès
a813d6890b
swh: Add ‘type’ field to <visit>.
* guix/swh.scm (<visit>)[type]: New field.

Change-Id: I7677984c7daef38d8f3c3bef19723fa0efb035ba
2024-03-09 18:55:49 +01:00
Ludovic Courtès
47a0e5d9fb
lint: archival: Trigger “Save Code Now” for VCSes other than Git.
Until now, ‘save-origin’ would be called only when given a
<git-reference>.  With this change, ‘save-origin’ gets called for other
version control systems as well.

* guix/lint.scm (swh-response->warning): New procedure, formerly in
‘check-archival’.
(vcs-origin, save-package-source): New procedures.
(check-archival)[response->warning]: Remove.
Call ‘save-package-source’ in both the Git and the non-Git cases.
* tests/lint.scm ("archival: missing svn revision"): New test.

Change-Id: I535e4ec89488faf83bfa544d5e4935fa73ef54fb
2024-03-09 18:55:49 +01:00
Ludovic Courtès
3328dec087
lint: archival: Fix crash in non-Git case.
Fixes a bug introduced in 29f3089c84 where
‘guix lint -c archival guile-wisp’ (for instance) would crash with a
match error because ‘lookup-by-nar-hash’ returns a string.

* guix/lint.scm (check-archival): Add SWHID case in the non-Git case.

Change-Id: I66fb060172d372041df47d90a14df168b0fa762d
2024-03-09 18:55:49 +01:00
Ludovic Courtès
cfc63f673f
lint: Switch to SRFI-71.
* guix/lint.scm: Switch from SRFI-11 to SRFI-71.

Change-Id: I62e6cd304ad73570bd12bd67f7051566205596bb
2024-03-09 18:55:48 +01:00
Liliana Marie Prikler
058532bdd8
Merge branch 'master' into emacs-team 2024-03-09 07:46:25 +01:00
Efraim Flashner
cae9e9db32
cpu: Enable tuning for i686-linux.
* gnu/packages/gcc.scm (gcc-7, gcc-10, gcc-11, gcc-12, gcc-13)
[properties]: In compiler-cpu-architectures use the
x86_64-micro-architectures list for i686.
* guix/cpu.scm (cpu->gcc-architecture): Expand the x86_64 case to also
support i686.

Change-Id: I0b820ceb715960db5e702814fa278dc8c619a836
2024-03-07 13:04:27 +02:00
Efraim Flashner
7700dc2cf5
cpu: Rename x86-64-v1 to x86-64.
This is the actual micro-architecture designation used by compilers.

* gnu/packages/gcc.scm (%gcc-11-x86_64-micro-architectures): Rename
x86-64-v1 to x86-64.
* gnu/packages/golang.scm (%go-1.18-x86_64-micro-architectures): Same.
* guix/cpu.scm (cpu->micro-architecture-level): Same.
(gcc-architecture->micro-architecture-level): Same.

Change-Id: I19ed556a7e8deb4a77f4c63fca3b794f25092788
2024-03-07 13:04:27 +02:00
Efraim Flashner
63165a9486
cpu: Be consistent with x86_64 micro-architecture names.
* gnu/packages/golang.scm (%go-1.18-x86_64-micro-architectures): Rename
micro-architectures from x86_64-v* to x86-64-v*.
* guix/cpu.scm (cpu->gcc-architecture): Return x86-64 as the fallback.
(cpu->micro-architecture-level): Rename micro-architectures from
x86_64-v* to x86-64-v*.
(gcc-architecture->micro-architecture-level): Same.

Change-Id: I37db65970417c22699ae8097b0361bccf76c1267
2024-03-07 13:04:27 +02:00
Carlo Zancanaro
9d9bb8955a
scripts: import: elpa: Unquote-splice package sexp contents.
* guix/scripts/import/elpa.scm (guix-import-elpa): Unquote-splice the contents
of the package sexp so the matched package definition is returned unchanged.

Change-Id: Iaaa7e72390c73c6d6671811fe9ac284d599b44c6
Signed-off-by: Ricardo Wurmus <rekado@elephly.net>
2024-03-06 11:09:55 +01:00
Ricardo Wurmus
3e0a1469b8
import/cran: Add one more invalid package.
* guix/import/cran.scm (invalid-packages): Add "use_c17".

Change-Id: Ie3b6455d4eff97811057cd82dca460367a4583e5
2024-03-06 09:42:04 +01:00
Efraim Flashner
29a9d0596f
guix: cpu: Update aarch64 CPUs.
* guix/cpu.scm (cpu->gcc-architecture): Update list of CPUs from the
list in gcc.

Change-Id: Ifcd26c143fc9e3aaa0c5514e1dac4908d2780255
2024-03-05 08:54:14 +02:00
Efraim Flashner
5dce7964ef
guix: cpu: Autodetect the x86-64-v4 microarchitecture.
* guix/cpu.scm (gcc-architecture->micro-architecture-level): Sort
gcc-architectures which have AVX512F support into x86-64-v4.

Change-Id: I8af0ceb692eefec7433e1fd5149379244da799c4
2024-03-05 08:54:13 +02:00
Efraim Flashner
b9f87817a1
guix: cpu: Update x86_64 CPUs.
* guix/cpu.scm (cpu->gcc-architecture): Add graniterapids-d,
pantherlake, clearwaterforest, arrowlake-s, yongfeng.  Remove
grandridge.  Update CPU flags for searching to match architecture.
(gcc-architecture->micro-architecture-level): Adjust listed
architectures and sort in order used above.

Change-Id: I186ab6e396e36c34f7c61827e02f637716993141
2024-03-05 08:54:13 +02:00
Paul A. Patience
8dca56b4a1
gnu: perl6-tap-harness: Update to 0.3.5.
* gnu/packages/perl6.scm (perl6-tap-harness): Update to 0.3.5.
[source]: Update URL. Reindent.
[arguments]: Replace obsolete prove6 script with manual Raku invocation
in 'check' phase.
[home-page]: Update.
[synopsis]: Replace mention of Perl with Raku.

* gnu/packages/rakudo-build-system.scm (check): Replace obsolete prove6
script with manual Raku invocation.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2024-03-04 10:41:57 +02:00
Paul A. Patience
6a80ac450c
gnu: rakudo: Update to 2022.04.
* gnu/packages/perl6.scm (rakudo): Update to 2022.04.
[source]: Add snippet to delete bundled 3rdparty directory.
[arguments]: Add 'remove-calls-to-git', 'fix-paths' and
'disable-failing-tests' phases. Remove 'patch-source-date' phase. Adjust
files in 'patch-more-shebangs' phase and sort them. Remove redundant
'./' from 'configure' phase. Replace Perl extensions and paths with Raku
equivalents in 'install-dist-tool' phase.
[native-inputs]: Add nqp-configure.
[synopsis, description]: Replace mentions of Perl with Raku.

* guix/build/rakudo-build-system.scm (install): Replace Perl extension
with Raku extension.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2024-03-04 09:21:56 +02:00
Liliana Marie Prikler
7f3f70eedb
guix: emacs-utils: Make emacs-compile-directory forwards-compatible.
Newer (development) builds of Emacs 30 mark a number of functions related to
native compilation as ‘internal’.  Since we rely on such functions and there
does not appear to be a high-level replacement at the moment, let's work
around this case.

* guix/build/emacs-utils.scm (emacs-compile-directory): Require comp early
and check if ‘comp-write-bytecode-file’ is available.

Fixes: Upstream renamed comp-write-bytecode-file <https://bugs.gnu.org/69201>
2024-03-02 16:56:13 +01:00
Tomas Volf
ef788ee2dc
build-system/guile: Install .scm files first.
Until now the .go files were generated first, and only after that the .scm
files were installed into the target location.  That led to a lot of messages
about `source file ... newer than compiled' if the custom 'check phase tried
to load the compiled files.

Swapping the order of the actions resolves the issue allowing the tests to be
written without lot of noise in the build log.

For final artifacts it was not a problem, since daemon resets the timestamps.

* guix/build/guile-build-system.scm (build): Install .scm before producing
.go.

Change-Id: I3428d144fcbaa6c904ee662193c3bca82589e344
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-03-02 16:26:29 +01:00
Tomas Volf
c3cd24b29a
build-system/guile: Fix indentation.
The inner (let) was on the same level as the outer one, which was confusing.

* guix/build/guile-build-system.scm (build): Fix indentation.

Change-Id: I701b61747c270b185eac9377b066748baa2b3d20
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-03-02 16:26:26 +01:00
Tomas Volf
7fc91c1413
build-system/guile: Fix typo in documentation string.
* guix/build/guile-build-system.scm (install-documentation): Fix typo in
documentation string.

Change-Id: I8940591fcbf8222c8f8365dabbac0e8300cad84c
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-03-02 16:25:35 +01:00
Liliana Marie Prikler
25c14c893f
Merge branch 'master' into gnome-team 2024-03-02 12:22:34 +01:00
Liliana Marie Prikler
3d4fc910f7
Merge branch 'master' into emacs-team 2024-03-02 08:07:11 +01:00
Efraim Flashner
f29f80c194
Merge branch 'rust-team'
Change-Id: Iee31c5de29c357c822f60df4fa8ce758779eb349
2024-02-28 12:18:45 +02:00
Liliana Marie Prikler
7bf4ce4582
Merge branch 'master' into gnome-team 2024-02-25 10:28:03 +01:00
Liliana Marie Prikler
56a7c1308a
build-system: emacs: Compute relative file names.
With the previous commit, relative file names are expanded relative to
ELN_DIR -- more or less.  To make use of this in emacs-build-system, we must
also pass relative file names.

* guix/build/emacs-build-system.scm (emacs-compile-directory): Compute the
relative file names of the files to compile.

Change-Id: I8983f80fb0fe1573e46748222403ba8873f1599f
2024-02-24 08:08:31 +01:00
Herman Rimm
b386c11e78
import: Do not return package name with json importer.
* guix/import/json.scm (json->code): Do not return package names after
package expressions.
* doc/package-hello.json: Fix comma errors and use valid greeter URL.

Change-Id: Id71924e72f690a9bda5fbfdb65a443029adfd158
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-02-23 19:02:55 +01:00