Commit graph

5449 commits

Author SHA1 Message Date
Roel Janssen 0a79b24506
import: cran: Update the Bioconductor version to 3.12.
* guix/import/cran.scm (%bioconductor-version): Set to 3.12.
* guix/build-system/r.scm (bioconductor-uri):  Update to 3.12.
2020-12-09 12:12:19 +01:00
Ludovic Courtès 799f066768
import: opam: Adjust test to latest 'opam->guix-package' changes.
This is a followup to a8dccd4bdc, which
broke the test.

* guix/import/opam.scm (get-opam-repository): Prevent inlining.
* tests/opam.scm ("opam->guix-package"): Mock 'get-opam-repository'.
2020-12-08 22:58:37 +01:00
Ludovic Courtès 5ff521452b
substitute: Cache and reuse connections while substituting.
That way, when fetching a series of substitutes from the same server(s),
the connection is reused instead of being closed/opened for each
substitutes, which saves on network round trips and TLS handshakes.

* guix/http-client.scm (http-fetch): Add #:keep-alive? and honor it.
* guix/progress.scm (progress-report-port): Add #:close? parameter and
honor it.
* guix/scripts/substitute.scm (at-most): Return the tail as a second
value.
(fetch): Add #:port and #:keep-alive? and honor them.
(%max-cached-connections): New variable.
(open-connection-for-uri/cached, call-with-cached-connection): New
procedures.
(with-cached-connection): New macro.
(process-substitution): Wrap 'fetch' call in 'with-cached-connection'.
Pass #:close? to 'progress-report-port'.
2020-12-08 22:30:08 +01:00
Ludovic Courtès 711df9ef3c
daemon: Run 'guix substitute --substitute' as an agent.
This avoids spawning one substitute process per substitution.

* nix/libstore/build.cc (class Worker)[substituter]: New field.
[outPipe, logPipe, pid]: Remove.
(class SubstitutionGoal)[expectedHashStr, status, substituter]: New fields.
(SubstitutionGoal::timedOut): Adjust to check 'substituter'.
(SubstitutionGoal::tryToRun): Remove references to 'outPipe' and
'logPipe'.  Run "guix substitute --substitute" as an 'Agent'.  Send the
request with 'writeLine'.
(SubstitutionGoal::finished): Likewise.
(SubstitutionGoal::handleChildOutput): Change to fill in
'expectedHashStr' and 'status'.
(SubstitutionGoal::handleEOF): Call 'wakeUp' unconditionally.
(SubstitutionGoal::~SubstitutionGoal): Adjust to check 'substituter'.
* guix/scripts/substitute.scm (process-substitution): Write "success\n"
to stdout upon success.
(%error-to-file-descriptor-4?): New variable.
(guix-substitute): Set 'current-error-port' to file descriptor 4
unless (%error-to-file-descriptor-4?) is false.
Remove "--substitute" arguments.  Loop reading line from stdin.
* tests/substitute.scm <top level>: Call '%error-to-file-descriptor-4?'.
(request-substitution): New procedure.
("substitute, no signature")
("substitute, invalid hash")
("substitute, unauthorized key")
("substitute, authorized key")
("substitute, unauthorized narinfo comes first")
("substitute, unsigned narinfo comes first")
("substitute, first narinfo is unsigned and has wrong hash")
("substitute, first narinfo is unsigned and has wrong refs")
("substitute, two invalid narinfos")
("substitute, narinfo with several URLs"): Adjust to new "guix
substitute --substitute" calling convention.
2020-12-08 22:30:08 +01:00
Ludovic Courtès 79c6614f58
daemon: Use 'Agent' to spawn 'guix substitute --query'.
* nix/libstore/local-store.hh (RunningSubstituter): Remove.
(LocalStore)[runningSubstituter]: Change to unique_ptr<Agent>.
[setSubstituterEnv, didSetSubstituterEnv]: Remove.
[getLineFromSubstituter, getIntLineFromSubstituter]: Take an 'Agent'.
* nix/libstore/local-store.cc (LocalStore::~LocalStore): Remove
reference to 'runningSubstituter'.
(LocalStore::setSubstituterEnv, LocalStore::startSubstituter): Remove.
(LocalStore::getLineFromSubstituter): Adjust to 'run' being an 'Agent'.
(LocalStore::querySubstitutablePaths): Spawn substituter agent if
needed.  Adjust to 'Agent' interface.
(LocalStore::querySubstitutablePathInfos): Likewise.
* nix/libstore/build.cc (SubstitutionGoal::tryToRun): Remove call to
'setSubstituterEnv' and add 'setenv' call for "_NIX_OPTIONS" instead.
(SubstitutionGoal::finished): Remove 'readLine' call for 'dummy'.
* guix/scripts/substitute.scm (%allow-unauthenticated-substitutes?):
Remove second argument to 'make-parameter'.
(process-query): Call 'warn-about-missing-authentication'
when (%allow-unauthenticated-substitutes?) is #t.
(guix-substitute): Wrap body in 'parameterize'.  Set 'guix-warning-port'
too.  No longer exit when 'substitute-urls' returns the empty list.  No
longer print newline initially.
* tests/substitute.scm (test-quit): Parameterize 'current-error-port' to
account for the port changes in 'guix-substitute'.
2020-12-08 22:30:08 +01:00
Ludovic Courtès e9edaf3639
database: Remove unnecessary module imports.
* guix/store/database.scm: Remove unnecessary imports added in
4b9eecd322.
2020-12-08 21:40:05 +01:00
Julien Lepiller ccc4d287b7
guix: opam: Add coq support in the importer.
* guix/import/opam.scm (get-opam-repository): Add support for coq
repositories.
(ocaml-name->guix-name): Properly name coq package.
* doc/guix.texi (Invoking guix import): Document it.
2020-12-08 16:53:07 +01:00
Julien Lepiller a8dccd4bdc
guix: opam: Add --repo argument to importer.
* guix/scripts/import/opam.scm (guix-import-opam): Pass --repo argument
to recursive and non-recursive importers.
* guix/import/opam.scm (get-opam-repository): Select proper repository
location depending on a new repo argument.
(opam->guix-package): Use get-opam-repository in the procedure body.
2020-12-08 16:47:22 +01:00
Julien Lepiller 15ee1b8317
guix: opam: Pass default repository to recursive importer.
* guix/import/opam.scm (opam->guix-package): Rename #:repository key
to #:repo.
(opam-recursive-import): Pass #:repo keyword.
* tests/opam.scm (opam->guix-package): Rename #:repository to #:repo.
2020-12-08 16:40:30 +01:00
Julien Lepiller 59873d94ce
guix: opam: Filter implicit inputs.
* guix/import/opam.scm (opam->guix-package, depends->inputs): Filter out
implicit inputs.
2020-12-08 16:40:19 +01:00
Julien Lepiller 4e110f61ac
guix: opam: Remove stray `pk'.
* guix/import/opam.scm (opam->guix-package): Remove stray `pk'.
2020-12-08 16:40:04 +01:00
Mathieu Othacehe 1d229a34b7
ci: Add "evaluation" method.
* guix/ci.scm (evaluation): New procedure.
2020-12-07 16:15:55 +01:00
Mathieu Othacehe 9087af0323
ci: Add evaluation field to build record.
* guix/ci.scm (<build>): Add "evaluation" field.
2020-12-07 16:15:55 +01:00
Leo Prikler 07340cbebc
profiles: Delete duplicate manifest entries in packages->manifest.
* gnu/profiles.scm (packages->manifest): Delete duplicate entries.
* tests/profiles.scm ("packages->manifest, no duplicates"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-12-07 12:48:26 +01:00
Leo Prikler f5d952c5f5
profiles: Remove duplicates in manifest transactions.
Fixes <https://bugs.gnu.org/23874>.
Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>.

* guix/profiles.scm (manifest-transaction-effects): Delete duplicates in
install and remove.  Let multiple upgrades and downgrades shadow previous
transactions of the same kind.
* tests/profiles.scm
("manifest-transaction-effects no double install or upgrades")
("manifest-transaction-effects no double downgrade")
("manifest-transaction-effects no double removal"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-12-07 12:48:25 +01:00
Tobias Geerinckx-Rice a81258c124
ui: Handle multiword and empty $PAGER values.
* guix/ui.scm (call-with-paginated-output-port): Empty PAGER values
disable paging.  Non-empty ones are split into command arguments.

Reported by Daniel Brooks <db48x@db48x.net>.
2020-12-05 16:47:59 +01:00
Tobias Geerinckx-Rice 4d0b61a1f6
pull: Accept no non-option arguments.
* guix/scripts/pull.scm (guix-pull): LEAVE if any non-option arguments
were passed.
2020-12-05 16:47:59 +01:00
Mathieu Othacehe c952a9312a
scripts: discover: Check for cache file existence.
Fixes: https://issues.guix.gnu.org/45045.

* guix/scripts/discover.scm (read-substitute-urls): Check for file existence.
2020-12-05 10:38:52 +01:00
Ludovic Courtès cde3a69a37
git: 'reference-available?' handles short commit IDs.
Reported by Simon Tournier on #guix.

Until now 'reference-available?' would always return #f when passed a
short commit ID.

* guix/git.scm (reference-available?): Call 'object-lookup-prefix' when
COMMIT is shorter than 40 characters.
2020-12-04 23:45:09 +01:00
Ludovic Courtès e3065ec117
import: crate: Skip tests when Guile-Semver is missing.
* guix/import/crate.scm: Add comment for the 'module-autoload!' calls.
* tests/crate.scm (have-guile-semver?): New variable.
("crate->guix-package", "cargo-recursive-import")
("cargo-recursive-import-hoors-existing-packages"): Skip when
HAVE-GUILE-SEMVER? is false.
2020-12-04 16:59:26 +01:00
Mathieu Othacehe 79fd9f4026
scripts: substitute: Fix discover option.
The discover option can be unset or set to "yes/no". Handle both cases.

* guix/scripts/substitute.scm (%local-substitute-urls): Fix discover option.
2020-12-04 14:45:26 +01:00
Ricardo Wurmus 2bbe6b300e
import/cran: Do not attempt to generate definitions for failed imports.
* guix/scripts/import/cran.scm (guix-import-cran): Remove failed imports from
list of packages to define.
2020-12-04 12:28:53 +01:00
Ricardo Wurmus a689c85af4
import/cran: Fix calls to CRAN->GUIX-PACKAGE.
* guix/import/cran.scm (cran->guix-package, latest-bioconductor-release):
Invoke CRAN->GUIX-PACKAGE with #:REPO keyword argument.
2020-12-04 12:27:29 +01:00
raingloom 64f032d73f
build-system: Add chicken-build-system.
* guix/build-system/chicken.scm: New file.
* guix/build/chicken-build-system.scm: New file.
* Makefile.am: Add them.
* doc/guix.texi: Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-12-03 16:18:33 +01:00
Ludovic Courtès fbb380a088
self: Factorize package dependency enumeration.
* guix/self.scm (transitive-package-dependencies): New procedure.
(compiled-guix)[dependencies]: Use it.
2020-12-03 14:34:26 +01:00
Ludovic Courtès 720e87fe91
gnu: guile-semver: Switch to Guile 3.0.
* gnu/packages/guile-xyz.scm (guile-semver)[inputs]: Use GUILE-3.0.
(guile3.0-semver): Define in terms of 'deprecated-package'.
(guile2.2-semver): New variable.
2020-12-03 13:48:53 +01:00
Hartmut Goebel 054e308f5d
import: crate: Use existing package satisfying semver requirement.
If a package satisfying the dependency's semver requirement already exists,
use it. Prior to this change the highest version matching the semver
requirement was used (and imported in case it was not defined as package
already).

When resolving a dependency (now done in `sort-map-dependencies`), first
search for a package matching the semver requirement and only if this fails
reach out for a crate.

* guix/import/crate.scm (crate->guix-package)[find-package-version]: New
  function. [dependency-name+version]: New function.
  [sort-map-dependencies]: Use it instead of lambda function.

* tests/crate.scm (test-doctool-crate, test-doctool-dependencies): New
  variables.
  ("self-test …", "cargo-recursive-import-hoors-existing-packages"): New
  tests.
2020-12-02 22:09:23 +01:00
Hartmut Goebel 45584061a9
import: crate: Trim version for names after left-most non-zero part.
This complies to how versions are matched for caret requirements in crates:
An update is allowed if the new version number does not modify the left-most
non-zero digit in the major, minor, patch grouping.

* guix/import/crate.scm (version->semver-prefix): New function.
  (make-crate-sexp)[format-inputs]: Use it.
  (make-crate-sexp): Use it to pass shorter version to package->definition.
* guix/import/utils.scm (package->definition): Change optional parameter
  APPEND-VERSION? into APPEND-VERSION?/STRING. If it is a string, append its
  value to name.
* tests/crate.scm: Adjust tests accordingly.
2020-12-02 22:09:23 +01:00
Hartmut Goebel 9a48e35be8
import: utils: Trim patch version from names.
This remove the patch version from generated package names. For example
'rust-my-crate-1.1.2' now becomes 'rust-my-crate-1.1'.

* guix/import/utils.scm (package->definition): Trim patch version from
  generated package names.
* tests/crate.scm: (cargo>guix-package, cargo-recursive-import): Likewise.
2020-12-02 22:09:23 +01:00
Martin Becze 50fbb3f032
import: crate: Parameterized importing of dev dependencies.
The recursive crate importer will now include development dependencies only
for the top level package, but not for any of the recursively imported
packages.  Also #:skip-build will be false for the top-most package.

* guix/import/crate.scm (make-crate-sexp): Add the key BUILD?.
  (crate->guix-package): Add the key INCLUDE-DEV-DEPS?.
  (crate-recursive-import): Likewise.
* guix/scripts/import/crate.scm (guix-import-crate): Likewise.
* tests/crate.scm (cargo-recursive-import): Likewise.
2020-12-02 22:09:23 +01:00
Martin Becze d9feb23e10
import: crate: Memorize crate->guix-package.
This adds memorization to procedures that involve network lookups.
'lookup-crate*' is used on every dependency of a package to get its version
list. It is also used to lookup a package's metadata. 'crate-recursive-import'
is also memorized since creating the same package twice will trigger a lookup
on its dependencies.

* guix/import/crate.scm (lookup-crate*): New procedure.
  (crate->guix-package): Memorize package metadata lookups.
  (crate-recursive-import): Memorize package creation.
2020-12-02 22:09:23 +01:00
Martin Becze 269c1db41b
import: crate: Use guile-semver to resolve module versions.
* guix/import/crate.scm: Add guile-semver as a soft dependency.
  (make-crate-sexp): Don't allow other keys. Add '#:skip-build?' to build
  system args. Pass a VERSION argument to 'cargo-inputs'.
  (crate->guix-package): Use guile-semver to resolve the correct module
  versions. Treat "build" dependencies as normal dependencies.
  (crate-name->package-name): Reuse the procedure 'guix-name' instead of
  duplicating its logic.
* guix/import/utils.scm (package-names->package-inputs): Implement
  handling of (name version) pairs.
* guix/scripts/import/crate.scm (guix-import-crate): Use
  crate-recursive-import instead of duplicate code.
* tests/crate.scm (recursive-import): Change test packages versions to be
  distinguishable. Add version data to the test. Check created symbols, too.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
2020-12-02 22:09:23 +01:00
Martin Becze bea3b17739
import: utils: 'recursive-import' accepts an optional version parameter.
This adds a key VERSION to 'recursive-import' and moves the parameter REPO to
a key. This also changes all the places that rely on 'recursive-import'.

* guix/import/utils.scm (recursive-import): Add the VERSION key. Make REPO a
  key.
  (package->definition): Add optional 'append-version?'.
* guix/scripts/import/crate.scm (guix-import-crate): Add the VERSION key.
* guix/import/crate.scm (crate->guix-package): Add the VERSION key.
  (crate-recursive-import): Pass VERSION to recursive-import, remove now
  unnecessary code.
* guix/import/cran.scm (cran->guix-package, cran-recursive-import): Change the
  REPO parameter to a key.
* guix/import/elpa.scm (elpa->guix-package, elpa-recursive-import): Likewise.
* guix/import/gem.scm (gem->guix-package, recursive-import): Likewise.
* guix/import/opam.scm (opam-recurive-import): Likewise.
* guix/import/pypi.scm (pypi-recursive-import): Likewise.
* guix/import/stackage.scm (stackage-recursive-import): Likewise.
* guix/scripts/import/cran.scm (guix-import-cran): Likewise.
* guix/scripts/import/elpa.scm (guix-import-elpa): Likewise.
* tests/elpa.scm (eval-test-with-elpa): Likewise.
* tests/import-utils.scm (recursive-import): Likewise.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
2020-12-02 22:09:23 +01:00
Martin Becze 23e2cd156f
guix: self: Add guile-semver as a depenedency.
* guix/self.scm (compiled-guix): Add guile-semver as a depenedency.
2020-12-02 22:09:23 +01:00
zimoun 86971616c1
upgrade: Allow several regexps.
Fixes <https://bugs.gnu.org/44928>.
Reported by Luis Felipe <luis.felipe.la@protonmail.com>.

* guix/scripts/upgrade.scm (guix-upgrade): Allow several regexps and remove
"extraneous arguement" check.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2020-12-01 11:34:10 +01:00
John Soo 58be9e0bf1
processes: Add '--format' and the "normalized" format.
* guix/scripts/processes.scm (lock->recutils): New procedure.
(daemon-session->recutils): Use it.
(daemon-sessions->recutils, session-key->recutils)
(session-scalars->normalized-record)
(child-process->normalized-record)
(daemon-sessions->normalized-record): New procedures.
(session-rec-type, lock-rec-type, child-process-rec-type)
(%available-formats): New variables.
(list-formats): New procedure.
(%options, show-help): Add '--format'.
(%default-options): New variable.
(guix-processes): Use 'parse-command-line' instead of 'args-fold*'.
Honor the 'format' value in OPTIONS.
* doc/guix.texi (Invoking guix processes): Document '--format'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-11-29 23:55:57 +01:00
John Soo e1c81203ca
processes: Put ChildProcess and ChildPID on separate lines.
* guix/scripts/processes.scm (daemon-session->recutils): Put child
process information in separate fields.
* doc/guix.texi (Invoking guix processes): Document change in output of
'guix processes'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-11-29 23:55:57 +01:00
Mathieu Othacehe 35a32fefb4
Make "guile-avahi" dependency optional.
* configure.ac (HAVE_GUILE_AVAHI): New conditional.
* Makefile.am (MODULES): Add "guix/avahi.scm" and "guix/scripts/discover.scm"
if HAVE_GUILE_AVAHI is set.
* guix/scripts/publish.scm: Autoload (guix avahi).
* guix/scripts/substitute.scm: Autoload (guix scripts discovery).
2020-11-29 19:22:05 +01:00
Mathieu Othacehe 44068c7d30
self: Fix guile-avahi lookup.
This is a follow-up of 375cc7dea2.

* guix/self.scm (specification->package): Search for "guile-avahi" in (gnu
package guile-xyz).
2020-11-29 16:43:01 +01:00
Mathieu Othacehe 79f9dee3c4
Use substitute servers on the local network.
* guix/scripts/discover.scm: New file.
* Makefile.am (MODULES): Add it.
* nix/nix-daemon/guix-daemon.cc (options): Add "discover" option,
(parse-opt): parse it,
(main): start "guix discover" process when the option is set.
* guix/scripts/substitute.scm (%local-substitute-urls): New variable,
(substitute-urls): add it.
* gnu/services/base.scm (<guix-configuration>): Add "discover?"
field,
(guix-shepherd-service): honor it.
* doc/guix.texi (Invoking guix-daemon): Document "discover" option,
(Base Services): ditto.
2020-11-29 15:08:26 +01:00
Mathieu Othacehe 276e494b2a
publish: Add advertising support.
* guix/scripts/publish.scm (%options): Add "--advertise" option.
(show-help): Document it.
(service-name): New procedure,
(publish-service-type): new variable.
(run-publish-server): Add "advertise?" and "port" parameters. Use them to publish
the server using Avahi.
(guix-publish): Pass the "advertise?" option to "run-publish-server".
* gnu/services/base.scm (<guix-publish-configuration>): Add "advertise?"
field.
(guix-publish-shepherd-service): Honor it.
2020-11-29 15:08:26 +01:00
Mathieu Othacehe 375cc7dea2
Add Avahi support.
* guix/avahi.scm: New file.
* Makefile.am (MODULES): Add it.
* configure.ac: Add Guile-Avahi dependency.
* doc/guix.texi (Requirements): Document it.
* gnu/packages/package-management.scm (guix)[native-inputs]: Add
"guile-avahi",
[propagated-inputs]: ditto.
* guix/self.scm (specification->package): Add guile-avahi.
(compiled-guix): Ditto.
2020-11-29 15:08:26 +01:00
Marius Bakke 4dadb49779
Merge branch 'staging' 2020-11-28 22:39:12 +01:00
Zhu Zihao 16c7472b33
channels: Expose the default channel in %default-channel.
* guix/channels(%default-guix-channel): New variable taken from the inner of
%default-channels.

(%default-channels): Refactored.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-11-28 00:06:14 +01:00
Marius Bakke 24c86ad0c0
Merge branch 'master' into staging 2020-11-26 23:59:28 +01:00
Ludovic Courtès 5842239a66
deploy: Let key-and-args exceptions through.
Fixes <https://bugs.gnu.org/44825>.
Reported by Christopher Lemmer Webber <cwebber@dustycloud.org>.

* guix/ui.scm (guard*): Export.
* guix/scripts/deploy.scm (deploy-machine*): Use 'guard*' instead of
'guard'.  Add '&exception-with-kind-and-args' case.
2020-11-26 23:39:15 +01:00
Marius Bakke bff94a5a53
Merge branch 'master' into staging 2020-11-26 01:08:35 +01:00
zimoun c2cc5f0a00
weather: Fix '--substitute-urls'.
Fixes <https://bugs.gnu.org/44574>.
Reported by Efraim Flashner <efraim@flashner.co.il>.

* guix/scripts/weather.scm (guix-weather): Fix when substitute-urls
is a list.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2020-11-25 11:55:07 +01:00
Marius Bakke 87a027243f
Merge branch 'master' into staging 2020-11-23 23:39:47 +01:00
Mathieu Othacehe d9e57db724
store: Fix ensure-path docstring.
Suggested by Ludovic Courtès.

* guix/store.scm (ensure-path): Fix the docstring.
2020-11-23 14:10:34 +01:00