Commit Graph

5322 Commits

Author SHA1 Message Date
Ludovic Courtès 6701f64f73
guix build: Move package transformation options behind '--help-transform'.
This change declutters the '--help' output.

* guix/scripts/build.scm (show-build-options-help)
(%standard-build-options): Add '--help-transform'.
(show-transformation-options-help): Make private.
(show-help): Remove call to 'show-transformation-options-help'.
* guix/scripts/build.scm (show-help): Likewise.
* guix/scripts/environment.scm (show-help): Likewise.
* guix/scripts/graph.scm (show-help): Likewise.
* guix/scripts/install.scm (show-help): Likewise.
* guix/scripts/pack.scm (show-help): Likewise.
* guix/scripts/package.scm (show-help): Likewise.
* guix/scripts/upgrade.scm (show-help): Likewise.
* doc/guix.texi (Package Transformation Options): Mention '--help-transform'.
2020-10-20 16:30:16 +02:00
Ludovic Courtès 6aeda81602
guix build: Add '--with-debug-info'.
* guix/scripts/build.scm (transform-package-with-debug-info): New
procedure.
(%transformations): Add 'with-debug-info'.
(%transformation-options, show-transformation-options-help): Add
'--with-debug-info'.
* tests/scripts-build.scm ("options->transformation, with-debug-info"):
New test.
* doc/guix.texi (Package Transformation Options): Document
'--with-debug-info'.
(Installing Debugging Files): Introduce sections.  Remove bit about
eventual "opt-out" since this is not happening.  Document
'--with-debug-info' under "Rebuilding with Debugging Info".
2020-10-20 16:30:16 +02:00
Ludovic Courtès ccf3dcba3d
tests: Do not fetch and print the random seed from the top level.
* guix/tests.scm (%seed): Turn into a memoizing procedure.
(random-text, random-bytevector): Adjust accordingly.
2020-10-20 16:30:16 +02:00
Ludovic Courtès f59ec1de94
graph: Fix typo in docstring.
* guix/graph.scm (shortest-path): Fix typo in docstring.
2020-10-20 16:30:16 +02:00
Ludovic Courtès 8db4ebb0cd
packages: Better preserve object identity when rewriting.
Fixes a bug whereby the presence of propagated inputs could lead to two
non-eq? but actually equal packages in a bag's inputs.  The problem
would manifest itself when running, for instance:

  guix build inkscape -d --with-graft=glib=glib-networking --no-grafts

The resulting derivation would differ due from that without
'--with-graft'.  This was due to the fact that glib propagates libffi;
this instance of libffi was not rewritten even though other instances in
the graph were rewritten.  Thus, glib would end up with two non-eq?
libffi instances, which in turn would lead to duplicate entries in its
'%build-inputs' variable.

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

* guix/packages.scm (package-mapping)[rewrite]: Remove call to 'cut?'
and call 'replace' unconditionally.
[replace]: Add 'cut?' case.
* tests/guix-build.sh: Add test combining '--no-grafts' and
'--with-graft'.
* tests/packages.scm ("package-input-rewriting/spec, identity")
("package-input-rewriting, identity"): New tests.
2020-10-20 16:30:15 +02:00
Ludovic Courtès d154462bd8
download: Update docstring.
* guix/download.scm (url-fetch): Update docstring to match what's in the
manual.
2020-10-20 16:30:15 +02:00
Christopher Baines c949530b6f
import: crate: make-crate-sexp: Fix missing home-page handling.
* guix/import/crate.scm (make-crate-sexp): Replace 'null rather than '() with
the empty string for the home-page.
2020-10-19 18:48:33 +01:00
Helio Machado a9105c2c4c
import: print: Fix deprecation warning for origin-sha256.
* guix/import/print.scm (source->code source version): Replace
'origin-sha256' by 'origin-hash' and handle non-SHA256 hashes.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2020-10-19 13:28:38 +02:00
Miguel Ángel Arruga Vivas eaf0963983
system: Provide locale information to the bootloader.
* gnu/machine/ssh.scm (roll-back-managed-host): Use locale information
from boot-parameters.
* gnu/system.scm (operating-system-bootcfg): Provide locale information
to the bootloader.
* guix/system/script.scm (reinstall-bootloader): Use locale information
from boot-parameters.
2020-10-18 15:33:05 +02:00
Ludovic Courtès 6be7146130
gexp: 'assume-valid-file-name' has files looked up under the CWD.
Fixes a bug introduced in 5d4ad8e1be,
whereby files enclosed in 'assume-valid-file-name' would be looked up
relative to the source directory instead of relative to the current
directory.

* guix/gexp.scm (local-file): In the 'assume-valid-file-name' case, look
up FILE relative to the current working directory.
2020-10-18 00:21:33 +02:00
Helio Machado f045a7a926
import: utils: Fix license name mismatches and define CUA-OPL-1.0.
* guix/licenses.scm (cua-opl1.0): New variable.
* guix/import/utils.scm (spdx-string->license): Rename licenses to fit
the internal names and add a notice pointing to guix/licenses.scm.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-10-17 22:40:18 +02:00
Ludovic Courtès 5d4ad8e1be
gexp: Add 'assume-valid-file-name' syntax for use with 'local-file'.
* guix/gexp.scm (assume-valid-file-name): New variable.
(local-file): Add clause with (assume-valid-file-name file).
2020-10-16 15:00:50 +02:00
Ludovic Courtès 5ef1508942
ui: Only suggest modules that export the unbound variable identifier.
Fixes <https://bugs.gnu.org/43498>.
Reported by Tobias Geerinckx-Rice <me@tobias.gr>.

* guix/ui.scm (known-variable-definition): Check for variables in the
public interface of HEAD, not in HEAD itself.
* tests/guix-build.sh: Add test.
2020-10-15 18:50:22 +02:00
Efraim Flashner 6b793fa662
build-system/go: Install license files.
* guix/build/go-build-system.scm (install-license-files): New procedure.
(%standard-phases): Replace inherited 'install-license-files phase.
2020-10-15 11:13:25 +03:00
Ludovic Courtès 37a8f5b281
openpgp: '&openpgp-unrecognized-packet-error' includes type tag.
* guix/openpgp.scm (&openpgp-unrecognized-packet-error)[type]: New
field.
(get-data, parse-subpackets): Initialize 'type' field.
2020-10-14 15:22:55 +02:00
Marius Bakke 2323a7120a
gnu: nmap: Update license.
* guix/licenses.scm (nmap): Rename to ...
(npsl): ... this.  Adjust name and URL, and remove outdated Fedora wiki
entry in favor of nmap's own annotated version.
* gnu/packages/admin.scm (nmap)[license]: Adjust accordingly.
2020-10-13 23:36:43 +02:00
Ludovic Courtès abd7a47461
guix build: Add '--with-c-toolchain'.
* guix/scripts/build.scm (package-dependents/spec)
(package-toolchain-rewriting, transform-package-toolchain): New procedures.
(%transformations): Add it.
(%transformation-options, show-transformation-options-help): Add
'--with-c-toolchain'.
* tests/scripts-build.scm (depends-on-toolchain?): New procedure.
("options->transformation, with-c-toolchain")
("options->transformation, with-c-toolchain twice")
New test.
("options->transformation, with-c-toolchain, no effect"): New tests.
* doc/guix.texi (Package Transformation Options): Document it.
2020-10-12 18:23:47 +02:00
Ludovic Courtès 46135ce4ce
packages: Add 'package-with-c-toolchain'.
* guix/build-system.scm (build-system-with-c-toolchain): New procedure.
* guix/packages.scm (package-with-c-toolchain): New procedure.
* tests/packages.scm ("package-with-c-toolchain"): New test.
* doc/guix.texi (package Reference): Document 'package-with-c-toolchain'.
(Build Systems): Mention it.
2020-10-12 18:23:47 +02:00
Ludovic Courtès 099d709caf
substitute: Reduce default narinfo negative TTL to 1h.
* guix/scripts/substitute.scm (%narinfo-negative-ttl): Reduce to 1h.
2020-10-12 18:23:47 +02:00
Ludovic Courtès 75e72dd34e
upgrade: Mention '--do-not-upgrade' in '--help' output.
* guix/scripts/upgrade.scm (show-help): Add '--do-not-upgrade'.
2020-10-12 18:23:47 +02:00
Ludovic Courtès baa4a2ef81
lint: cve: Set a connection timeout.
This (notably) works around the fact that nvd.nist.gov is currently
inaccessible over IPv6.

* guix/cve.scm (fetch-vulnerabilities): Add #:timeout and pass it to
'http-fetch/cached'.
(current-vulnerabilities): Add #:timeout and pass it to
'fetch-vulnerabilities'.
* guix/lint.scm (current-vulnerabilities*): Pass #:timeout to
'current-vulnerabilities'.
2020-10-12 11:28:56 +02:00
Ludovic Courtès d11f7f62b6
http-client: 'http-fetch' and 'http-fetch/cached' accept #:timeout.
* guix/http-client.scm (http-fetch): Add #:timeout and pass it to
'guix:open-connection-for-uri'.
(http-fetch/cached): Add #:timeout parameter and pass it to
'http-fetch'.
2020-10-12 11:28:56 +02:00
Ludovic Courtès 6c46e477eb
channels: Address test failure.
Fixes <https://bugs.gnu.org/43940>.
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

The "channel-instances->manifest" test would fail since
1d4ab335b22a93e01c2eb1eb3e93fc6534157040: 'quiet-guile' would be passed #f
as GUILE, and thus 'package-version' would fail with wrong-type-arg.

* guix/channels.scm (whole-package-for-legacy): Pass #:guile to
'whole-package'.
* tests/channels.scm ("channel-instances->manifest"): Remove 'test-expect-fail'.
2020-10-12 11:28:56 +02:00
Ludovic Courtès cda046b3ea
reconfigure: Start services not currently running.
Fixes <https://bugs.gnu.org/43720>.
Reported by Andreas Enge <andreas@enge.fr>.

The bug was introduced in 5c793753b3,
which changed the way TO-START is computed: as a function of the running
services first, and then as a function of the live services (which
includes services not currently running).

* guix/scripts/system/reconfigure.scm (running-services): Serialize the
'running' field and return it.
(upgrade-shepherd-services): Comput RUNNING.  Compute TO-START as the
difference between TARGET-SERVICES and RUNNING.
2020-10-11 17:26:41 +02:00
Ludovic Courtès b55409b2c0
svn-download, hg-download: Use 'report-invoke-error'.
* guix/build/hg.scm (hg-fetch): Use 'report-invoke-error' instead of
'format'.
* guix/build/svn.scm (svn-fetch): Likewise.
2020-10-10 22:37:45 +02:00
Maxim Cournoyer efbf5fdd01
offload: Improve load normalization and configurability.
Fixes <https://issues.guix.gnu.org/43773>.

The computed normalized load was previously obtained by dividing the load
average as found in /proc/loadavg by the number of parallel builds defined for
a build machine.

This normalized load didn't allow to compare machines with different number of
cores, as the load average reported by /proc/loadavg can be as high as the
number of cores; thus comparing that value to a fixed threshold of 2.0 would
mean machines with multiple cores were more likely to be flagged as overloaded
compared to single core machines.

This can be fixed by normalizing using the available number of cores instead
of the number of parallel jobs.

* guix/scripts/offload.scm (<build-machine>)[overload-threshold]: New field.
(node-load): Modify to return a normalized load value between 0 and 1, taking
into account the number of cores available.
(normalized-load): Remove procedure.
(report-load): New procedure.
(choose-build-machine): Adjust to use the modified 'node-load' and the new
'report-load' and 'build-machine-overload-threshold' procedures.
(check-machine-status): Adjust.
* doc/guix.texi (Daemon Offload Setup): Document the offload scheduler and the
new 'overload-threshold' field.
2020-10-08 10:57:12 -04:00
zimoun db9e4af0ea
build: svn: Fix handle fetch errors.
This fixes the revert 1ec67d5220.

* guix/build/svn.scm (svn-fetch): Add 'guard' to handle errors.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2020-10-08 12:38:43 +02:00
Paul Garlick 1ec67d5220
Revert "build: svn: Handle fetch errors."
This reverts commit 2fb12dd1bb, which
causes the 'svn export' command to fail with:

svn: E155000: Destination directory exists; please remove the directory
or use --force to overwrite
2020-10-06 14:47:57 +01:00
zimoun 2fb12dd1bb
build: svn: Handle fetch errors.
* guix/build/svn.scm (svn-fetch): Add 'guard' to handle errors.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2020-10-06 10:24:38 +02:00
zimoun a5a3f813c7
build: hg: Handle fetch errors.
* guix/build/hg.scm (hg-fetch): Add 'guard' to handle errors.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2020-10-06 10:24:37 +02:00
Efraim Flashner c1cc0c4865
build-system/cargo: Don't install .crates.toml file.
Fixes <https://issues.guix.gnu.org/43810>.

* guix/build/cargo-build-system.scm (install): Remove installed
.crates.toml file.
2020-10-06 10:37:34 +03:00
Ludovic Courtès 1d4ab335b2
self: Use a 'guile' that doesn't complain about locales.
Since commit ba48895899, selected UTF-8
locales are bundled.  However, because 'guix-command' is itself a Guile
script, users would still see Guile's warning, particularly on foreign
distros:

  $ LC_ALL=sdf guix foo
  guile: warning: failed to install locale
  hint: Consider installing the `glibc-utf8-locales' [...]

User commands would print that warning, but more importantly, each
invocation of 'guix substitute' would print it, even though
'guix-daemon.service' explicitly chooses "en_US.utf8", which is in
'glibc-utf8-locales'.  This leads to confusion since users would keep
seeing this message unless/until they realize they also need to install
'glibc-utf8-locales' in root's profile.

This patch gets rid of "guile: warning: ..." for a guix-pulled 'guix'
command.

* guix/self.scm (specification->package): Add "gcc-toolchain".
(quiet-guile): New procedure.
(guix-command): Use it.
* gnu/packages/aux-files/guile-launcher.c: New file.
* Makefile.am (AUX_FILES): Add it.
2020-10-05 23:19:19 +02:00
Ludovic Courtès b68d410651
environment: Turn "lo" up in network-less containers.
This is a followup to 0f53c801b9.

* guix/scripts/environment.scm (launch-environment/container): Add call
to 'set-network-interface-up'.
* tests/guix-environment-container.sh: Add test.
2020-10-05 10:41:59 +02:00
Ludovic Courtès 0f53c801b9
environment: Provide /etc/hosts in containers without '--network'.
Fixes <https://bugs.gnu.org/43762>.

* guix/scripts/environment.scm (launch-environment/container): Create
/etc/hosts when NETWORK? is false.
* tests/guix-environment-container.sh: Add "localhost" resolution test.
2020-10-02 23:28:09 +02:00
Ludovic Courtès 8e1907a724
guix package: Re-apply package transformation when upgrading.
* guix/scripts/package.scm (transaction-upgrade-entry)[upgrade]: Add
'transform' parameter.  Pass PKG through it.  Use
'manifest-entry-with-transformations'.
Call 'options->transformation' to get the transformation procedure.
* tests/guix-package.sh: Add 'guix package -u' test.
* tests/packages.scm ("transaction-upgrade-entry, transformation options preserved"):
New test.
* doc/guix.texi (Invoking guix package): Mention that transformations
are preserved across upgrades.
(Package Transformation Options): Likewise.
2020-10-02 23:28:09 +02:00
Ludovic Courtès ad54a73bb8
guix build: Record package transformations in manifest entries.
With this change, package transformation options used while building a
manifest are saved in the metadata of the manifest entries.

* guix/scripts/build.scm (transformation-procedure): New procedure.
(options->transformation)[applicable]: Use it.  Change to a list of
key/value/proc tuples instead of key/proc pairs.
[package-with-transformation-properties, tagged-object]: New
procedures.  Use them.
(package-transformations, manifest-entry-with-transformations): New
procedures.
* guix/scripts/pack.scm (guix-pack)[with-transformations]: New
procedure.
Use it.
* guix/scripts/package.scm (process-actions)[transform-entry]: Use it.
* tests/guix-package-aliases.sh: Add test.
2020-10-02 23:28:09 +02:00
Mathieu Othacehe bdbd8bf905
scripts: system: Honor target argument.
Since 313f492657 the target argument passed to
"guix system" was not honored for 'disk-image' command.

This forces the command line passed "target" to take precedence over the
"target" field of the <image> record returned by "os->image" procedure.

* guix/scripts/system.scm (system-derivation-for-action): Override the
"target" field of the "image" record using the "target" argument from the
command line.
2020-10-02 10:03:29 +02:00
Ludovic Courtès 9471aea76a
gexp: Fix argument ordering in 'local-file' macro.
Fixes a regression introduced in
f43ffee908.
Reported by jonsger on #guix.

* guix/gexp.scm (local-file): In the non-literal case, add #:literal?
and #:location after REST.
2020-10-02 09:29:26 +02:00
Ludovic Courtès dc749a0e91
ui: Use "guix install" in locale hint.
* guix/ui.scm (install-locale): Change "guix package -i" to "guix install".
2020-10-02 08:11:38 +02:00
Ludovic Courtès f43ffee908
gexp: 'local-file' warns when passed a non-literal relative file name.
Fixes <https://bugs.gnu.org/43736>.
Reported by Vitaliy Shatrov <guix.vits@disroot.org>.

* guix/gexp.scm (%local-file): Add #:literal? and #:location.
Emit a warning when LITERAL? is false and FILE is not absolute.
(local-file): In the non-literal case, pass #:location and #:literal?.
* po/guix/POTFILES.in: Add guix/gexp.scm.
* tests/guix-system.sh: Add test for the warning.
2020-10-02 08:11:38 +02:00
Julien Lepiller a6816618fc
import: opam: Report groups in syntax tree.
* guix/import/opam.scm (group-pat): Report in syntax tree.
(dependency->input, dependency->native-input, dependency->name):
consider the case of a group.
2020-10-02 00:43:41 +02:00
Julien Lepiller f4390d391b
guix: opam: Fix syntax.
* guix/import/opam.scm (STRCHR, comment, choice): Fix syntax.
(group-pat): Add syntax.
(opam->guix-package): Suppport "archive" keyword.
2020-10-01 21:43:29 +02:00
Ludovic Courtès 7dc19c33fc
ui: "guix help" silently ignores EPIPE.
This avoids a backtrace when running "guix help | head" or similar.

* guix/ui.scm (run-guix): Wrap 'show-guix-help' calls in
'leave-on-EPIPE'.
2020-10-01 12:45:38 +02:00
Ludovic Courtès 58abd58739
pack: Work around ld.so bug that affects the "fakechroot" engine.
Fixes <https://bugs.gnu.org/43491>.

* guix/scripts/pack.scm (wrapped-package): Use (runpath program) instead
of (runpath #$(audit-module)).
2020-10-01 12:45:38 +02:00
Mathieu Othacehe 313f492657
scripts: system: Add support for image-type.
* guix/scripts/system.scm (list-image-types): New procedure,
(%options): add "image-type" and "list-image-types" options, remove
"file-system-type" option,
(show-help): adapt accordingly,
(%default-options): also adapt, and set the default "image-type" to "raw",
(perform-action): add image-type argument and remove file-system-type argument,
(process-action):  adapt perform-action call,
(system-derivation-for-action): remove base-image
argument, add image-type argument, and use it to create the image passed to
"system-image".
* tests/guix-system.sh: Adapt accordingly and add a test for
"--list-image-types" command.
* doc/guix.texi (Building the Installation Image,
Invoking guix system): Adapt accordingly.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2020-09-30 10:47:59 +02:00
Lars-Dominik Braun 680b80e374
openpgp: Fix argument order of 'fxbit-set?'.
* guix/openpgp.scm (fxbit-set?): Change to swap arguments compared to
'bit-set?'.
* tests/openpgp.scm (%binary-sample): New test vector.
("port-ascii-armored?, #t"): Add test.
("port-ascii-armored?, #f"): Add another test.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2020-09-29 22:53:36 +02:00
Julien Lepiller e75443d4f2
guix build: Add a hint for unspecified value.
* guix/scripts/build.scm (options->things-to-build): Add a hint when we
cannot build something.
2020-09-29 15:15:25 +02:00
Ludovic Courtès 8819551c8d
packages: 'package-input-rewriting' has a #:deep? parameter.
* guix/packages.scm (package-input-rewriting): Add #:deep? and pass it
to 'package-mapping'.
[replacement-property]: New variable.
[rewrite]: Check it.
[cut?]: New procedure.
* tests/packages.scm ("package-input-rewriting"): Pass #:deep? #f and
ensure implicit inputs were not rewritten.  Avoid 'eq?' comparisons.
("package-input-rewriting, deep"): New test.
* gnu/packages/guile.scm (package-for-guile-2.0, package-for-guile-3.0):
Pass #:deep? #f.
2020-09-27 21:41:15 +02:00
Ludovic Courtès b3fc03ee26
packages: 'package-mapping' correctly recurses into 'replacement'.
Previously, something like:

  guix build glib --with-graft=glibc=glibc@2.29

would produce a result showing that rewriting rules were not applied to
libx11@1.6.A (a replacement).

* guix/packages.scm (package-mapping): Call REPLACE instead of PROC to
'replacement'.
* tests/packages.scm ("package-input-rewriting/spec, graft"): New test.
2020-09-27 21:41:11 +02:00
Ludovic Courtès 2bf6f962b9
packages: 'package-input-rewriting/spec' can rewrite implicit dependencies.
With this change, '--with-input', '--with-graft', etc. also apply to
implicit dependencies.  Thus, it's now possible to do:

  guix build python-itsdangerous --with-input=python-wrapper=python@2

or:

  guix build hello --with-graft=glibc=glibc@2.29

Additionally, before, implicit inputs were not rewritten, which could
lead to duplicates in the output of 'bag-transitive-inputs' (packages
that are not 'eq?' but lead to the same derivation).  This in turn would
lead to unnecessary rebuilds when using '--with-input' & co.  This
change fixes it by ensuring even implicit inputs are rewritten.

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

* guix/packages.scm (package-input-rewriting/spec): Add #:deep?
defaulting to #true, and pass it to 'package-mapping'.
[replacement-property]: New variable.
[rewrite]: Check that property and set it on the result of PROC.
[cut?]: New procedure.
* tests/packages.scm ("package-input-rewriting/spec"): Ensure implicit
inputs were unchanged.
("package-input-rewriting/spec, partial match"): Pass #:deep? #f.
("package-input-rewriting/spec, deep")
("package-input-rewriting/spec, no duplicates"): New tests.
(package/inherit): Move before use.
* tests/guix-build.sh: Add tests.
* tests/scripts-build.scm ("options->transformation, with-graft"):
Compare dependencies by package name or derivation file name.
* doc/guix.texi (Defining Packages): Adjust accordingly.
2020-09-27 21:41:08 +02:00