Commit Graph

5735 Commits

Author SHA1 Message Date
Ludovic Courtès 15b6c2a965
http-client: Remove exception mishandling in 'http-multiple-get'.
Partly fixes <https://bugs.gnu.org/47867>.
Reported by Florian Pelz <pelzflorian@pelzflorian.de>.

The non-tail recursive call to 'connect' could cause requests to be
processed twice, with 'p' possibly closed the second time.

Regression introduced in 205833b72c and
carried over in 45fce38fb0.

* guix/http-client.scm (http-multiple-get): Remove call to 'close-port'
and recursive call to 'connect' when the 'write-request' block returns #f.
2021-04-25 14:36:45 +02:00
Ludovic Courtès 69ffe875c3
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-25 14:36:40 +02:00
Ludovic Courtès ff74e2a1bc
cve: Gracefully handle bogus CVE entries.
Fixes <https://bugs.gnu.org/47941>.
Reported by Jack Hill <jackhill@jackhill.us>.

* guix/cve.scm (reference-data->cve-references): Gracefully handle lack
of "reference_data".
(cpe-match->cve-configuration): Gracefully handle lack of "cpe23Uri".
2021-04-25 14:35:42 +02:00
Ludovic Courtès c59cc2383d
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-25 14:34:09 +02:00
Ludovic Courtès 68a4ca148b
import: go: Autoload (htmlprag).
Fixes <https://bugs.gnu.org/47924>.
Reported by Carl Dong <contact@carldong.me>.

* guix/import/go.scm: Autoload (htmlprag).
2021-04-23 23:39:34 -04:00
Ludovic Courtès 9406bb12ee
import: go: Do not set '%strict-tokenizer?' from the top level.
This avoids interference with other users of (htmlprag) and makes the
intent clearer.

* guix/import/go.scm <top level>: Remove call to '%strict-tokenizer?'.
(go-package-licenses, go-package-description)
(go-package-synopsis, fetch-module-meta-data): Pass #:strict? #t to
'html->sxml'.
2021-04-23 23:39:34 -04:00
Xinglu Chen c68070e4ee
lint: Warn about underscores in package names.
As per section '16.4.2 Package Naming' in the manual, use hyphens
instead of underscores in package names.

* guix/lint.scm (check-name): Check whether the package name contains
underscores.
* tests/lint.scm ("name: use underscore in package name"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-16 23:25:23 +02:00
Ludovic Courtès 5b35c9adc8
git-download: Call 'libgit2-init!'.
Fixes <https://bugs.gnu.org/47797>.
Reported by Ingo Ruhnke <grumbel@gmail.com>
and Nicolò Balzarotti <anothersms@gmail.com>.

Regression introduced in c1940fde43.

* guix/git-download.scm (git-predicate): Add call to 'libgit2-init!'.
2021-04-16 23:25:23 +02:00
Mark H Weaver 1bab9b9f17
grafts: Support rewriting UTF-16 and UTF-32 store references.
Partially fixes <https://bugs.gnu.org/33848>.

* guix/build/graft.scm (replace-store-references): Add support for
finding and rewriting UTF-16 and UTF-32 store references.
* tests/grafts.scm: Add tests.
2021-04-15 03:22:55 -04:00
Ludovic Courtès fab8ab7617
git: Honor proxy settings when fetching submodules.
Fixes <https://bugs.gnu.org/44593>.

* guix/git.scm (update-submodules): Add #:fetch-options and honor it.
(update-cached-checkout): Pass #:fetch-options to 'update-submodules'.
* doc/guix.texi (Requirements): Adjust comment about Guile-Git.
2021-04-14 22:51:38 +02:00
Ludovic Courtès a514b4ab19
channels: Build user channels with '-O1'.
This should noticeably speed up compilation for channels with many files.

* guix/channels.scm (standard-module-derivation)[build]: Define
'optimizations-for-level' and '-O1'.  Pass #:optimization-options to
'compile-files'.
2021-04-12 18:44:09 +02:00
Ludovic Courtès b18f45c21f
Add (guix ipfs).
This module allows for communicating with the IPFS
gateway over the HTTP interface.  The commit has been
cherry-picked from <https://issues.guix.gnu.org/33899>.

The procedures for adding and restoring file trees have
been removed as according to a reply issue 33899, a different
format will be used.  The procedure 'add-data' has been
exported as it will be used in the system test for IPFS.

* guix/ipfs.scm: New file.
* Makefile.am (MODULES): Add it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-12 18:42:22 +02:00
Mark H Weaver e18e2e458f
scripts: system: Default to -v3 when building a system.
This is a followup to 8f9052d543.

* 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
Kyle Meyer cb41c15827
git: Update cached checkout to the remote HEAD by default.
Fixes <https://bugs.gnu.org/45187>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

update-cached-checkout hard codes "master" as the default branch, leading to a
failure when the clone doesn't have a "master" branch.  Instead use the remote
HEAD symref as an indicator of what the primary branch is.

* guix/git.scm (resolve-reference): Support resolving symrefs.
(update-cached-checkout, latest-repository-commit): Change the default for REF
to the empty list and translate it to the remote HEAD symref.
(<git-checkout>): Change branch field's default to #f.
(git-checkout-compiler): When branch and commit fields are both #f, call
latest-repository-commit* with the empty list as the ref.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-10 22:59:52 +02:00
Maxim Cournoyer fed28a9632
build-system/qt: Fix wrapping with QTWEBENGINEPROCESS_PATH.
This is a follow up commit to 06eb21856f, which added QTWEBENGINEPROCESS_PATH
to the list of wrapped variables.  Unfortunately it wouldn't be set, as its
value is a plain file rather than a directory, and the code only checked for
directories.

* guix/build/qt-build-system.scm (variables-for-wrapping): Define a file type
entry for each variable definition, and use it to determine if we should look
for directories versus plain files.
2021-04-10 00:55:18 -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
Maxim Cournoyer 6aee902eaf
import: go: Improve synopsis and description parsing.
* guix/import/go.scm (%strict-tokenizer?): Set parameter to #t.
(go-path-escape): Redefine to prevent inlining.
(http-get*): Replace by ...
(http-fetch*): this ...
(json-fetch*): New procedure.
(go.pkg.dev-info): Use http-fetch*.
(go-package-licenses): Rewrite in terms of go.pkg.dev-info.
(go-package-description): Likewise.
(go-package-synopsis): Likewise.
(fetch-go.mod): Use the memoized http-fetch*.
(parse-go.mod): Adjust to receive content as a string.
(fetch-module-meta-data): Adjust to use http-fetch*.
(go-module->guix-package): Adjust to the modified fetch-go.mod return value.
[inputs]: Use propagated inputs, which is the most common situations for Go
libraries.
[description]: Beautify description.
[licenses]: Do no check for #f.  The result of the license parsing is always a
list.
* tests/go.scm: Adjust following above changes.
2021-04-09 22:41:31 -04:00
Maxim Cournoyer 2446a112df
import: utils: Refactor maybe-inputs and add maybe-propagated-inputs.
* guix/import/utils.scm (maybe-inputs)[type]: New argument.  Update docstring.
The argument is used to derive the input field name to use.
(maybe-native-inputs): Adjust to use the above.
(maybe-propagated-inputs): New procedure.
2021-04-09 22:41:31 -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 ee3226e9d5.

* 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
Ludovic Courtès 06eb21856f
build-system/qt: Wrappers set 'QTWEBENGINEPROCESS_PATH' if needed.
Suggested by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

* guix/build/qt-build-system.scm (variables-for-wrapping): Add
"QTWEBENGINEPROCESS_PATH".
2021-04-08 23:27:55 +02:00
Ludovic Courtès c5fd1b0bd3
build-system/qt: Wrappers only include relevant directories to XDG_DATA_DIRS.
Fixes <https://bugs.gnu.org/47569>.

Previously the wrapper's XDG_DATA_DIRS would contain any input that had
a /share sub-directory, which is usually all build-time inputs.

* guix/build/qt-build-system.scm (variables-for-wrapping)[collect-sub-dirs]:
Add 'selectors' parameter and honor it.  Change caller to handle
selectors.  Add selectors for /share.
2021-04-08 23:27:41 +02:00
Ludovic Courtès eb6ac483a5
gnu-maintenance: 'sourceforge' updater reuses the same connection.
* guix/gnu-maintenance.scm (latest-sourceforge-release): Call
'open-socket-for-uri' upfront.  Pass #:port and #:keep-alive? to
'http-head'.  Wrap body in 'dynamic-wind' and call 'close-port' upon
exit.
2021-04-08 23:27:41 +02:00
Ludovic Courtès 709f30b8e4
lint: refresh: Warn about missing or dysfunctional updaters.
This feedback should help us improve updaters.

* guix/lint.scm (check-for-updates): Return a warning when PACKAGE lacks
an updater or when the updater returns #f.
2021-04-06 23:59:46 +02:00
Ludovic Courtès 35ca3cfbcf
upstream: 'package-latest-release' tries all the matching updaters.
* guix/upstream.scm (package-latest-release): Try UPDATERS until one of
them returns an upstream source.  This is useful for packages with
several matching updaters, such a zlib ('sourceforge' and
'generic-html').
2021-04-06 23:59:46 +02:00
Ludovic Courtès b92cfc322d
gnu-maintenance: Add 'sourceforge' updater.
This updater currently covers 2.4% of the packages.

* guix/gnu-maintenance.scm (latest-sourceforge-release): New procedure.
(%sourceforge-updater): New variable.
* doc/guix.texi (Invoking guix refresh): Document it.
2021-04-06 23:59:46 +02:00
Ludovic Courtès ceeea60bbc
gnu-maintenance: Recognize more source tarball naming schemes.
* guix/gnu-maintenance.scm (%package-name-rx): Add ".src" and ".orig"
suffixes.
* tests/gnu-maintenance.scm ("release-file?"): Add mpg321 and bvi
examples.
("tarball->version"): New test.
2021-04-05 12:03:09 +02:00
Ludovic Courtès 6f32e27e97
utils: 'tarball-sans-extension' recognizes ".tgz".
* guix/utils.scm (tarball-sans-extension): Add ".tgz".
2021-04-05 12:03:09 +02:00
Ludovic Courtès e917027d1f
gnu-maintenance: Remove unused procedure.
* guix/gnu-maintenance.scm (savannah-package?): Remove.
2021-04-05 12:03:08 +02:00
Ludovic Courtès b3679f2d10
gnu-maintenance: 'generic-html' updates packages with the right property.
* guix/gnu-maintenance.scm (html-updatable-package?): Return true for
packages with a 'release-monitoring-url' property.  This allows us to
cater for packages with source fetched over, say, FTP, but with an HTML
page to monitor.
2021-04-05 12:03:08 +02:00
Xinglu Chen 426ade6c8b
import: go: Replace underscores with hyphens in package names.
As per section '16.4.2 Package Naming' in the manual, use hypens instead
of underscores in package names.

* guix/import/go.scm (go-module->guix-package-name): Replace underscores
with hyphens.

Signed-off-by: Leo Famulari <leo@famulari.name>
2021-04-04 13:42:43 -04:00
Ludovic Courtès 973b8af725
git: Remove unused variables.
This is a followup to 298f9d29d6, which
left those variables despite being unnecessary.

* guix/git.scm (clone*, update-cached-checkout): Remove unused
'auth-method' variable.
2021-04-02 23:22:14 +02:00
Jelle Licht f6c43c932a
gnu: Add node-lts.
* gnu/packages/node.scm (node-lts): New variable.
* guix/build-system/node.scm (default-node): Use it.
2021-04-02 18:04:24 +02:00
Jelle Licht 23ea84cdf0
build-system: Rewrite node build system.
* guix/build/node-build-system.scm: Rewrite it.
* guix/build-system/node.scm: Adjust accordingly.
* gnu/packages/node-xyz.scm (node-semver): Likewise.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2021-04-02 18:04:22 +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
Tobias Geerinckx-Rice via Bug reports for GNU Guix 1126bb9cf3
lint: Warn about single-character package names.
A common-sense exception is made for R.

* guix/lint.scm (check-name): New procedure.
(%local-checkers): Add it.
2021-04-01 14:35:59 +02:00
Ludovic Courtès 8f9052d543
scripts: Scripts that defaulted to -v2 now default to -v3.
This is a followup to e45ef9a648.

* 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 e45ef9a648
status: Don't display download URLs for '--verbosity=1'.
With this change, each substitute occupies a single line of
output (instead of two) when using '-v1', the default for 'guix package'
& co.

* guix/status.scm (print-build-event): Add #:print-urls? and honor it.
(print-build-event/quiet): Pass #:print-urls? #f.
(print-build-event/quiet-with-urls): New procedure.
(logger-for-level): Add case for LEVEL 2.
* doc/guix.texi (Common Build Options): Adjust '--verbosity'
documentation.
2021-03-31 15:57:46 +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
Ludovic Courtès 1575da6062
gnu-maintenance: Recognize "-source" tarball suffix.
Fixes <https://bugs.gnu.org/47398>.
Reported by Léo Le Bouter <lle-bout@zaclys.net>.

* guix/gnu-maintenance.scm (%tarball-rx): Add "-[Ss]ource" suffix.
* tests/gnu-maintenance.scm ("release-file?"): Add exiv2 example.
2021-03-29 23:33:40 +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 bc3896db25.

* guix/scripts/substitute.scm (%local-substitute-urls): Test for "true"
instead of "yes".
2021-03-29 16:57:10 +02:00
Ludovic Courtès 19c6ea9ca4
gexp: 'gexp->script' uses #:guile also as the guile-for-build.
Previously 'gexp->script' would unconditionally use the
default #:guile-for-build value of 'gexp->derivation'.

* guix/gexp.scm (gexp->script): Pass #:guile to 'load-path-expression'.
Pass #:guile-for-build to 'gexp->derivation'.
2021-03-29 16:47:23 +02:00