Commit Graph

1780 Commits

Author SHA1 Message Date
Timothy Sample
fbc2a52a32
download: Use Disarchive as a last resort.
This is a fixed version of 66b14dccdd0d83c875ce3a8d50ceab8b6f0a3ce2,
which was reverted in e74250c3c535b75dd2225a26df51febb7ed94654.

* guix/download.scm (%disarchive-mirrors): New variable.
(%disarchive-mirror-file): New variable.
(built-in-download): Add 'disarchive-mirrors' keyword argument and
pass its value along to the 'builtin:download' derivation.
(url-fetch): Pass '%disarchive-mirror-file' to 'built-in-download'.
* guix/scripts/perform-download.scm (perform-download): Read
Disarchive mirrors from the environment and pass them to
'url-fetch'.
* guix/build/download.scm (disarchive-fetch/any): New procedure.
(url-fetch): Add 'disarchive-mirrors' keyword argument, use it to
make a list of URIs, and use the new procedure to fetch the file if
all other methods fail.
* build-aux/build-self.scm (build-program)[select?]: Exclude '(guix
build download)'.
* guix/self.scm (compiled-guix)[*core-modules*]: Add 'guile-json' to
the list of extensions.
2021-04-29 11:24:48 -04:00
Timothy Sample
e74250c3c5
Revert "download: Use Disarchive as a last resort."
This reverts commit 66b14dccdd0d83c875ce3a8d50ceab8b6f0a3ce2, which broke
'guix pull'.
2021-04-28 00:24:28 -04:00
Timothy Sample
66b14dccdd
download: Use Disarchive as a last resort.
* guix/download.scm (%disarchive-mirrors): New variable.
(%disarchive-mirror-file): New variable.
(built-in-download): Add 'disarchive-mirrors' keyword argument and
pass its value along to the 'builtin:download' derivation.
(url-fetch): Pass '%disarchive-mirror-file' to 'built-in-download'.
* guix/scripts/perform-download.scm (perform-download): Read
Disarchive mirrors from the environment and pass them to
'url-fetch'.
* guix/build/download.scm (disarchive-fetch/any): New procedure.
(url-fetch): Add 'disarchive-mirrors' keyword argument, use it to
make a list of URIs, and use the new procedure to fetch the file if
all other methods fail.
2021-04-27 21:27:02 -04:00
Ludovic Courtès
02d62978f4
http-client, substitute: Gracefully handle GnuTLS EAGAIN/EINTR.
Partly fixes <https://bugs.gnu.org/47867>.
Reported by Florian Pelz <pelzflorian@pelzflorian.de>.

In GnuTLS up to 3.7.1 included, GNUTLS_E_AGAIN and GNUTLS_E_INTERRUPTED
are not handled by 'write_to_session_record_port' and could be thrown at
the caller.  This patch works around that by dropping connections
altogether and restarting when this happens.

* guix/http-client.scm (false-if-networking-error): Swallow ERROR/AGAIN
and ERROR/INTERRUPTED.
* guix/scripts/substitute.scm (call-with-cached-connection): Likewise.
2021-04-24 19:08:13 +02:00
Ludovic Courtès
d95168321f
import: Remove Nix importer.
This importer has suffered from bitrot and no longer works with current
Nix and Nixpkgs.  See <https://bugs.gnu.org/32339> and
<https://bugs.gnu.org/36255>.

* guix/import/snix.scm, guix/scripts/import/nix.scm,
tests/snix.scm: Remove.
* Makefile.am (MODULES, SCM_TESTS): Remove them.
* guix/scripts/import.scm (importers): Remove "nix".
* build-aux/test-env.in: Remove NIXPKGS variable.
* configure.ac: Remove '--with-nixpkgs' option.
* doc/guix.texi (Invoking guix import): Remove bit about "guix import
nix".
* etc/completion/fish/guix.fish: Likewise.
2021-04-20 12:13:16 +02:00
Mark H Weaver
e18e2e458f
scripts: system: Default to -v3 when building a system.
This is a followup to 8f9052d5434a3a11e7b4ff14d6b0090256e08aa4.

* guix/scripts/system.scm (verbosity-level): Change the default
from 2 to 3 when building a system.
2021-04-11 22:13:17 -04:00
Maxim Cournoyer
83f8b6d32c
import: go: Append version to symbol name in the pinned version mode.
This allows importing packages with complicated version specific dependency
chains without the package symbol names colliding.

* doc/guix.texi (Invoking guix import): Document the --pin-versions option.
Mention that a specific version can be imported.  Remove the experimental
warning.
* guix/import/go.scm (go-module->guix-package-name)[version]: Add optional
argument.  Rewrite the character translation in terms of string-map.
(go-module->guix-package): Conditionally use dependencies whose symbol include
their version, based no the value of the PIN-VERSIONS? argument.
* guix/import/utils.scm (package->definition): Add a new case where the full
version string is appended to the package symbol.
* guix/scripts/import.scm (guix-import): Correctly print forms starting
with '(define-public [...]'.
* guix/scripts/import/go.scm (guix-import-go): Conditionally include the
version in the package symbols defined.
2021-04-09 23:02:37 -04:00
Maxim Cournoyer
a8b927a562
import: go: Add an option to use pinned versions.
The ability to pin versions is handy when having to deal to packages that
bootstrap themselves through a chain of former versions.  Not using pinned
versions in these case could introduce dependency cycles.

* guix/build-system/go.scm (guix)
(%go-version-rx): Rename to...
(%go-pseudo-version-rx): ... this.  Simplify the regular expression, which in
turns makes it more robust.
* guix/build-system/go.scm (go-version->git-ref): Adjust following the above
rename.
(go-pseudo-version?): New predicate.
(go-module-latest-version): Rename to ...
(go-module-version-string): ... this.  Rename goproxy-url argument to just
goproxy.  Add a VERSION keyword argument, update docstring and adjust to have
it used.
(go-module-available-versions): New procedure.
(%go.mod-require-directive-rx): Document regexp.
(parse-go.mod): Harmonize the way dependencies are recorded to a list of lists
rather than a list of pairs, as done for other importers.  Rewrite to directly pass
multiple values rather than a record object.  Filter the replaced modules in a
functional style.
(go-module->guix-package): Add docstring.
[version, pin-versions?]: New arguments.  Rename the GOPROXY-URL argument to
GOPROXY.  Adjust to the new returned value of fetch-go.mod, which is a string.
Fail when the provided version doesn't exist.  Return a list dependencies and
their versions when in pinned versions mode, else just the dependencies.
(go-module-recursive-import)[version, pin-versions?]: New arguments.
Honor the new arguments and guard against network errors.
* guix/scripts/import/go.scm (%default-options): Register a default value for
the goproxy argument.
(show-help): Document that a version can be specified.  Remove the --version
argument and add a --pin-versions argument.
(%options)[version]: Remove option.
[pin-versions]: Add option.
(guix-import-go): Adjust so the version provided from the module name is
honored, along the new pin-versions? argument.
* tests/go.scm: Adjust and add new tests.
2021-04-09 22:41:32 -04:00
Ludovic Courtès
2d73086262
daemon: 'guix substitute' replies on FD 4.
This avoids the situation where error messages would unintentionally go
to stderr and be wrongfully interpreted as a reply by the daemon.

Fixes <https://bugs.gnu.org/46362>.
This is a followup to ee3226e9d54891c7e696912245e4904435be191c.

* guix/scripts/substitute.scm (display-narinfo-data): Add 'port'
parameter and honor it.
(process-query): Likewise.
(process-substitution): Likewise.
(%error-to-file-descriptor-4?, with-redirected-error-port): Remove.
(%reply-file-descriptor): New variable.
(guix-substitute): Remove use of 'with-redirected-error-port'.  Define
'reply-port' and pass it to 'process-query' and 'process-substitution'.
* nix/libstore/build.cc (SubstitutionGoal::handleChildOutput): Swap
'builderOut' and 'fromAgent'.
* nix/libstore/local-store.cc (LocalStore::getLineFromSubstituter):
Likewise.
* tests/substitute.scm <top level>: Set '%reply-file-descriptor'
rather than '%error-to-file-descriptor-4?'.
2021-04-09 17:46:38 +02:00
zimoun
4056ba3645
scripts: show: Replace 'args-fold*' by 'parse-command-line'.
* guix/scripts/show.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-01 14:58:55 +02:00
zimoun
0fac33a8ea
scripts: search: Replace 'args-fold*' by 'parse-command-line'.
* guix/scripts/search.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-01 14:58:55 +02:00
zimoun
f1bf6d3dbd
scripts: repl: Replace 'args-fold*' by 'parse-command-line'.
* guix/scripts/repl.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-01 14:58:54 +02:00
zimoun
ec3090e0c2
scripts: publish: Replace 'args-fold*' by 'parse-command-line'.
* guix/scripts/publish.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-01 14:58:54 +02:00
zimoun
f4070b153d
scripts: edit: Replace 'args-fold*' by 'parse-command-line'.
* guix/scripts/edit.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-01 14:58:54 +02:00
zimoun
d8382d1ef6
scripts: download: Replace 'args-fold*' by 'parse-command-line'.
* guix/scripts/download.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-01 14:58:54 +02:00
zimoun
8e4ca1b1d0
scripts: discover: Replace 'args-fold*' by 'parse-command-line'.
* guix/scripts/discover.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-01 14:58:54 +02:00
zimoun
946f563d91
scripts: describe: Replace 'args-fold*' by 'parse-command-line'.
* guix/scripts/describe.scm (define-command): Replace 'args-fold*' by
'parse-command-line'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-01 14:58:54 +02:00
Ludovic Courtès
8f9052d543
scripts: Scripts that defaulted to -v2 now default to -v3.
This is a followup to e45ef9a648c155c35b51e6b15049a1bd5416f0a1.

* guix/scripts/archive.scm (%default-options): Change 'verbosity' to 3.
* guix/scripts/build.scm (%default-options): Likewise.
* guix/scripts/copy.scm (%default-options): Likewise.
2021-03-31 16:08:05 +02:00
Ludovic Courtès
1fa4aff1fb
substitute: Emit a single newline upon completion.
The immediate effect is that, with '--verbosity=1', only two lines are
displayed for each substitute, instead of two lines followed by an empty
line.

* guix/scripts/substitute.scm (process-substitution): Emit a single
newline upon completion when PRINT-BUILD-TRACE? is true.
2021-03-31 15:57:46 +02:00
zimoun
55c25ee4c5
scripts: import: cran: Add missing help for 'style' option.
* guix/scripts/import/cran.scm (show-help): Add help message for 'style'
option.

Signed-off-by: Christopher Baines <mail@cbaines.net>
2021-03-29 19:53:50 +01:00
Mathieu Othacehe
e733f66b5b
Fix substitutes server discovery.
This is a follow-up of bc3896db25c788c181c7bcd65754e7cd378e9d9f.

* guix/scripts/substitute.scm (%local-substitute-urls): Test for "true"
instead of "yes".
2021-03-29 16:57:10 +02:00
Ludovic Courtès
9da5ec7099
substitute: Choose compression method based on past CPU usage.
This stems from the observation that substitute download can be
CPU-bound when high-speed networks are in use:

  https://lists.gnu.org/archive/html/guix-devel/2020-12/msg00177.html

* guix/narinfo.scm (decompresses-faster?): New procedure.
(narinfo-best-uri): Add #:fast-decompression?.
* guix/scripts/substitute.scm (%prefer-fast-decompression?): New
variable.
(call-with-cpu-usage-monitoring): New procedure.
(with-cpu-usage-monitoring): New macro.
(display-narinfo-data, process-substitution): Pass #:fast-decompression?
to 'narinfo-best-uri'.
(process-substitution): Wrap 'restore-file' call in
'with-cpu-usage-monitoring'.  Set '%prefer-fast-decompression?'.
2021-03-21 23:41:01 +01:00
Ludovic Courtès
065d832fc2
guix package: Autoload Guile-JSON and (guix describe).
* guix/scripts/build.scm: Autoload (guix import json).
* guix/scripts/package.scm: Autoload (guix import json) and (guix
describe).
2021-03-19 13:23:27 +01:00
Ludovic Courtès
4f04155232
guix describe: Autoload Guile-JSON.
* guix/scripts/describe.scm: Autoload (json).
2021-03-19 13:23:27 +01:00
Christopher Baines
806125e52f
weather: Only show request statistics when requests were made.
This avoids the script crashing if all data is fetched from the cache.

* guix/scripts/weather.scm (report-server-coverage): Only show request
statistics when some requests have been made.
2021-03-17 23:12:31 +00:00
Christopher Baines
c37f78a9f5
scripts: weather: Provide more representative request statistics.
Previously, the "seconds per request" and "requests per second" statistics
really reported (cache lookups + requests) per second.  By looking at the
actual number of requests made within lookup-narinfos, a more representative
value can be reported.

* guix/scripts/weather.scm (let/time): Allow for multiple return values.
(report-server-coverage): Alter the reporting of request statistics.
2021-03-17 20:46:21 +00:00
Christopher Baines
b48204259a
scripts: substitute: Tweak error reporting in process-substitution.
The call-with-connection-error-handling was added in
20c08a8a45d0f137ead7c05e720456b2aea44402, but that error handling was
previously inside of open-connection-for-uri/maybe, which is related
to (call-)with-cached-connection which was used in process-substitution, but
only actually used with call-with-cached-connection when used in
fetch-narinfos.

There's some handling for similar errors within with-networking, which is used
within process-substitution.

* guix/scripts/substitute.scm (process-substitution): Remove
call-with-connection-error-handling call.
2021-03-17 20:41:13 +00:00
Christopher Baines
c37e3b92ad
scripts: substitute: Add back some error handling.
In f50f5751fff4cfc6d5abba9681054569694b7a5c, the way fetch was called within
process-substitution was changed.  As call-with-cached-connection actually
includes important error handling for the opening of a HTTP request, this
change removed some error handling.  This commit adds that back.

Fixes <https://bugs.gnu.org/47157>.

* guix/scripts/substitute.scm (call-with-cached-connection): New procedure.
(with-cached-connection): New syntax rule.
(process-substitution): Retry once for some errors when making HTTP requests
to fetch substitutes.
2021-03-17 20:41:10 +00:00
zimoun
f1c4df15c3
time-machine: Fail when unrecognized option.
* guix/scripts/time-machine (parse-args): Fail when unrecognized option.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2021-03-11 23:19:53 +01:00
Katherine Cox-Buday
02e2e093e8
import: Add Go importer.
This patch adds a 'guix import go' command.

* doc/guix.texi (Requirements): Mention Guile-Lib dependency.
(Invoking guix import): Document 'guix import go'.
* gnu/packages/package-management.scm (guix)[inputs, propagated-inputs]:
Add GUILE-LIB.
* guix/self.scm (compiled-guix)[guile-lib]: New variable.
[dependencies]: Add it.
(specification->package): Add "guile-lib".
* guix/build-system/go.scm (go-version->git-ref): New procedure.
* guix/import/go.scm, guix/scripts/import/go.scm, tests/go.scm: New files.
* guix/scripts/import.scm: Declare subcommand guix import go
* po/guix/POTFILES.in: Add 'guix/scripts/import/go.scm'.
* Makefile.am (MODULES): Add 'guix/import/go.scm' and
'guix/scripts/import/go.scm'.
(SCM_TESTS): Add 'tests/go.scm'.

Co-Authored-By: Helio Machado <0x2b3bfa0@gmail.com>
Co-Authored-By: Francois Joulaud <francois.joulaud@radiofrance.com>
Co-Authored-By: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Co-Authored-by: Ludovic Courtès <ludo@gnu.org>
2021-03-10 18:01:48 +01:00
Mathieu Othacehe
8898eaec57
Revert "inferior: Break cached-channel-instance into two procedures."
This reverts commit 7d63b775513e7049047222dbe403a4181f63828d because it raises
some concerns, see:
https://lists.gnu.org/archive/html/guix-devel/2021-03/msg00124.html.
2021-03-10 13:08:32 +01:00
Mathieu Othacehe
7d63b77551
inferior: Break cached-channel-instance into two procedures.
Break cached-channel-instance into two different procedures:
channels->cached-profile and instances->cached-profile operating respectively
on channels and channels instances.

* guix/inferior.scm (cached-channel-instance): Rename it into ...
(cached-profile): ... this new procedure.
(channels->cached-profile, instances->cached-profile): New procedures.
* guix/scripts/time-machine.scm (guix-time-machine): Adapt accordingly.
2021-03-10 08:49:48 +01:00
Christopher Baines
f5ffb3bd9c
weather: Call lookup-narinfos with a custom progress reporter.
This means there's a useful progress bar when running guix weather.

* guix/scripts/weather.scm (report-server-coverage): Pass
 #:make-progress-reporter to lookup-narinfos.
2021-03-09 20:19:36 +00:00
Christopher Baines
fd5b77503e
guix: substitutes: Make progress reporting configurable.
Rather than always outputting to (current-error-port) in
lookup-narinfos (which is called from within lookup-narinfos/diverse), take a
procedure which should return a progress reporter, and defer any output to
that.

As this is now general purpose code, make the default behaviour to output
nothing. Maintain the current behaviour of the substitute script by moving the
progress reporter implementation there, and passing it in when calling
lookup-narinfos/diverse.

These changes should be generally useful, but I'm particularly looking at
getting guix weather to do progress reporting differently, with this new
flexibility.

* guix/substitutes.scm (fetch-narinfos): Take a procedure to make a
progress-reporter, and use that rather than the hardcoded behaviour.
(lookup-narinfos): Add #:make-progress-reporter keyword argument, and pass
this through to fetch-narinfos.
(lookup-narinfos/diverse): Add a #:make-progress-reporter keyword argument,
and pass this through to lookup-narinfos.
* guix/scripts/substitute.scm (process-query): Pass a progress-reporter to
lookup-narinfos/diverse.
2021-03-09 20:19:33 +00:00
Brice Waegeneire
236a882942
scripts: system: Activate system when switching generations.
Fixes <https://bugs.gnu.org/38884>.

* guix/scripts/system.scm (switch-to-system-generation): Load the
activate script for that generation.

squash! scripts: system: Activate system when switching generations.
2021-03-09 06:56:17 +01:00
Christopher Baines
112692c0d5
guix: Split (guix substitutes) from (guix scripts substitute).
This means there's a module for working with substitutes, rather than all the
code sitting in the script. The need for this can be seen with the weather and
challenge scripts, that now don't have to use code from the substitute script,
but can instead use the substitute module.

The separation here between the actual functionality of the substitute script
and the underlying functionality used both there and elsewhere should make
maintenance easier moving forward.

This commit just moves code, none of the code should have been changed
significantly.

* guix/scripts/substitute.scm (%narinfo-cache-directory, %narinfo-ttl,
%narinfo-negative-ttl, %narinfo-transient-error-ttl, %unreachable-hosts): Move
variables to guix/substitutes.scm.
(narinfo-cache-file, cached-narinfo, cache-narinfo!, narinfo-request,
read-to-eof, call-with-connection-error-handling, fetch-narinfos,
lookup-narinfos, lookup-narinfos/diverse): Move procedures to
guix/substitutes.scm.
* guix/substitutes.scm: New file.
* Makefile.am: Add it.
* guix/narinfo.scm: Remove redundant module.
* guix/scripts/challenge.scm: Change (guix scripts substitute) to (guix
substitutes).
* guix/scripts/weather.scm: Change (guix scripts substitute) to (guix
substitutes).
2021-03-05 21:06:03 +00:00
Tobias Geerinckx-Rice
d0f4283c44
pull: Expand help text for --{url,commit,branch}.
* guix/scripts/pull.scm (show-help): Document that ‘--url’, ‘--commit’,
and ‘--branch’ affect only the ‘guix’ channel (for now?).
2021-03-05 19:07:31 +01:00
Ludovic Courtès
90ea8b16eb
profiles: 'package->manifest-entry' preserves transformations by default.
Previously, transformations applied from a manifest (rather than via
"guix install") would be lost.  This change fixes that and simplifies
things.

Reported by zimoun at
<https://lists.gnu.org/archive/html/guix-devel/2021-02/msg00153.html>.

* guix/profiles.scm (default-properties): New procedure.
(package->manifest-entry): Use it for #:properties.
* guix/scripts/pack.scm (guix-pack)[with-transformations]: Remove.
Remove caller.
* guix/scripts/package.scm (transaction-upgrade-entry): Remove calls to
'manifest-entry-with-transformations'.
* tests/guix-package.sh: Add test.
* tests/transformations.scm ("options->transformation + package->manifest-entry"):
New test.
2021-03-05 12:49:27 +01:00
Ludovic Courtès
9ce78f27a0
environment: Allow compilation with Guile 2.2.
Fixes <https://bugs.gnu.org/46826>.
Reported by cage <cage-dev@twistfold.it>.

* guix/scripts/environment.scm (guix-environment): Move 'manifest'
definition before expression.
2021-03-01 17:45:50 +01:00
Ludovic Courtès
ee3226e9d5
substitute: Ensure backtraces go to file descriptor 4.
Fixes <https://bugs.gnu.org/46362>.
Reported by Zhu Zihao <all_but_last@163.com>.

Previously, backtraces due to uncaught exceptions would always to go
file descriptor 2; the daemon would read it and error out with something
like:

  error: got unexpected path `Backtrace:' from substituter

This patch fixes that by ensuring backtraces are properly displayed on
file descriptor 4.

* guix/scripts/substitute.scm (with-redirected-error-port): New macro.
(guix-substitute): Use 'with-redirected-error-port' instead of 'parameterize'.
2021-02-24 23:44:10 +01:00
Ludovic Courtès
e2572aa950
substitute: Do not unwind stack traces upon uncaught exceptions.
This is similar to commit a168c3e4f8d580f70e1c26bcdfc5b8378b2fa42d.

* guix/scripts/substitute.scm (with-networking): Use
'with-throw-handler' instead of 'catch'.
2021-02-24 23:44:10 +01:00
Christopher Baines
20c08a8a45
substitute: Rework connection error handling.
This is part of trying to reduce the interdependency of code within the
substitute module.

This commit addresses some of the error handling that was performed through
open-connection-for-uri/maybe. The new approach is to use
call-with-connection-error-handling, and wrap calls to http-multiple-get and
http-fetch with that procedure, which takes care of handling connection
errors.

I think this is even slightly more rigerous than the previous setup, because
this approach handles connection errors that occur when http-multiple-get
reconnects to a host.

* guix/scripts/substitute.scm (open-connection-for-uri/maybe): Transform in to
call-with-connection-error-handling.
(fetch-narinfos): Use call-with-connection-error-handling.
(process-query): Replace open-connection-for-uri/maybe with
open-connection-for-uri/cached.
(open-connection-for-uri/cached): Set a default timeout, matching the
behaviour in open-connection-for-uri/maybe.
(process-substitution): Use call-with-connection-error-handling.
2021-02-22 20:43:12 +00:00
Christopher Baines
187e970968
substitute: Remove fetch-narinfos use open-connection-for-uri/maybe.
At least by default.  Instead, make the open-connection procedure a parameter,
and make the default guix:open-connection-for-uri.  Do so similarly for
lookup-narinfos and lookup-narinfos/diverse which work towards calling
fetch-narinfos.

This means this code can be moved to a different module, without having
use/move the connection caching code.

* guix/scripts/substitute.scm (fetch-narinfos): Add #:open-connection
argument, and call http-multiple-get with it.
(lookup-narinfos) Add #:open-connection argument, and call fetch-narinfos with
it.
(lookup-narinfos/diverse): Add #:open-connection argument, and call
lookup-narinfos with it.
(process-query): Call lookup-narinfos/diverse with #:open-connection
open-connection-for-uri/maybe.
2021-02-22 20:43:12 +00:00
Christopher Baines
8116cc6673
substitute: Inline fetch in to process-substitutes.
As it's only called in one place, and this should make the code easier to
read.

* guix/scripts/substitute.scm (fetch): Move procedure inside…
(process-substitution): …here.
2021-02-22 20:43:11 +00:00
Christopher Baines
b9d058e3f7
substitute: Remove redundant fetch arguments.
It's just called in one place, with hardcoded argument values, so just inline
them.

* guix/scripts/substitute.scm (fetch): Remove arguments that don't vary, copy
the values from the call site in process-substitution.
(process-substitution): Remove unnecessary argument values from fetch call.
2021-02-22 20:43:11 +00:00
Christopher Baines
7c85877fdf
substitute: Remove now redundant connection caching helpers.
Failures now should be handled where they occur, and if there's a problem
that's symptomatic of an issue with the connection, the port should be closed.

* guix/scripts/substitute.scm (call-with-cached-connection): Remove procedure.
(with-cached-connection): Remove syntax rule.
2021-02-22 20:43:11 +00:00
Christopher Baines
f50f5751ff
substitute: Change connection cache handling in process-substitution.
Just pass open-connection-for-uri/maybe to http-fetch, this removes the need
for with-cached-connection and passing the port in.

* guix/scripts/substitute.scm (fetch): Don't take a port as an argument, and
pass open-connection-for-uri/maybe to http-fetch.
(process-substitution): Don't call fetch with with-cached-connection.
2021-02-22 20:43:11 +00:00
Christopher Baines
7b812f7c84
substitute: Stop using call-with-cached-connection in fetch-narinfos.
Instead, just pass open-connection-for-uri/maybe to http-multiple-get. This
code should be functionaly similar to the previous code. The eventual aim of
this is to make the connection caching not mandatory in fetch-narinfos.

* guix/scripts/substitute.scm (fetch-narinfos): Remove use of
call-with-cached-connection.
2021-02-22 20:43:10 +00:00
Christopher Baines
f50b501a74
substitute: open-connection-for-uri/maybe add #:verify-certificate?.
As this is used by http-fetch and http-multiple-get when they call the
specified open connection procedure.

* guix/scripts/substitute.scm (open-connection-for-uri/maybe): Support
 #:verify-certificate?.
2021-02-22 20:43:10 +00:00
Christopher Baines
e2e853ddb0
guix: Move http-multiple-get to (guix http-client).
From (guix scripts substitute). This will make it easier to reuse this code.

* guix/scripts/substitute.scm (http-multiple-get): Remove, and move to…
* guix/http-client.scm (http-multiple-get): …here.
2021-02-22 20:43:09 +00:00