Commit Graph

1588 Commits

Author SHA1 Message Date
Ludovic Courtès 43f7fd8783
pull: Do not use '~*', which 'msgfmt' fails to interpret.
Fixes <https://bugs.gnu.org/37505>.
Reported by Konrad Hinsen <konrad.hinsen@fastmail.net>.

* guix/scripts/pull.scm (display-channel-news): Use ~a instead of ~*
when reporting new channels.
2019-10-01 10:50:24 +02:00
Ludovic Courtès a3af06ad65
offload: Include the port number in the machine lock file name.
This is useful when a single machine appears several time, with
different port numbers.

* guix/scripts/offload.scm (machine-slot-file): Add MACHINE's port to
the file name.
2019-09-28 22:56:40 +02:00
Marius Bakke e7f62a41b2
Merge branch 'master' into core-updates 2019-09-27 19:11:27 +02:00
Hartmut Goebel dec845606d
guix download: Ensure destination file-name is valid in the store.
Avoid invalid store-file-name by explicitly passing the destination
name, replacing any character not allowed in the store-file-name by an
underscore.

Fixes <http://issues.guix.gnu.org/issue/26175>

* guix/scripts/download.scm (safe-naensure-valid-store-file-nameme):
  New function. (download-to-store*): Use it to generate a "safe"
  basename of URL.
2019-09-26 17:48:08 +02:00
Ludovic Courtès 3972dc5d43
guix package: Add '--list-profiles'.
* guix/scripts/package.scm (show-help, %options): Add '--list-profiles'.
(process-query): Honor it.
* tests/guix-package.sh: Add test.
2019-09-26 11:43:26 +02:00
Ludovic Courtès d26c290b7d
pull: Dim the commit ID when displaying news.
* guix/scripts/pull.scm (display-news-entry): Dim the commit line.
2019-09-25 15:46:48 +02:00
Ludovic Courtès 11da634a6e
Merge branch 'master' into core-updates 2019-09-24 10:11:38 +02:00
Ludovic Courtès 7b3f56f5d7
pull: Use ~/.cache/guix/checkouts instead of ~/.cache/guix/pull.
Previously 'channel-news-for-commit' would use the former while 'guix
pull' would use the latter.  Consequently, the first 'guix pull -N'
would clone the repository anew.

* guix/scripts/pull.scm (guix-pull): Remove 'cache', and leave
%REPOSITORY-CACHE-DIRECTORY to its default value.
2019-09-23 23:41:19 +02:00
Ludovic Courtès 4f8c29a75c
show, search: Add '--load-path'.
* guix/scripts/search.scm (show-help, %options): Add -L/--load-path.
* guix/scripts/show.scm (show-help, %options): Add -L/--load-path.
2019-09-23 23:41:19 +02:00
Vagrant Cascadian 77c2eafbbb
scripts: container: Fix typo.
* guix/scripts/container/exec (show-help): Fix spelling of COMMAND.
2019-09-23 11:56:40 -07:00
Ludovic Courtès b69ce8a872
deploy: Add '--verbosity' and properly interpret build log.
This is a followup to 91300526b7.

* guix/scripts/deploy.scm (show-help, %options): Add '--verbosity'.
(guix-deploy): Wrap 'with-store' in 'with-status-verbosity'.
2019-09-23 11:57:39 +02:00
Ludovic Courtès dabdd7d465
pull: Display news titles directly upon 'pull'.
* guix/scripts/pull.scm (display-profile-news): Return true when there's
more to display.
(display-news-entry-title): New procedure.
(display-news-entry): Use it.
(display-channel-specific-news): Return true when there's more to
display.
(display-channel-news-headlines): New procedure.
(build-and-install): Call it.  When 'display-channel-news-headlines' or
'display-profile-news' returns #t, print a hint to run "pull --news".
(display-new/upgraded-packages): Return true when there's more to display.
2019-09-23 10:38:44 +02:00
Ludovic Courtès 192ee02aeb
pull: '-l' displays channel news.
* guix/scripts/pull.scm (display-channel-news): Make 'previous' a
parameter.
(process-query)[list-generations]: Call 'display-channel-news'.
2019-09-23 10:38:44 +02:00
Ludovic Courtès 7faffdc2d5
pull: Display channel news.
* guix/scripts/pull.scm (display-news-entry)
(display-channel-specific-news): New procedures.
(display-channel-news): Call it.
(display-new/upgraded-packages): Adjust hint message.
* doc/guix.texi (Invoking guix pull): Mention it.
2019-09-23 10:38:44 +02:00
Ludovic Courtès 961b95c985
pull: '--news' shows the list of channels added or removed.
* guix/scripts/pull.scm (display-channel, channel=?)
(display-channel-news, display-news): New procedures.
(process-query): Call 'display-news' instead of 'display-profile-news'.
2019-09-23 10:38:43 +02:00
Ludovic Courtès 660dbe6564
guix package: '--show' ignores deprecated packages.
* guix/scripts/package.scm (process-query) <'show>: Remove superseded
packages.
* tests/guix-package-aliases.sh: Add test.
2019-09-21 16:48:36 +02:00
zimoun aeb51370da
guix package: Add 'guix show' alias.
* guix/scripts/show.scm: New file.
* Makefile.am (MODULES): Add it.
* po/guix/POTFILES.in: Add it.
* tests/guix-package-aliases.sh: Add test.
* doc/guix.texi (Invoking guix package): Document it and use it in a example.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-09-21 16:48:36 +02:00
Konrad Hinsen da55110712
scripts: pull: Add options for generation management
* guix/scripts/pull.scm (%options) Add --roll-back, --switch-generation,
--delete-generations
(process-generation-change): New function
(guix-pull): Execute generation management operations

* doc/guix.texi: Document the generation management operations

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-09-18 23:08:29 +02:00
Ludovic Courtès ee25048e51
pull: Work around Ubuntu's 'sudo'.
Partly fixes <https://bugs.gnu.org/36785>.
Reported by Julien Lepiller <julien@lepiller.eu>.

* guix/scripts/pull.scm (ensure-default-profile): Do not call
'migrate-generations' when "SUDO_USER" is set.
2019-09-18 23:08:29 +02:00
Ludovic Courtès f9c0400392
guix package: "guix package -f FILE" ensures FILE returns a package.
* guix/scripts/package.scm (options->installable): Add clause for
'install option with a non-package object.
* tests/guix-package.sh: Add test.
2019-09-18 23:08:28 +02:00
Ludovic Courtès 9ff87bb996
Merge branch 'master' into core-updates 2019-09-17 16:27:15 +02:00
Ludovic Courtès 0074844366
pack: Provide a meaningful "repository name" for Docker.
Previously, images produced by 'guix pack -f docker' would always show
up as "profile" in the output of 'docker images'.  With this change,
'docker images' shows a name constructed from the packages found in the
image--e.g., "bash-coreutils-grep-sed".

* guix/docker.scm (canonicalize-repository-name): New procedure.
(generate-tag): Remove.
(manifest): Add optional 'tag' parameter and honor it.
(repositories): Likewise.
(build-docker-image): Add #:repository parameter and pass it to
'manifest' and 'repositories'.
* guix/scripts/pack.scm (docker-image)[build]: Compute 'tag' and pass it
as #:repository to 'build-docker-image'.
2019-09-16 10:25:31 +02:00
Ludovic Courtès 9bbaf2ae72
pack: Add packages in the order in which they appear on the command line.
* guix/scripts/pack.scm (guix-pack)[manifest-from-args](packages):
Reverse order of packages taken from OPTS.
2019-09-16 10:25:16 +02:00
Ludovic Courtès 5ccec77176
file-systems: Add /var/run/nscd to '%network-file-mappings'.
This allows containers created by "guix environment -CN" or by
"guix system container -N" to talk to the host nscd.

* gnu/system/file-systems.scm (%network-file-mappings): Add
"/var/run/nscd".
* gnu/build/shepherd.scm (default-mounts)[nscd-socket]: Remove.
* gnu/system/linux-container.scm (container-script)[nscd-run-directory]
[nscd-mapping, nscd-os, nscd-specs]: Remove.
[script]: Filter out from SPECS bind-mounts where the device does not
exist.
* guix/scripts/environment.scm (launch-environment/container)
[optional-mapping->fs]: New procedure.
[mappings]: Remove %NETWORK-FILE-MAPPINGS.
[file-systems]: Add %NETWORK-FILE-MAPPINGS here, filtered through
'optional-mapping->fs'.
2019-09-12 23:07:42 +02:00
Martin Becze fd63ecbe05
import: crate: Allow imports of a specific version.
* guix/import/crate.scm (crate->guix-package): Add optional 'version'
argument and honor it.
* guix/scripts/import/crate.scm (guix-import-crate): Assume the first
argument is a spec and destructure it with
'package-name->name+version'.  Pass both to 'crate->guix-package'.
* doc/guix.texi (Invoking guix import): Document it.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2019-09-10 00:34:40 +02:00
Ludovic Courtès 7c101c4c17
refresh: Distinguish between "no updater" and "failing updater".
Previously, something like "guix refresh texmacs" would report "no
updater".  Now, it reports that the 'gnu-ftp' updater failed to list
releases.

* guix/upstream.scm (lookup-updater): Use 'find' instead of 'any' to
return the <upstream-updater>.
(package-latest-release): Adjust accordingly.
* guix/scripts/refresh.scm (check-for-package-update): When
'package-latest-release' returns #f, distinguish between "no updater"
and "failing updater".
2019-09-10 00:34:40 +02:00
Ludovic Courtès 2e3e5d2198
daemon: Invoke 'guix gc --list-busy' instead of 'list-runtime-roots'.
* nix/scripts/list-runtime-roots.in: Remove.
* guix/store/roots.scm (%proc-directory): New variable.
(proc-file-roots, proc-exe-roots, proc-cwd-roots)
(proc-fd-roots, proc-maps-roots, proc-environ-roots)
(referenced-files, canonicalize-store-item, busy-store-items): New
procedures, taken from 'list-runtime-roots.in'.
* nix/libstore/globals.hh (Settings)[guixProgram]: New field.
* nix/libstore/globals.cc (Settings::processEnvironment): Initialize
'guixProgram'.
* nix/libstore/gc.cc (addAdditionalRoots): Drop code related to
'NIX_ROOT_FINDER'.  Run "guix gc --list-busy".
* nix/local.mk (nodist_pkglibexec_SCRIPTS): Remove
'scripts/list-runtime-roots'.
* config-daemon.ac: Don't output nix/scripts/list-runtime-roots.
* build-aux/pre-inst-env.in: Don't set 'NIX_ROOT_FINDER'.
Set 'GUIX'.
* doc/guix.texi (Invoking guix gc): Document '--list-busy'.
* guix/scripts/gc.scm (show-help, %options): Add "--list-busy".
(guix-gc)[list-busy]: New procedure.
Handle the 'list-busy' action.
2019-09-08 11:49:24 +02:00
Mark H Weaver 65542a8852
Merge branch 'master' into core-updates 2019-09-06 20:46:00 -04:00
Ludovic Courtès 91300526b7
deploy: Add missing store options.
* guix/scripts/deploy.scm (%default-options): Add missing options such
as 'print-build-trace?', etc.
2019-09-04 13:02:27 +02:00
Ludovic Courtès c3e59de9b1
guix system: Reinstalling the bootloader preserves extra menu entries.
Fixes <https://bugs.gnu.org/36876>.
Reported by Jesse Gibbons <jgibbons2357@gmail.com>.

Previously 'guix system delete-generations' or 'switch-generation' would
lose the extra bootloader menu entries specified in the current system's
configuration.  This fixes that.

* guix/scripts/system.scm (reinstall-bootloader): Turn PARAMS into a
single <boot-parameters>.  Adjust ENTRIES to include extra menu entries
specified in PARAMS.
2019-08-30 01:33:45 +02:00
Mark H Weaver 0481289cbc
Merge branch 'master' into core-updates 2019-08-29 17:19:18 -04:00
Ricardo Wurmus ad553ec4b1
import: cran: Add support for git repositories.
* guix/import/cran.scm (vcs-file?): New procedure.
(download): Support downloading from git.
(fetch-description): Add a clause for the 'git repository type.
(files-match-pattern?): New procedure.
(tarball-files-match-pattern?): Implement in terms of FILES-MATCH-PATTERN?.
(directory-needs-fortran?, directory-needs-zlib?,
directory-needs-pkg-config?): New procedures.
(needs-fortran?, needs-zlib?, needs-pkg-config?): Rename these procedures...
(tarball-needs-fortran?, tarball-needs-zlib?, tarball-needs-pkg-config?):
...to this, and use them.
(file-hash): New procedure.
(description->package): Handle the 'git repository type.
* guix/import/utils.scm (package->definition): Handle package expression
inside of a let.
* guix/scripts/import.scm (guix-import): Handle let expressions.
* doc/guix.texi (Invoking guix import): Document it.
2019-08-29 11:38:12 +02:00
Ricardo Wurmus 54ddd85220
import: cran: guix-import-cran: Use (guix import utils).
* guix/scripts/import/cran.scm (guix-import-cran): Use PACKAGE->DEFINITION
from (guix import utils) instead of custom procedure.
2019-08-29 08:06:54 +02:00
Ludovic Courtès dae950ca50
deploy: Do not quote error messages.
* guix/scripts/deploy.scm (guix-deploy): Do not quote the message.
2019-08-28 18:52:52 +02:00
Ludovic Courtès 8f67a76a54
lint: Log diagnostics with 'info', not 'warning'.
* guix/scripts/lint.scm (emit-warnings): Use 'info', not 'warning'.
This removes the unhelpful "warning:" prefix that commit
3d33c93cef introduced.
2019-08-28 18:52:51 +02:00
Ludovic Courtès 7979a287f8
pack: Create /tmp in Docker images.
Fixes <https://bugs.gnu.org/37161>.

* guix/scripts/pack.scm (docker-image)[build]: Add a 'directory' entry
for "/tmp" to DIRECTIVES.
* tests/pack.scm ("docker-image + localstatedir"): Test the presence of /tmp.
* gnu/tests/docker.scm (run-docker-test)["Load docker image and run
it"]: Test the presence and permission bits of "/tmp".
2019-08-27 12:20:44 +02:00
Ludovic Courtès 2b7c89f4fc
docker: Take a list of directives instead of a list of symlinks.
* guix/docker.scm (symlink-source, topmost-component): Remove.
(directive-file): New procedure.
(build-docker-image): Remove #:symlinks and add #:extra-files.
Make a sub-directory "extra" and call 'evaluate-populate-directive' for
EXTRA-FILES in that directory.
* guix/scripts/pack.scm (docker-image)[build](symlink->directives,
directives): New procedures.
Pass #:extra-files instead of #:symlinks to 'build-docker-image'.
2019-08-27 12:20:44 +02:00
Ludovic Courtès b908fcd8c0
pack: '-R' honors the requested output.
Fixes <https://bugs.gnu.org/36925>.
Reported by Jesse Gibbons <jgibbons2357@gmail.com>.

* guix/scripts/pack.scm (wrapped-package): Add 'output*' parameter.
[build]: Define 'input' and 'target'; use them instead of #$package and
 #$output, respectively.
(wrapped-manifest-entry): New procedure.
(map-manifest-entries): Call PROC directly.
(guix-pack): Pass WRAPPED-MANIFEST-ENTRY to 'map-manifest-entries'.
2019-08-23 18:41:49 +02:00
Mark H Weaver 893c2df00d
Merge branch 'master' into core-updates 2019-08-22 15:53:27 -04:00
Ludovic Courtès 4496ea74aa
refresh: Use the standard diagnostic procedures.
* guix/scripts/refresh.scm (warn-no-updater): Use 'warning' instead of
'format'.
(update-package): Use 'info' and 'warning' instead of 'format'.
2019-08-17 23:18:11 +02:00
Ludovic Courtès a7c714d398
channels: Add 'profile-channels'.
* guix/channels.scm (profile-channels): New procedure.
* guix/scripts/describe.scm (display-profile-info)[channels]: Define in
terms of 'profile-channels'.
2019-08-16 23:00:26 +02:00
Jakob L. Kreuze 9c70c460a0
machine: Implement 'roll-back-machine'.
* gnu/machine.scm (roll-back-machine, &deploy-error, deploy-error?)
(deploy-error-should-roll-back)
(deploy-error-captured-args): New variable.
* gnu/machine/ssh.scm (roll-back-managed-host): New variable.
* guix/scripts/deploy.scm (guix-deploy): Roll-back systems when a
deployment fails.
2019-08-15 07:43:09 -04:00
Jakob L. Kreuze 03cbd94d48
remote: Remove '--system' argument.
* gnu/services.scm (activation-script): Return a <program-file> rather
than a <scheme-file>.
* gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
(show-help): Remove documentation for '--system'.
(%default-options): Remove default setting for 'system'.
2019-08-14 15:38:13 -04:00
Marius Bakke 462ad9f56b
Merge branch 'master' into core-updates 2019-08-13 20:42:06 +02:00
Jakob L. Kreuze 55e238f2ab
deploy: Use all machine modules when loading deployment
* guix/scripts/deploy.scm (load-source-file): Enumerate and include all
submodules of (gnu machine) when loading the provided deployment
specification.
2019-08-07 16:05:58 -04:00
Jakob L. Kreuze 5f04e9f962
reconfigure: Fix GC root installation.
Fixes <https://bugs.gnu.org/36942>.
Reported by ison <ison@airmail.cc>.

guix/scripts/system/reconfigure.scm (install-bootloader-program): Switch
new symlink to the canonical bootloader configuration file.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2019-08-06 22:21:13 +02:00
Jakob L. Kreuze 1db6f137d9
reconfigure: Reload all shepherd files when upgrading services.
Fixes <https://bugs.gnu.org/36878>.
Reported by Robert Vollmert <rob@vllmrt.net>.

* guix/scripts/system/reconfigure.scm (upgrade-shepherd-services): Load
all service files, rather than just those of services to be started.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2019-08-02 11:20:51 +02:00
Marius Bakke 6a2e54236e
Merge branch 'master' into core-updates 2019-07-31 14:28:56 +02:00
Jakob L. Kreuze 5c8c8c4554
guix system: Reimplement 'reconfigure'.
* guix/scripts/system.scm (switch-to-system)
(upgrade-shepherd-services, install-bootloader): Delete variable.
(local-eval): New variable.
(install): Remove 'bootloader-installer' and 'bootcfg-file' parameters.
(install): Add 'bootloader' parameter.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-07-26 19:19:49 +02:00
Jakob L. Kreuze 5c793753b3
guix system: Add 'reconfigure' module.
* guix/scripts/system/reconfigure.scm: New file.
* Makefile.am (MODULES): Add it.
* guix/scripts/system.scm (bootloader-installer-script): Export variable.
* gnu/machine/ssh.scm (switch-to-system, upgrade-shepherd-services)
(install-bootloader): Delete variable.
* gnu/machine/ssh.scm (deploy-managed-host): Rewrite procedure.
* gnu/services/herd.scm (live-service): Export variable.
* gnu/services/herd.scm (live-service-canonical-name): New variable.
* tests/services.scm (live-service): Delete variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2019-07-26 19:19:49 +02:00
Ludovic Courtès 4d04bc50d2
guix build: '--with-commit' recognizes "v[0-9]" tags.
* guix/scripts/build.scm (transform-package-source-commit)[replace]:
Special case COMMIT that starts with "v[0-9]".
2019-07-26 11:21:36 +02:00
Ludovic Courtès 81c3dc3224
maint: Switch to Guile-JSON 3.x.
Guile-JSON 3.x is incompatible with Guile-JSON 1.x, which we relied on
until now: it maps JSON dictionaries to alists (instead of hash tables),
and JSON arrays to vectors (instead of lists).  This commit is about
adjusting all the existing code to this new mapping.

* m4/guix.m4 (GUIX_CHECK_GUILE_JSON): New macro.
* configure.ac: Use it.
* doc/guix.texi (Requirements): Mention the Guile-JSON version.
* guix/git-download.scm (git-fetch)[guile-json]: Use GUILE-JSON-3.
* guix/import/cpan.scm (string->license): Expect vectors instead of
lists.
(module->dist-name): Use 'json-fetch' instead of 'json-fetch-alist'.
(cpan-fetch): Likewise.
* guix/import/crate.scm (crate-fetch): Likewise, and call 'vector->list'
for DEPS.
* guix/import/gem.scm (rubygems-fetch): Likewise.
* guix/import/json.scm (json-fetch-alist): Remove.
* guix/import/pypi.scm (pypi-fetch): Use 'json-fetch' instead of
'json-fetch-alist'.
(latest-source-release, latest-wheel-release): Call 'vector->list' on
RELEASES.
* guix/import/stackage.scm (stackage-lts-info-fetch): Use 'json-fetch'
instead of 'json-fetch-alist'.
(lts-package-version): Use 'vector->list'.
* guix/import/utils.scm (hash-table->alist): Remove.
(alist->package): Pass 'vector->list' on the inputs fields, and default
to the empty vector.
* guix/scripts/import/json.scm (guix-import-json): Remove call to
'hash-table->alist'.
* guix/swh.scm (define-json-reader): Expect pair? or null? instead of
hash-table?.
[extract-field]: Use 'assoc-ref' instead of 'hash-ref'.
(json->branches): Use 'map' instead of 'hash-map->list'.
(json->checksums): Likewise.
(json->directory-entries, origin-visits): Call 'vector->list' on the
result of 'json->scm'.
* tests/import-utils.scm ("alist->package with dependencies"): New test.
* gnu/installer.scm (build-compiled-file)[builder]: Use GUILE-JSON-3.
* gnu/installer.scm (installer-program)[installer-builder]: Likewise.
* gnu/installer/locale.scm (iso639->iso639-languages): Use 'assoc-ref'
instead of 'hash-ref', and pass vectors through 'vector->list'.
(iso3166->iso3166-territories): Likewise.
* gnu/system/vm.scm (system-docker-image)[build]: Use GUILE-JSON-3.
* guix/docker.scm (manifest, config): Adjust for Guile-JSON 3.
* guix/scripts/pack.scm (docker-image)[build]: Use GUILE-JSON-3.
* guix/import/github.scm (fetch-releases-or-tags): Update docstring.
(latest-released-version): Use 'assoc-ref' instead of 'hash-ref'.  Pass
the result of 'fetch-releases-or-tags' to 'vector->list'.
* guix/import/launchpad.scm (latest-released-version): Likewise.
2019-07-25 00:16:41 +02:00
宋文武 3c618b9894
deploy: Handle the '--system' command line option.
* guix/scripts/deploy.scm (show-help): Add help for '--system'.
(%options): Add '-s' and '--system'.
(guix-deploy): Parameterize %current-system.
2019-07-24 20:34:01 +08:00
宋文武 2fa23d8f5c
deploy: Honor '--no-grafts'.
* guix/scripts/deploy.scm (guix-deploy): Parameterize '%graft?'.
2019-07-24 20:34:01 +08:00
Marius Bakke ccad0e4d69
Merge branch 'master' into core-updates 2019-07-22 18:58:48 +02:00
Ludovic Courtès cd9f56ff5a
pack: Pass a list as the entry point for 'build-docker-image'.
* guix/scripts/pack.scm (docker-image)[build]: Pass a list as
 #:entry-point, not a string.
2019-07-22 11:53:40 +02:00
Ludovic Courtès 3d33c93cef
lint: Use the 'warning' procedure for messages.
* guix/scripts/lint.scm (emit-warnings): Use 'warning' instead of
'format'.
2019-07-20 01:32:18 +02:00
Ludovic Courtès 92ca25a32b
guix archive: Use (gcrypt common).
* guix/scripts/archive.scm: Use (gcrypt common) for 'error-source' and
'error-string'.
2019-07-19 11:53:47 +02:00
Marius Bakke 2ee70a5b11
Merge branch 'master' into core-updates 2019-07-19 01:15:59 +02:00
Ludovic Courtès 9b9b753529
pull: Pass #:use-substitutes? to 'show-what-to-build'.
Fixes <https://bugs.gnu.org/36509>.
Reported by Robert Vollmert <rob@vllmrt.net>.

* guix/scripts/pull.scm (build-and-install): Add #:use-substitutes?
parameter and pass it to UPDATE-PROFILE.
(guix-pull): Pass #:use-substitutes? to 'build-and-install'.
2019-07-18 00:44:23 +02:00
Ludovic Courtès 67fb53c0d8
pull: Use (ice-9 format).
* guix/scripts/pull.scm (guix): Use (ice-9 format), as reported by
'-Wformat'.
2019-07-18 00:44:23 +02:00
Ludovic Courtès c84c4c1db7
pull: Remove unused procedures.
* guix/scripts/pull.scm (what-to-build, indirect-root-added): Remove.
2019-07-18 00:44:23 +02:00
Ludovic Courtès 64de896a71
Merge branch 'master' into core-updates 2019-07-17 15:51:10 +02:00
Tobias Geerinckx-Rice 3fb3291e25
Use more guix.gnu.org.
* build-aux/build-self.scm (make-config.scm): Replace gnu.org/s/guix with guix.gnu.org.
* guix/scripts/publish.scm (render-home-page): Likewise.
* guix/self.scm (make-config.scm): Likewise.
2019-07-16 23:00:10 +02:00
Christopher Baines 38f3176a57
lint: Separate checkers by dependence on the internet.
I think there are a couple of potential uses for this. It's somewhat a
separation in to what checkers are just checking the contents of the
repository (line length for example), and other checkers which are bringing in
external information which could change.

I'm thinking particularly, about treating network dependent checkers
differently when automatically running them, but this commit also adds a
--no-network flag to guix lint, which selects the checkers that don't access
the network, which could be useful if no network access is available.

* guix/lint.scm (%checkers): Rename to %all-checkers.
(%local-checkers, %network-dependent-checkers): New variables.
* guix/scripts/lint.scm (run-checkers): Make the checkers argument mandatory.
(list-checkers-and-exit): Handle the checkers as an argument.
(%options): Adjust for changes to %checkers, add a --no-network option, and
change how the --list-checkers option is handled.
(guix-lint): Adjust indentation, and update how the checkers are handled.
2019-07-15 22:32:19 +01:00
Christopher Baines f363c836e0
lint: Move the linting code to a different module.
To try and move towards making programatic access to the linting code easier,
this commit separates out the linting script, from the linting functionality
that it uses.

* guix/scripts/lint.scm (emit-warnings): Alter to to not use match-lambda, as
<lint-warning> isn't accessible.
(<lint-warning>, lint-warning, make-lint-warning, lint-warning?,
lint-warning-message, lint-warning-message-text, lint-warning-message-data,
lint-warning-location, package-file, %make-warning make-warning,
<lint-checker>, lint-checker, make-lint-checker, lint-checker?,
lint-checker-name, lint-checker-description, lint-checker-check,
properly-starts-sentance?, starts-with-abbreviation?, %quoted-identifier-rx,
check-description-style, package-input-intersection,
check-inputs-should-be-native, check-inputs-should-not-be-an-input-at-all,
package-name-regexp, check-synopsis-style, probe-uri,
tls-certificate-error-string, validate-uri, check-home-page,
%distro-directory, check-patch-file-names, escape-quotes,
official-gnu-packages*, check-gnu-synopsis+description, origin-uris,
check-source, check-source-file-name, check-source-unstable-tarball,
check-mirror-url, check-github-url, check-derivation, check-license,
call-with-networking-fail-safe, with-networking-fail-safe,
current-vulnerabilities*, package-vulnerabilities, check-vulnerabilities,
check-for-updates, report-tabulations, report-trailing-white-space,
report-long-line, %hanging-paren-rx, report-lone-parantheses,
%formatting-reporters, report-formatting-issues, check-formatting, %checkers):
Move to…
* guix/lint.scm: … here
* po/guix/POTFILES.in: Add guix/lint.scm.
* Makefile.am: Add guix/lint.scm.
* tests/lint.scm: Change to import (guix lint), rather than (guix scripts lint).
2019-07-15 22:32:19 +01:00
Christopher Baines 57238532f4
scripts: lint: Separate the message warning text and data.
So that translations can be handled more flexibly, rather than having to
translate the message text within the checker.

* guix/scripts/lint.scm (lint-warning-message-text,
lint-warning-message-data): New procedures.
(lint-warning-message): Remove record field accessor, replace with procedure
that handles the lint warning data and translating the message.
(make-warning): Rename to %make-warning.
(make-warning): New macro.
(emit-warnings): Handle the message-text and message-data fields.
(check-description-style): Adjust for changes to make-warning.
[check-trademarks, check-end-of-sentence-space): Adjust for changes to
make-warning.
(check-inputs-should-be-native, check-inputs-should-not-be-an-input-at-all,
check-synopsis-style, validate-uri, check-home-page, check-patch-file-names,
check-gnu-synopsis+description, check-mirror-url, check-github-url,
check-derivation, check-vulnerabilities, check-for-updates,
report-tabulations, report-trailing-white-space, report-long-line,
report-lone-parentheses): Adjust for changes to make-warning.
2019-07-15 22:32:19 +01:00
Christopher Baines 50fc2384fe
scripts: lint: Handle warnings with a record type.
Rather than emiting warnings directly to a port, have the checkers return the
warning or warnings.

This makes it easier to use the warnings in different ways, for example,
loading the data in to a database, as you can work with the <lint-warning>
records directly, rather than having to parse the output to determine the
package and location.

* guix/scripts/lint.scm (<lint-warning>): New record type.
(lint-warning): New macro.
(lint-warning?, lint-warning-package, lint-warning-message,
lint-warning-location, package-file, make-warning): New procedures.
(call-with-accumulated-warnings, with-accumulated-warnings): Remove.
(emit-warning): Rename to emit-warnings, and switch to displaying multiple
warnings.
(check-description-style)[check-not-empty-description, check-texinfo-markup,
check-trademarks, check-quotes, check-proper-start,
check-end-of-sentence-space]: Switch to generating a list of warnings, and
using make-warning, rather than emit-warning.
(check-inputs-should-be-native, check-inputs-should-not-be-an-input-at-all):
Switch to generating a list of warnings, and using make-warning, rather than
emit-warning.
(check-synopsis): Switch to generating a list of warnings, and using
make-warning, rather than emit-warning.
[check-not-empty]: Remove, this is handled in the match clause
to avoid other warnings being emitted.
[check-final-period, check-start-article, check-synopsis-length,
check-proper-start, check-start-with-package-name, check-texinfo-markup]:
Switch to generating a list of warnings, and using make-warning, rather than
emit-warning.
[checks]: Remove check-not-empty.
(validate-uri, check-home-page, check-patch-file-names,
check-gnu-synopsis+description): Switch to generating a list of warnings, and
using make-warning, rather than emit-warning.
(check-source): Switch to generating a list of warnings, and using
make-warning, rather than emit-warning.
[try-uris]: Remove.
[warnings-for-uris]: New procedure, replacing try-uris.
(check-source-file-name, check-source-unstable-tarball, check-mirror-url,
check-github-url, check-derivation, check-vulnerabilities, check-for-updates,
report-tabulations, report-trailing-white-space, report-long-line,
report-lone-parentheses, report-formatting-issues, check-formatting): Switch
to generating a list of warnings, and using make-warning, rather than
emit-warning.
(run-checkers): Call emit-warnings on the warnings returned from the checker.
* tests/lint.scm (string-match-or-error, single-lint-warning-message): New
procedures.
(call-with-warnings, with-warnings): Remove.
("description: not a string", "description: not empty", "description: invalid
Texinfo markup", "description: does not start with an upper-case letter",
"description: may start with a digit", "description: may start with lower-case
package name", "description: two spaces after end of sentence", "description:
end-of-sentence detection with abbreviations", "description: may not contain
trademark signs: ™", "description: may not contain trademark signs: ®",
"description: suggest ornament instead of quotes", "synopsis: not a string",
"synopsis: not empty", "synopsis: valid Texinfo markup", "synopsis: does not
start with an upper-case letter", "synopsis: may start with a digit",
"synopsis: ends with a period", "synopsis: ends with 'etc.'", "synopsis:
starts with 'A'", "synopsis: starts with 'a'", "synopsis: starts with 'an'",
"synopsis: too long", "synopsis: start with package name", "synopsis: start
with package name prefix", "synopsis: start with abbreviation", "inputs:
pkg-config is probably a native input", "inputs: glib:bin is probably a native
input", "inputs: python-setuptools should not be an input at all (input)",
"inputs: python-setuptools should not be an input at all (native-input)",
"inputs: python-setuptools should not be an input at all (propagated-input)",
"patches: file names", "patches: file name too long", "patches: not found",
"derivation: invalid arguments", "license: invalid license", "home-page: wrong
home-page", "home-page: invalid URI", "home-page: host not found", "home-page:
Connection refused", "home-page: 200", "home-page: 200 but short length",
"home-page: 404", "home-page: 301, invalid", "home-page: 301 -> 200",
"home-page: 301 -> 404", "source-file-name", "source-file-name: v prefix",
"source-file-name: bad checkout", "source-file-name: good checkout",
"source-file-name: valid", "source-unstable-tarball",
"source-unstable-tarball: source #f", "source-unstable-tarball: valid",
"source-unstable-tarball: package named archive", "source-unstable-tarball:
not-github", "source-unstable-tarball: git-fetch", "source: 200", "source: 200
but short length", "source: 404", "source: 301 -> 200", "source: 301 -> 404",
"mirror-url", "mirror-url: one suggestion", "github-url", "github-url: one
suggestion", "github-url: already the correct github url", "cve", "cve: one
vulnerability", "cve: one patched vulnerability", "cve: known safe from
vulnerability", "cve: vulnerability fixed in replacement version", "cve:
patched vulnerability in replacement", "formatting: lonely parentheses",
"formatting: alright"): Change test-assert to test-equal, and adjust to work
with the changes above.
("formatting: tabulation", "formatting: trailing white space", "formatting:
long line"): Use string-match-or-error rather than string-contains.
2019-07-15 22:32:18 +01:00
Marius Bakke fb9a23a3f3
Merge branch 'master' into core-updates
Conflicts:
	gnu/local.mk
	gnu/packages/python-xyz.scm
	gnu/packages/xml.scm
	guix/gexp.scm
	po/guix/POTFILES.in
2019-07-12 01:03:53 +02:00
Ludovic Courtès 5c3d44303e
guix gc: Correctly handle '--delete-generations' with no arguments.
Previously, 'guix gc --delete-generations' would crash: the "" pattern
would be passed to 'matching-generations', which would return #f instead
of returning a list.

Reported by Raghav Gururajan <rvgn@disroot.org>
in <https://bugs.gnu.org/36466>.

* guix/ui.scm (matching-generations): Raise an error when passed an
invalid pattern.
* guix/scripts/gc.scm (delete-old-generations): Check if PATTERN is
true.
(%options): Leave ARG as-is for 'delete-generations'.
(guix-gc): Use 'assq' instead of 'assoc-ref' for 'delete-generations'.
* guix/scripts/package.scm (delete-matching-generations):
Replace (string-null? pattern) with (not pattern).  Remove 'else'
clause.
(%options): Leave ARG as-is for 'delete-generations'.
* guix/scripts/pull.scm (%options): Leave ARG as-is for
'list-generations'.
(process-query): Replace (string-null? pattern) with (not pattern).
* guix/scripts/system.scm (list-generations): Likewise, and remove
'else' clause.
(process-command): Use #f instead of "" when no pattern is given.
2019-07-11 23:13:26 +02:00
Carl Dong b6dc08393e
scripts: environment: Add --no-cwd.
* doc/guix.texi (Invoking guix environment): Add --no-cwd.
* guix/scripts/environment.scm (show-help, %options): Add --no-cwd.
(launch-environment/container): Add 'map-cwd?' param; only add mapping
for cwd if #t.  Only change to cwd within container if #t, otherwise
home.
(guix-environment): Error if --no-cwd without --container.  Provide
'(not no-cwd?)' to launch-environment/container as 'map-cwd?'.
* tests/guix-environment.sh: Add test for no-cwd.

Co-authored-by: Mike Gerwitz <mtg@gnu.org>
2019-07-08 10:33:20 -04:00
Carl Dong a655d504aa
scripts: environment: Only rewrite user-specified mappings.
* guix/scripts/environment.scm (launch-environment/container): Only
  apply override-user-mappings to user-mappings and cwd. Do not apply to
  network configuration mapping and inputs.
2019-07-08 10:33:19 -04:00
Jakob L. Kreuze 5cbb832fb1
Add 'guix deploy'.
* guix/scripts/deploy.scm: New file.
* Makefile.am (MODULES): Add it.
2019-07-06 02:10:04 -04:00
Ludovic Courtès dea62932bc
pack: 'squashfs' backend records the profile's search paths.
* guix/scripts/pack.scm (singularity-environment-file): New procedure.
(squashfs-image): Use it, and create /.singularity/env/90-environment.sh.
* gnu/tests/singularity.scm (run-singularity-test)["singularity run,
with environment"]: New test, currently skipped.
* gnu/tests/singularity.scm (build-tarball&run-singularity-test): Add
GUILE-JSON to the profile.
2019-07-04 18:05:02 +02:00
Ludovic Courtès b9fcf0c82a
pack: 'docker' backend records the profile's search paths.
* guix/docker.scm (config): Add #:environment parameter and honor it.
(build-docker-image): Likewise, and pass it to 'config'.
* guix/scripts/pack.scm (docker-image): Import (guix profiles) and (guix
search-paths).  Call 'profile-search-paths' and pass #:environment to
'build-docker-image'.
* gnu/tests/docker.scm (run-docker-test)["Load docker image and run it"]:
Add example that expects (json) to be available.
* gnu/tests/docker.scm (build-tarball&run-docker-test): Replace
%BOOTSTRAP-GUILE by GUILE-2.2 and GUILE-JSON in the environment.
2019-07-04 18:05:02 +02:00
Ludovic Courtès 92a4087bf4
Add (guix repl).
* guix/scripts/repl.scm: Use (guix repl).
(self-quoting?, machine-repl): Remove.
* guix/repl.scm: New file.
* Makefile.am (MODULES): Add it.
2019-07-04 18:05:02 +02:00
Ludovic Courtès 5cc1075a76
Merge branch 'master' into core-updates 2019-06-27 23:33:48 +02:00
Ludovic Courtès a250061986
graph: Use 'derivation-input-derivation'.
* guix/scripts/graph.scm (derivation-dependencies): Use
'derivation-input-derivation'.
2019-06-27 11:14:41 +02:00
Ludovic Courtès 4311cf965c
ui: Add 'display-search-results' and use it.
* guix/ui.scm (display-search-results): New procedure.
* guix/scripts/package.scm (find-packages-by-description): Remove
'unzip2' call and return a list of pairs.
(process-query): Change to use 'display-search-results'.
* guix/scripts/system/search.scm (find-service-types): Remove 'unzip2'
call and return a list of pairs.
(guix-system-search): Use 'display-search-results'.
2019-06-27 11:14:41 +02:00
Ludovic Courtès bb11825f35
publish: Work around Guile 2.2.5 (web server) bug.
* guix/scripts/publish.scm: Replace (@@ (web http) read-header-line) on
Guile 2.2.5.
2019-06-24 17:50:08 +02:00
Ludovic Courtès 92359aed40
guix build: '--log-file' no longer returns several log files.
Fixes a regression introduced in
9353b199c1 whereby something like:

  guix build --log-file $(guix build -d guile)

would return two log files.  This led to a failure of 'tests/guix-build.sh'.

* guix/scripts/build.scm (guix-build): Filter out derivation file names
from ITEMS.
2019-06-23 19:53:03 +02:00
Ludovic Courtès 0f2d9c3290
guix build: Use 'warning' for warnings.
* guix/scripts/build.scm (options->derivations): Use 'warning' instead
of 'format'.
2019-06-23 19:53:03 +02:00
Marius Bakke 6cb1ef9ea2
Merge branch 'staging' into core-updates 2019-06-20 23:38:56 +02:00
Ludovic Courtès 9353b199c1
guix build: '--log-file' looks for build logs of equivalent derivations.
Previously, '--log-file' would look for log files only for the current
derivation, and thus wouldn't find log files of equivalent derivations
that produce the same output.

* guix/scripts/build.scm (guix-build) <log-file?>: Replace
'derivation-file-name' by 'derivation->output-path'.
2019-06-18 16:25:09 +02:00
Ludovic Courtès 836a85da0e
gnu: bootstrap: Download the bootstrap bash, mkdir, tar, and xz binaries.
* gnu/packages/bootstrap.scm (%bootstrap-executables): New variable.
(bootstrap-executable-url, bootstrap-executable): New procedure.
(raw-build)[->store]: Use 'run-with-store' and 'origin->derivation'.
Add calls to 'derivation->output-path', and remove the list of
references passed to 'add-text-to-store' for BUILDER.  Augment the list
of #:inputs passed to 'derivation'.
(package-from-tarball): Use 'bootstrap-executable' instead of
'search-bootstrap-binary'.
(%bootstrap-glibc, %bootstrap-gcc, %bootstrap-mescc-tools)
(%bootstrap-mes): Likewise.
* guix/scripts/environment.scm (environment-bash): Use
'bootstrap-executable' instead of 'search-bootstrap-binary'.
(guix-environment): Adjust CONTAINER? case accordingly.
* po/guix/POTFILES.in: Add gnu/packages/bootstrap.scm.
2019-06-14 21:57:01 +02:00
Ludovic Courtès d9bbfe042e
Merge branch 'master' into core-updates 2019-06-13 13:24:35 +02:00
Ludovic Courtès c5f66d2931
pack: Fix 'guix pack -f docker'.
Regression introduced in a0f352b30f.

* guix/scripts/pack.scm (docker-image): Check whether ENTRY-POINT is
true before returning (string-append #$profile ...).
2019-06-10 23:16:47 +02:00
Ludovic Courtès a0f352b30f
pack: Add '--entry-point'.
* guix/scripts/pack.scm (self-contained-tarball): Add #:entry-point and
warn when it's true.
(squashfs-image): Add #:entry-point and honor it.
(docker-image): Add #:entry-point and honor it.
(%options, show-help): Add '--entry-point'.
(guix-pack): Honor '--entry-point' and pass #:entry-point to BUILD-IMAGE.
* gnu/tests/docker.scm (run-docker-test): Test 'docker run' with the
default entry point.
(build-tarball&run-docker-test): Pass #:entry-point to 'docker-image'.
* doc/guix.texi (Invoking guix pack): Document it.
* gnu/tests/singularity.scm (run-singularity-test)["singularity run"]:
New test.
(build-tarball&run-singularity-test): Pass #:entry-point to
'squashfs-image'.
2019-06-07 09:57:19 +02:00
Ludovic Courtès b7178c22bf
syscalls: Add 'with-file-lock' macro.
* guix/scripts/offload.scm (lock-file, unlock-file, with-file-lock):
Move to...
* guix/build/syscalls.scm: ... here.
2019-06-05 23:10:36 +02:00
Ludovic Courtès bcb7c900cc
guix package: Do not list environment variables that need to be set.
Fixes <https://bugs.gnu.org/35942>.

* guix/scripts/package.scm (display-search-paths): Rename to...
(display-search-path-hint): ... this.  Adjust callers.
Remove #:kind parameter.  Replace the list of environment variables with
an invitation to source $GUIX_PROFILE/etc/profile or run 'guix package
--search-paths'.
2019-06-05 23:10:36 +02:00
Ludovic Courtès b90ae065b5
substitute: Select the best compression methods.
When a server publishes several URLs with different compression methods,
'guix substitute' can now choose the best one among the compression
methods that it supports.

* guix/scripts/substitute.scm (<narinfo>)[uri]: Replace with...
[uris]: ... this.
[compression]: Replace with...
[compressions]: ... this.
[file-size]: Replace with...
[file-sizes]: ... this.
[file-hash]: Replace with...
[file-hashes]: ... this.
(narinfo-maker): Adjust accordingly.  Ensure 'file-sizes' and
'file-hashes' have the right length.
(assert-valid-signature, valid-narinfo?): Use the first element of
'narinfo-uris' in error messages.
(read-narinfo): Expect "URL", "Compression", "FileSize", and "FileHash"
to occur multiple times.
(display-narinfo-data): Call 'select-uri' to determine the file size.
(%compression-methods): New variable.
(supported-compression?, compresses-better?, select-uri): New
procedures.
(process-substitution): Call 'select-uri' to select the URI and
compression.
* guix/scripts/weather.scm (report-server-coverage): Account for all the
values returned by 'narinfo-file-sizes'.
* tests/substitute.scm ("substitute, narinfo with several URLs"): New
test.
2019-06-02 22:01:57 +02:00
Ludovic Courtès b8fa86adfc
publish: '--compression' can be repeated.
This allows 'guix publish' to compress and advertise multiple
compression methods from which users can choose.

* guix/scripts/publish.scm (actual-compression): Rename to...
(actual-compressions): ... this.  Expect REQUESTED to be a list, and
always return a list.
(%default-options): Remove 'compression.
(store-item->recutils): New procedure.
(narinfo-string): Change #:compression to #:compressions (plural).
Adjust accordingly.
(render-narinfo, render-narinfo/cached): Likewise.
(bake-narinfo+nar): Change #:compression to #:compressions.
[compressed-nar-size]: New procedure.
Call 'compress-nar' for each item returned by 'actual-compressions'.
Create a narinfo for each compression.
(effective-compression): New procedure.
(make-request-handler): Change #:compression to #:compressions.
Use 'effective-compression' to determine the applicable compression.
(guix-publish): Adjust handling of '--compression'.
Print a message for each compression that is enabled.
* tests/publish.scm ("/*.narinfo"): Adjust to new narinfo field
ordering.
("/*.narinfo with properly encoded '+' sign"): Likewise.
("/*.narinfo with lzip + gzip"): New test.
("with cache, lzip + gzip"): New test.
* doc/guix.texi (Invoking guix publish): Document it.
2019-06-02 22:01:57 +02:00
Ludovic Courtès 73bddab545
publish: Factorize 'compress-nar'.
* guix/scripts/publish.scm (compress-nar): New procedure.
(bake-narinfo+nar): Use it.
2019-05-29 23:16:49 +02:00
Ludovic Courtès e84e036943
publish: Remove outdated comment.
* guix/scripts/publish.scm (make-request-handler): Remove outdated TODO.
2019-05-29 23:16:49 +02:00
Ludovic Courtès 35d1354fe8
publish: Display the compression method and level in use.
* guix/scripts/publish.scm (guix-publish): Use 'info' instead of
'format' for the initial message.  When COMPRESSION is true, display the
method and level in use.
2019-05-27 22:47:24 +02:00
Ludovic Courtès 66229b04ae
publish: Add support for lzip.
* guix/scripts/publish.scm (show-help, %options): Support '-C METHOD'
and '-C METHOD:LEVEL'.
(default-compression): New procedure.
(bake-narinfo+nar): Add lzip.
(nar-response-port): Likewise.
(string->compression-type): New procedure.
(make-request-handler): Generalize /nar/gzip handler to handle /nar/lzip
as well.
* tests/publish.scm ("/nar/lzip/*"): New test.
("/*.narinfo with lzip compression"): New test.
* doc/guix.texi (Invoking guix publish): Document it.
(Requirements): Mention lzlib.
2019-05-27 22:47:24 +02:00
Ludovic Courtès 493375cdb2
publish: Maintain a hash-part-to-store-item mapping in cache.
Fixes <https://bugs.gnu.org/33897>.

* guix/scripts/publish.scm (hash-part-mapping-cache-file)
(hash-part->path*): New procedures.
* guix/scripts/publish.scm (render-narinfo/cached)[delete-entry]: Delete
the 'hash-part-mapping-cache-file'.
Use 'hash-part->path*' instead of 'hash-part->path'.
* tests/publish.scm ("with cache, vanishing item"): New test.
2019-05-26 01:34:17 +02:00
Marius Bakke 57df83e07d
Merge branch 'staging' into core-updates 2019-05-25 00:25:15 +02:00
Ludovic Courtès b1903b99e0
weather: Accept package specs on the command line.
Previously, non-option arguments would be ignored.  Now it puts them to
good use.

* guix/scripts/weather.scm (guix-weather)[package-list]: New procedure.
Use it.
* doc/guix.texi (Invoking guix weather): Adjust accordingly.
2019-05-22 00:09:42 +02:00
Ludovic Courtès 3f8326237d
pack: Warn when building an empty pack.
* guix/scripts/pack.scm (guix-pack): Warn when MANIFEST has zero
entries.
2019-05-22 00:09:41 +02:00
Ludovic Courtès fd214f1522
pack: Add '--root'.
* guix/scripts/pack.scm (%options, show-help): Add "--root".
(guix-pack): Honor it.
* tests/guix-pack.sh: Test it.
* doc/guix.texi (Invoking guix pack): Document it.
2019-05-22 00:09:41 +02:00
Ludovic Courtès ce10e6053b
guix system: Type-check the file or expression.
Previously, users would get a wrong-type-arg exception down the road
with an intimidating backtrace.

* guix/scripts/system.scm (process-action)[ensure-operating-system]: New
procedure.
Use it.
2019-05-16 13:24:06 +02:00
Ludovic Courtès 45d41c035e
guix build: Gracefully handle invalid '--with-git-url' specs.
* guix/scripts/build.scm (transform-package-source-git-url): Add case
for when 'string-split' does not return exactly two elements.
2019-05-14 12:11:05 +02:00
Maxim Cournoyer d03de6be0a
vm: Auto-detect if inputs should be registered.
The default value of the argument REGISTER-CLOSURE? of the ISO9660-IMAGE,
QEMU-IMAGE and SYSTEM-DOCKER-IMAGE procedures can be computed automatically,
since the operating-system definition is available in its context.  When the
operating-system definition does not contain the GUIX-SERVICE-TYPE, do not
register the closure in the database of Guix, as it takes time and doesn't
serve a purpose.

* gnu/system/vm.scm (has-guix-service-type): Add predicate.
(iso9660-image)[register-closures?]: Use it to compute the argument's default
value.
(qemu-image)[register-closures?]: Likewise, and update docstring.
(system-docker-image)[register-closures?]: Likewise.
(system-disk-image): Do not explicit a value for the REGISTER-CLOSURES?
argument of the ISO9660-IMAGE and QEMU-IMAGE procedure calls, so that its
default value is used instead.
* guix/scripts/system.scm (system-derivation-for-action): Do not explicit a
value for the REGISTER-CLOSURES? argument of the SYSTEM-DOCKER-IMAGE
procedure call, so that its default value is used instead.
2019-05-13 22:59:09 -04:00
Arun Isaac b33454ae0b
linux-container: Support container network sharing.
* gnu/system/linux-container.scm (container-essential-services): If network is
to be shared with the host, remove network configuration files from etc
service.
(containerized-operating-system): If network is to be shared with the host,
remove nscd service and map host's /var/run/nscd if it exists.
(container-script): If network is to be shared with the host, do not create
network namespace.
* guix/scripts/system.scm (system-derivation-for-action): Add
#:container-shared-network? argument.
(perform-action): Add #:container-shared-network? argument.
(show-help): Add "-N, --network" help information.
(%options): Add network option.
(process-action): Call perform-action with #container-shared-network? argument.
* doc/guix.texi (Invoking guix system): Document the "-N, --network" option.

Co-authored-by: Christopher Baines <mail@cbaines.net>
2019-05-14 02:54:58 +05:30
Ludovic Courtès a0dc97a517
pull: Display 'hash guix' hint when the new and old 'guix' are different.
Fixes <https://bugs.gnu.org/35601>.
Reported by Diego Nicola Barbato <dnbarbato@posteo.de>.

Previously we were calling (which "guix") after the new profile had been
built and symlinked, so in most cases the hint would not be triggered,
even though it should have been triggered.

* guix/scripts/pull.scm (build-and-install)[guix-command]: New variable.
Compare PROFILE/bin/guix against GUIX-COMMAND.
2019-05-09 17:42:31 +02:00
Chris Marusich 387e6b9e34
ui: Make package outputs searchable.
* guix/ui.scm (relevance): Allow the "field" procedure of a metric to
return a list, and handle that case appropriately.  Update docstring.
(%package-metrics): Add a metric for package outputs.
* guix/scripts/package.scm (find-packages-by-description): Update
docstring.
* tests/guix-package.sh: Add a test case to verify that package outputs are
included in search results.

Co-authored-by: Tobias Geerinckx-Rice <me@tobias.gr>
2019-05-09 00:10:34 -07:00
Ludovic Courtès d108f59761
environment: Non ad-hoc mode also honors transformation options.
Fixes <https://bugs.gnu.org/35618>.
Reported by Florent Pruvost <florent.pruvost@inria.fr>.

* guix/scripts/environment.scm (options/resolve-packages): Add call to
TRANSFORM in non "ad-hoc" case.
* tests/guix-environment.sh: Add test.
2019-05-07 15:46:53 +02:00
Marius Bakke 3b458d5462
Merge branch 'master' into core-updates 2019-05-01 23:11:41 +02:00
Ludovic Courtès 757e633d57
build: Change default substitute server to "ci.guix.gnu.org".
* config-daemon.ac: Replace "ci.guix.info" with "ci.guix.gnu.org".
* doc/guix.texi (SUBSTITUTE-SERVER): Likewise.
* etc/substitutes/ci.guix.gnu.org.pub: New file.
* Makefile.am (dist_pkgdata_DATA): Add it.
* guix/scripts/build.scm (%default-log-urls): Update.
* guix/scripts/substitute.scm (%default-substitute-urls): Likewise.
* guix/store.scm (%default-substitute-urls): Likewise.
* guix/self.scm (miscellaneous-files): Add "ci.guix.gnu.org".
2019-05-01 11:05:47 +02:00
Ludovic Courtès c20d4cac1f
processes: Gracefully handle daemons without clients.
Fixes <https://bugs.gnu.org/34716>.
Reported by Mark H Weaver <mhw@netris.org>.

The problem could be reproduced by running, on one hand:

  sh -c 'exec -a guix-daemon sleep 777'

and on the other hand:

  guix processes

If there is no process with PID 777, 'guix processes' would barf as it
stumbles upon a <daemon-session> record whose client is #f.

* guix/scripts/processes.scm (daemon-sessions)[child-process->session]:
New procedure, with lambda formerly passed to 'map'.  Handle #f returns
from 'lookup-process'.
Call 'child-process->session' within 'filter-map', not just 'map'.
2019-04-29 21:54:10 +02:00
Ludovic Courtès c21d912a02
processes: 'process-open-files' ignores disappeared /proc/PID/fd entries.
Previously, 'process-open-files' would throw ENOENT if an entry had
vanished after the 'scandir' call and before the 'readlink' call.

* guix/scripts/processes.scm (process-open-files): Catch ENOENT errors
from 'readlink'.
2019-04-29 21:39:38 +02:00
Ludovic Courtès da56f10971
guix package: Add 'guix search' alias.
* guix/scripts/search.scm: New file.
* Makefile.am (MODULES): Add it.
* po/guix/POTFILES.in: Add it.
* tests/guix-package-aliases.sh: Add test.
* doc/guix.texi (Invoking guix package): Document it and use it in a
couple of examples.
2019-04-29 12:19:24 +02:00
Ludovic Courtès d824cfbabe
guix package: Add 'install', 'remove', and 'upgrade' aliases.
* guix/scripts/install.scm, guix/scripts/remove.scm,
guix/scripts/upgrade.scm, tests/guix-package-aliases.sh: New files.
* Makefile.am (MODULES, SH_TESTS): Add them.
* po/guix/POTFILES.in: Add them.
* guix/scripts/package.scm (guix-package): Split with...
(guix-package*): ... this.  New procedure.
* doc/guix.texi (Invoking guix package): Document them.
(Binary Installation, Application Setup, Package Management)
(Packages with Multiple Outputs, Package Modules)
(X.509 Certificates, Installing Debugging Files): Use 'guix install' in
simple examples.
* etc/completion/bash/guix (_guix_complete): Handle "install", "remove",
and "upgrade".
2019-04-29 10:13:44 +02:00
Ludovic Courtès 0663302618
describe: Provide a hint when origin detection fails.
* guix/scripts/describe.scm (display-checkout-info): Add call to
'display-hint' in the error case.
2019-04-28 22:57:06 +02:00
Ludovic Courtès af41e504cf
guix system: Compute 'bootcfg' only for 'init' and 'reconfigure'.
Previously, 'guix system vm' would start by computing the bootcfg
derivation, which itself depended on an incorrect OS derivation (for the
original OS instead of the one passed through
'virtualized-operating-system'.)  That added overhead and would force
the user's config file to define a root file system, for example, even
though it makes no sense in the case of a VM.

* guix/scripts/system.scm (perform-action)[bootcfg]: Limit to the 'init'
and 'reconfigure' actions.
2019-04-23 23:44:35 +02:00
Ludovic Courtès a06a95baff
pull: Create profile after the store connection has been opened.
Fixes <https://bugs.gnu.org/35341>.
Reported by Florian Pelz <pelzflorian@pelzflorian.de>.

Previously, we'd call 'ensure-default-profile' before the connection to
the daemon has been opened.  On the first connection, the daemon ensures
that /var/guix/profiles/per-user is world-writable.  Since we were
calling 'ensure-default-profile' before that,
/var/guix/profiles/per-user was typically non-writable (555 and
root-owned), and thus 'guix pull' would error out.

* guix/scripts/pull.scm (guix-pull): Call 'ensure-default-profile'
within 'with-store'.
2019-04-22 12:01:32 +02:00
Ludovic Courtès c5265a0951
pull: Add '--news'.
Suggested by Tobias Geerinckx-Rice <me@tobias.gr>.

* guix/scripts/pull.scm (%options, show-help): Add '--news'.
(display-profile-news): Add #:current-is-newer? and #:concise?.
Honor them.
(build-and-install): Pass #:concise? #t.
(display-new/upgraded-packages)[concise/max-item-count]: New variable.
Add call to 'display-hint'.
(process-query): Add clause for 'display-news'.
* doc/guix.texi (Invoking guix pull): Add '--news'.
2019-04-22 12:01:32 +02:00
Ludovic Courtès ea261dea0c
guix build: Accept multiple '-s' options.
* guix/scripts/build.scm (%default-options): Remove 'system'.
(%options) <--system>: Keep previous occurrences of 'system in RESULT.
(options->derivations)[system]: Remove.
[systems, things-to-build]: New variables.
[compute-derivation]: New procedure.
Iterate on all of SYSTEMS to compute the derivations of THINGS-TO-BUILD.
* tests/guix-build.sh: Add test for one and multiple '-s' flags.
* doc/guix.texi (Additional Build Options): Document this behavior.
2019-04-19 17:46:40 +02:00
Ludovic Courtès 702c3c7dab
lint: 'check-github-url' uses our own 'open-connection-for-uri'.
Fixes <https://bugs.gnu.org/35053>.
Reported by Efraim Flashner <efraim@flashner.co.il>.

Previously 'check-github-url' would let Guile 2.2's (web client) module
take care of opening the connection.  Consequently, it wouldn't use the
TLS priority strings that we use in (guix build download),
'open-connection-for-uri'.  In particular, it would not disable TLSv1.3,
which would trigger <https://bugs.gnu.org/34102> for github.com.

* guix/scripts/lint.scm (check-github-url): Add #:timeout parameter.
[follow-redirect]: Change parameter name to 'url' and pass it to
'string->uri'.  Call 'guix:open-connection-for-uri' to open the
connection and pass it to 'http-head' via #:port.
2019-04-18 17:43:56 +02:00
Ludovic Courtès 72f749dcb8
pull: '--url', '--commit', and '--branch' apply to the 'guix' channel.
Suggested by pkill9 <pkill9@runbox.com>.

* guix/scripts/pull.scm (channel-list): Apply REF and URL to the 'guix'
channel.
* doc/guix.texi (Invoking guix pull): Adjust accordingly.
2019-04-17 13:56:40 +02:00
Ludovic Courtès 4aea820f09
guix build: Fix relative file name canonicalization for '--root'.
Fixes <https://bugs.gnu.org/35271>.
Reported by rendaw <7e9wc56emjakcm@s.rendaw.me>.

* guix/scripts/build.scm (register-root): When ROOT is a relative file
name, append the basename of ROOT, not ROOT itself.
* tests/guix-build.sh: Add test.
2019-04-15 16:57:12 +02:00
Ludovic Courtès c1df77e215
guix gc: '-d' does not attempt to delete non-user-owned roots.
* guix/scripts/gc.scm (guix-gc)[delete-generations]: Limit to user-owned
roots, unless we're running as root.
2019-04-11 18:18:13 +02:00
Ludovic Courtès 96b8c2e6e2
guix gc: Add '--delete-generations'.
* guix/scripts/gc.scm (show-help, %options): Add
'--delete-generations'.  Change '--delete' shorthand to '-D'.
(delete-old-generations): New procedure.
(guix-gc)[delete-generations]: New procedure.
Call it when ACTION is 'collect-garbage' and OPTS contains
'delete-generations.
* doc/guix.texi (Invoking guix gc): Document it.
2019-04-10 17:09:47 +02:00
Ludovic Courtès bacf980c76
guix gc: Add '--list-roots'.
* guix/scripts/gc.scm (show-help, %options): Add '--list-roots'.
(guix-gc)[list-roots]: New procedure.
Handle '--list-roots'.
* tests/guix-gc.sh: Test it.
* doc/guix.texi (Invoking guix gc): Document it.
2019-04-10 17:09:47 +02:00
Ludovic Courtès 08d0f950b3
pull: Remove duplicate '--dry-run' description.
Reported by pkill9.

* guix/scripts/pull.scm (show-help): Remove duplicate '--dry-run'
description.
2019-04-10 17:09:47 +02:00
Ludovic Courtès 21b3c0ca87
guix package: Use absolute file names in search path recommendations.
Suggested by Chris Marusich.

* guix/scripts/package.scm (absolutize): New procedure.
(display-search-paths): Use it.
2019-04-10 12:40:58 +02:00
Ludovic Courtès 1199da08aa
size: Optimize dependency size computation.
This reduces 'guix size' run time by ~4% here:

  items="$(guix build icecat inkscape emacs libreoffice)"
  guix size $items

* guix/scripts/size.scm (store-profile): Define 'size-table' and use it
to lookup the size of ITEM in 'dependency-size'.
2019-04-07 11:36:00 +02:00
Ludovic Courtès 985730c1af
scripts: More commands default to verbosity level 1.
* guix/scripts/environment.scm (%default-options): Change 'verbosity' to 1.
* guix/scripts/pack.scm (%default-options): Likewise.
* guix/scripts/system.scm (guix-system): Likewise, except for the
'build' command.
2019-04-04 17:47:02 +02:00
Ludovic Courtès c1ef50ac79
gexp: Remove workarounds for <https://bugs.gnu.org/15602>.
* gnu/services/base.scm (hydra-key-authorization)[aaa]: Remove.
[default-acl]: Don't import it.
* guix/scripts/pack.scm (store-database)[build]: Don't import
(gnu build install).
2019-04-04 17:47:02 +02:00
Ludovic Courtès 1ccc0f807d
environment: '-C' creates namespaces where the user is not root.
* guix/scripts/environment.scm (launch-environment/container): Add UID
and GID.  Use them in PASSWD and GROUPS.  Pass them as #:guest-uid and
 #:guest-gid to 'call-with-container'.
* tests/guix-environment-container.sh: Test the inner UID.
In '--user' test, replace hard-coded 0 with 1000.
* doc/guix.texi (Invoking guix environment): Adjust accordingly.
2019-04-02 18:15:37 +02:00
Ludovic Courtès 539af7f257
pull: Truncate the list of packages displayed on completion.
Previously, if you'd run 'guix pull' after a couple of weeks, it would
fill your screen with package names, which is unhelpful.

* guix/scripts/pull.scm (ellipsis): New procedure.
(display-new/upgraded-packages): Add #:concise?.
[list->enumeration]: New procedure.
Use it instead of 'string-join'.
(display-profile-news): Pass #:concise? #t.
2019-03-28 23:06:59 +01:00
Ludovic Courtès 9f4169f6c8
pull: Factorize pretty-printing for new/upgraded package lists.
* guix/scripts/pull.scm (display-new/upgraded-packages)[pretty]: New
procedure.
Use it.
2019-03-28 23:06:58 +01:00
Ludovic Courtès 42314ffa07
refresh: Update the source code URL.
Reported by Tobias Geerinckx-Rice <me@tobias.gr>
in <https://bugs.gnu.org/35010>.

* guix/upstream.scm (update-package-source): Take 'source' instead of
'version' as the second argument.
[update-expression]: Change to take 'replacements', a list of
replacement pairs.
Compute OLD-URL and NEW-URL and replace the dirname of the OLD-URL with
that of NEW-URL.
* guix/scripts/refresh.scm (update-package): Adjust call to
'update-package-source' accordingly.
2019-03-27 14:59:42 +01:00
Ludovic Courtès 1ee3d2dcb8
upstream: 'package-update' returns the <upstream-source> object.
Fixes a regression introduced in
abd4d6b33d, where CHANGES would no longer
be a thunk.

Reported by Ricardo Wurmus.

* guix/upstream.scm (package-update/url-fetch): Return SOURCE as the
third value instead of CHANGES.
* guix/scripts/refresh.scm (update-package): Adjust accordingly.
2019-03-27 14:59:41 +01:00
Ludovic Courtès 952afb6f8c
environment: Create /etc/group in containers.
Reported by Pierre Neidhardt <mail@ambrevar.xyz>.

* guix/scripts/environment.scm (launch-environment/container): Create
GROUPS and call 'write-group'.
* tests/guix-environment-container.sh: Test it.
2019-03-26 18:11:52 +01:00
Ludovic Courtès 8a9922bdee
environment: Use (gnu build accounts) for /etc/passwd handling.
* guix/scripts/environment.scm (launch-environment/container): Remove
call to 'mock-passwd'; instantiate a <password-entry> instead.  Call
'write-passwd' to write the pasword database instead of using custom
code.
(mock-passwd): Remove.
* tests/guix-environment-container.sh: Test 'getpwuid'.
2019-03-26 18:11:52 +01:00
Marius Bakke 8c14f7f8a7
Merge branch 'staging' into core-updates 2019-03-23 23:16:55 +01:00
Ludovic Courtès a53ecfc897
graph: Factorize calls to 'fold-packages'.
* guix/scripts/graph.scm (all-packages): New procedure.
(%reverse-package-node-type, %reverse-bag-node-type): Use 'all-packages'
instead of 'fold-packages'.
2019-03-23 18:15:36 +01:00
Ludovic Courtès 2b81eac01e
graph: Add the 'reverse-bag' graph.
Suggested by Julien Lepiller.

* guix/scripts/graph.scm (%reverse-bag-node-type): New variable.
(%node-types): Add it.
* tests/graph.scm ("reverse bag DAG"): New test.
* doc/guix.texi (Invoking guix graph): Document it.
2019-03-23 18:15:36 +01:00
Ludovic Courtès 6c5e618ca0
pack: Create an empty /home directory for '-f squashfs'.
Fixes <https://bugs.gnu.org/34914>.

* guix/scripts/pack.scm (squashfs-image)[build]: Pass "-p /home d 555 0 0".
2019-03-19 11:30:34 +01:00
Ludovic Courtès 427c87d0bd
pack: Produce relative symlinks when using '-f squashfs'.
Fixes <https://bugs.gnu.org/34913>.

* guix/scripts/pack.scm (squashfs-image)[build]: Use
'relative-file-name' when creating SYMLINKS.
* guix/scripts/pack.scm (guix-pack): Pass #:relative-symlinks? #t when
PACK-FORMAT is 'squashfs.
2019-03-19 11:30:34 +01:00
Ludovic Courtès b6fd086a61
describe: Warn about 'GUIX_PACKAGE_PATH' in json and recutils format.
Fixes <https://bugs.gnu.org/34884>.
Reported by Pierre Neidhardt <mail@ambrevar.xyz>.

* guix/scripts/describe.scm (display-package-search-path): Add catch-all
case for FMT.
2019-03-18 10:51:05 +01:00
Ludovic Courtès d831b19079
guix build: '--with-branch' strips slashes from the version string.
This fixes things like:

  guix build glibc \
    --with-git-url=glibc=git://sourceware.org/git/glibc.git \
    --with-branch=glibc=release/2.25/master

whereby slashes would before go straight to the 'version' field, leading
to an invalid store file name.

* guix/scripts/build.scm (transform-package-source-branch)[replace]:
Replace slashes with hyphens in BRANCH when building the version
string.
2019-03-17 22:55:01 +01:00
Ludovic Courtès 845c44012c
guix build: '--with-commit' makes recursive checkouts.
This was an omission from commit
024a6bfba9.

* guix/scripts/build.scm (transform-package-source-commit): Add
'recursive?' field to SOURCE.
* tests/scripts-build.scm ("options->transformation, with-branch")
("options->transformation, with-commit"): New tests.
2019-03-17 22:55:01 +01:00
Ludovic Courtès 14328b81a2
guix build: Transformation options match packages by spec.
This allows us to combine several transformations on a given package, in
particular '--with-git-url' and '--with-branch'.

Previously transformations would ignore each other since they would all
take (specification->package SOURCE) as their replacement source,
compare it by identity, which doesn't work if a previous transformation
has already changed SOURCE.

* guix/scripts/build.scm (evaluate-replacement-specs): Adjust to produce
an alist as expected by 'package-input-rewriting/spec', with a package
spec as the first element of each pair.
(evaluate-git-replacement-specs): Likewise.
(transform-package-inputs):  Adjust accordingly and use
'package-input-rewriting/spec'.
(transform-package-inputs/graft): Likewise.
(transform-package-source-branch, transform-package-source-commit): Use
'package-input-rewriting/spec'.
(transform-package-source-git-url): Likewise, and adjust the
REPLACEMENTS alist accordingly.
(options->transformation): Iterate over OPTS instead of over
%TRANSFORMATIONS.  Invoke transformations one by one.
* tests/scripts-build.scm ("options->transformation, with-input"):
Adjust test to compare packages by name rather than by identity.
("options->transformation, with-git-url + with-branch"): New test.
2019-03-17 22:55:01 +01:00
Ludovic Courtès 0c0ff42a24
guix build: Factorize 'package-git-url'.
* guix/scripts/build.scm (package-git-url): New procedure.
(evaluate-git-replacement-specs): Use it.
2019-03-17 22:55:01 +01:00
Ludovic Courtès 880916ac52
guix build: Add '--with-git-url'.
* guix/scripts/build.scm (%not-equal): New variable.
(evaluate-git-replacement-specs): Use it instead of local variable
'not-equal'.
(transform-package-source-git-url): New procedure.
(%transformations): Add 'with-git-url'.
(%transformation-options, show-transformation-options-help): Add
'--with-git-url'.
* tests/scripts-build.scm ("options->transformation, with-git-url"):
New test.
2019-03-17 22:55:01 +01:00
Ludovic Courtès 8ffab257dd
guix system: Fix success report of the bootloader installation.
Fixes <https://bugs.gnu.org/34890>.
Reported by Jack Hill <jackhill@jackhill.us>.

Regression introduced in 21fcfe1ee9.

* guix/scripts/system.scm (bootloader-installer-script): Ungexp DEVICE.
2019-03-17 16:30:00 +01:00
Tobias Geerinckx-Rice b56d160944
guix: Match package names case-insensitively.
* guix/scripts/package.scm (options->upgrade-predicate, process-query):
Use REGEXP/ICASE when matching package names.
2019-03-16 23:32:41 +01:00
Ludovic Courtès 21fcfe1ee9
bootloader: Use 'invoke/quiet' when running 'grub-install' and co.
This hides potentially confusing GRUB messages from the user, such as
"Installing for i386-pc platform."

* gnu/bootloader/extlinux.scm (install-extlinux): Use 'invoke/quiet'
instead of 'system*' and 'error'.
* gnu/bootloader/grub.scm (install-grub, install-grub-efi): Likewise.
* guix/scripts/system.scm (bootloader-installer-script): Guard against
'message-condition?' and handle them properly.
2019-03-16 18:15:13 +01:00
P.C. Shyamshankar 41dfe40f5d
pack: Construct inferior package names correctly.
* guix/scripts/pack.scm (wrapped-package): now correctly constructs full
names of inferior packages.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2019-03-15 23:27:59 +01:00
Ludovic Courtès 99aec37a78
pack: "-RR" produces PRoot-enabled relocatable binaries.
* gnu/packages/aux-files/run-in-namespace.c (exec_with_proot): New
function.
(main): When 'clone' fails, call 'rm_rf'.
[PROOT_PROGRAM]: When 'clone' fails, call 'exec_with_proot'.
* guix/scripts/pack.scm (wrapped-package): Add #:proot?.
[proot]: New procedure.
[build]: Compile with -DPROOT_PROGRAM when PROOT? is true.
* guix/scripts/pack.scm (%options): Set the 'relocatable?' value to
'proot when "-R" is passed several times.
(guix-pack): Pass #:proot? to 'wrapped-package'.
* tests/guix-pack-relocatable.sh: Use "-RR" on Intel systems that lack
user namespace support.
* doc/guix.texi (Invoking guix pack): Document -RR.
2019-03-15 23:27:59 +01:00
Marius Bakke 96ab233df7
Merge branch 'staging' into core-updates 2019-03-10 18:47:02 +01:00
Ludovic Courtès d40ec4a0d0
pack: Add '--save-provenance'.
* guix/scripts/pack.scm (show-help, %options): Add '--save-provenance'.
(guix-pack)[manifest-from-args]: Honor it.
* doc/guix.texi (Invoking guix pack): Document it.
2019-03-07 00:00:18 +01:00
Ludovic Courtès 2cb658a9a7
describe: Add 'package-provenance'.
* guix/scripts/package.scm (package-provenance): Move to...
* guix/describe.scm (package-provenance): ... here.
2019-03-07 00:00:18 +01:00
Marius Bakke b4d7689f92
Merge branch 'staging' into core-updates 2019-03-04 23:05:01 +01:00
Ludovic Courtès dca5821958
environment: Rename '--inherit' to '--preserve'.
Suggested by Eric Bavier and Ricardo Wurmus.

* guix/scripts/environment.scm (show-help, %options): Emit a deprecation
warning for "--inherit" and add -E/--preserve.
* tests/guix-environment.sh: Adjust accordingly.
* doc/guix.texi (Invoking guix environment): Update accordingly.
2019-03-04 15:22:59 +01:00
Ludovic Courtès bab9cc4aff
environment: Remove deprecated -E/--exec option.
* guix/scripts/environment.scm (%options): Remove "--exec", which was
deprecated in commit 1de2fe95e0 in 2015.
* tests/guix-environment.sh: Remove use of '-E'.
2019-03-04 15:22:59 +01:00
Marius Bakke 901236474a
Merge branch 'staging' into core-updates 2019-02-20 17:19:00 +01:00
Ludovic Courtès e6e599fa01
environment: Add '--inherit'.
* guix/scripts/environment.scm (purify-environment): Add 'white-list'
parameter and honor it.
(create-environment): Add #:white-list parameter and honor it.
(launch-environment): Likewise.
(launch-environment/fork): Likewise.
(show-help, %options): Add '--inherit'.
(guix-environment): Define 'white-list' and pass it to
'launch-environment/fork'.
* tests/guix-environment.sh: Test '--inherit'.
* doc/guix.texi (Invoking guix environment): Document it.
2019-02-16 01:00:08 +01:00
Ludovic Courtès 1e9698344d
guix system: List old generations from newest to oldest.
Previously 'guix system switch-generation' or 'delete-generations' would
yield a GRUB menu where entries for old generations were in the wrong
order (i.e., oldest first.)

* guix/scripts/system.scm (reinstall-bootloader): Reverse the list
returned by 'generation-numbers'.
2019-02-13 16:19:54 +01:00
Ludovic Courtès 499b166d1c
guix system: Add 'delete-generations'.
* guix/scripts/package.scm (delete-matching-generations): Export.
* guix/scripts/system.scm (show-help): Add 'delete-generations'.
(process-command): Honor it.
(guix-system): Support it.
* doc/guix.texi (Invoking guix system): Document it.
2019-02-13 16:19:54 +01:00
Ludovic Courtès 201253674b
pull: Speed up the new/upgraded package computation.
* guix/scripts/pull.scm (new/upgraded-packages): OLD no longer stores
all the versions of each package.  Remove 'vhash-fold*' call and reduce
the number of 'version>?' calls when computing UPGRADED.
2019-02-12 23:30:16 +01:00
Ludovic Courtès cf0eacceb4
pull: Move profile comparison to 'new/upgraded-packages'.
* guix/scripts/pull.scm (new/upgraded-packages): New procedure, with
code formerly in 'display-new/upgraded-packages'.
(display-new/upgraded-packages): Use it.
2019-02-12 23:30:16 +01:00
Ludovic Courtès 46765f82db
pull: Use 'fold-available-packages' for the current package list.
* guix/scripts/pull.scm (display-profile-news): Use
'fold-available-packages' instead of 'fold-packages' to compute OLD.
(profile-package-alist): Use 'inferior-available-packages'.
2019-02-12 23:30:16 +01:00
Ludovic Courtès 2637cfd7a4
Avoid name clash with 'build' from (guix store) and (guix status).
Since commit 976ef2d978, (guix status)
exports 'build', which clashes with 'build' from (guix store).

* build-aux/run-system-tests.scm: Select 'with-status-verbosity'
from (guix status).
* guix/scripts/archive.scm: Likewise.
* guix/scripts/build.scm: Likewise.
* guix/scripts/copy.scm: Likewise.
* guix/scripts/environment.scm: Likewise.
* guix/scripts/pack.scm: Likewise.
* guix/scripts/package.scm: Likewise.
* guix/scripts/pull.scm: Likewise.
* guix/scripts/system.scm: Likewise.
2019-02-11 23:23:28 +01:00
Ludovic Courtès 910d0121a8
pack, vm: Fix incorrect use of 'package-transitive-propagated-inputs'.
In practice the error was not triggered because
'package-transitive-propagated-inputs' currently returns the empty list
for these two packages.

* guix/scripts/pack.scm (gcrypt-sqlite3&co): Remove labels from the
result.
* gnu/system/vm.scm (gcrypt-sqlite3&co): Likewise.
2019-02-11 23:23:28 +01:00
Marius Bakke ebbb7286b9
Merge branch 'master' into core-updates 2019-02-09 21:11:00 +01:00
Ludovic Courtès bc041b3e26
git: Always use the system certificates by default.
'guix pull' was always doing it, and now '--with-branch' & co. will do
it as well.

* guix/git.scm (honor-system-x509-certificates!): New procedure.
(%certificates-initialized?): New variable.
(with-libgit2): Add call to 'honor-system-x509-certificates!'.
* guix/scripts/pull.scm (honor-x509-certificates): Call
'honor-system-x509-certificates!' and fall back to
'honor-lets-encrypt-certificates!'.
2019-02-08 10:41:13 +01:00
Ludovic Courtès 024a6bfba9
guix build: '--with-branch' & co. fetch submodules.
* guix/scripts/build.scm (transform-package-source-branch)[replace]: Add
'recursive?' field to the new package.
2019-02-08 10:41:13 +01:00
Ricardo Wurmus ba88eea2b3
Merge branch 'master' into core-updates 2019-02-06 13:03:26 +01:00
Ludovic Courtès 35ef5bc866
guix package: '-A' no longer lists deprecated packages.
Fixes a regression introduced in
0ea939fb79.

* guix/scripts/package.scm (process-query) <'list-available>: Change
 #:superseded? to #:deprecated? since that's what
 'fold-available-packages' passes.
2019-02-01 19:28:49 +01:00
Ludovic Courtès 2790b6670b
pull: Default to verbosity level 1.
* guix/scripts/pull.scm (%default-options): Change 'verbosity to 1.
2019-01-29 12:09:53 +01:00
Ludovic Courtès d1d72830f2
pull: Don't trigger 'hash guix' hint needlessly.
Previously if ~/.config/guix/current/bin was in $PATH, we'd still
suggest to run 'hash guix' because we'd compare (which "guix") against
/var/guix/profiles/per-user/….

* guix/scripts/pull.scm (build-and-install): Check whether (which
"guix") matches PROFILE or its user-friendly variant.
2019-01-28 23:13:40 +01:00
Ludovic Courtès bd414e273c
weather: Add '--coverage'.
* guix/scripts/weather.scm (show-help, %options): Add '--coverage'.
(package-partition-boundary, package->output-mapping)
(substitute-oracle, report-package-coverage-per-system)
(report-package-coverage): New procedures.
(guix-weather): Honor '--coverage'.
* doc/guix.texi (Invoking guix weather): Document it.
2019-01-25 14:06:37 +01:00
Ludovic Courtès af77219e8a
refresh: Better account for private and generated packages.
Until now, private and generated packages (e.g., those created by
'texlive-union') we missing from the list passed to 'node-back-edges',
which would lead to inaccurate dependent counts.

Previously we'd get:

  $ guix refresh -l texlive-fonts-cm
  Building the following 80 packages would ensure 116 dependent packages
  are rebuilt: …

Now we have:

  $ Building the following 240 packages would ensure 597 dependent
  packages are rebuilt: …

* guix/scripts/refresh.scm (list-dependents): Call 'package-closure'.
2019-01-25 14:06:37 +01:00
Ludovic Courtès 4d6ce0f12c
refresh: Fix format string that would lead '-l' to print incorrect numbers.
The skip "~*" argument was misplaced, leading the number of dependents
to be skipped (instead of the number of covering packages.)  Thus, we'd
get:

  $ guix refresh -l ocaml4.02-ppx-deriving@4.1
  Building the following package would ensure 1 dependent packages are rebuilt: bap@1.3.0

instead of:

  Building the following package would ensure 26 dependent packages are rebuilt: bap@1.3.0

* guix/scripts/refresh.scm (list-dependents): Move "~*" in the right
place, to skip (length covering) rather than (length dependents).
2019-01-25 14:06:37 +01:00
Ludovic Courtès 731c1a20bc
weather: Ignore deprecated packages but not hidden packages.
* guix/scripts/weather.scm (all-packages): Pass #:select? to
'fold-packages'.
2019-01-25 14:06:37 +01:00
Ludovic Courtès 02ec889e6b
offload: 'status' reports the time difference.
* guix/scripts/offload.scm (check-machine-status): Report the time
difference for each MACHINE.
2019-01-22 23:04:05 +01:00
Ludovic Courtès f9e8a12379
store: Rename '&nix-error' to '&store-error'.
* guix/store.scm (&nix-error): Rename to...
(&store-error): ... this, and adjust users.
(&nix-connection-error): Rename to...
(&store-connection-error): ... this, and adjust users.
(&nix-protocol-error): Rename to...
(&store-protocol-error): ... this, adjust users.
(&nix-error, &nix-connection-error, &nix-protocol-error): Define these
condition types and their getters as deprecrated aliases.
* build-aux/run-system-tests.scm, guix/derivations.scm,
guix/grafts.scm, guix/scripts/challenge.scm,
guix/scripts/graph.scm, guix/scripts/lint.scm,
guix/scripts/offload.scm, guix/serialization.scm,
guix/ssh.scm, guix/tests.scm, guix/ui.scm,
tests/derivations.scm, tests/gexp.scm, tests/guix-daemon.sh,
tests/packages.scm, tests/store.scm, doc/guix.texi: Adjust to use the
new names.
2019-01-21 23:09:55 +01:00
Ludovic Courtès c49b45c917
pull: Add missing import.
Fixes <https://bugs.gnu.org/34136>.
Reported by Pierre Neidhardt <mail@ambrevar.xyz>.

Fixes wrong-type-arg crash of "guix pull -p /does-not-exist -l".

* guix/scripts/pull.scm: Use (srfi srfi-34).
2019-01-20 23:54:54 +01:00
Efraim Flashner 4e1f9a2f2c
lint: check-source-unstable-tarball: Don't assume uri length.
* guix/scripts/lint.scm (check-source-unstable-tarball): Replace third
with code to make sure there are enough elements to check.
2019-01-20 11:43:28 +02:00
Ludovic Courtès 3bbd6919bd
pull: Suggest running 'hash guix' if needed.
Fixes <https://bugs.gnu.org/33647>.
Suggested by Diego Nicola Barbato <dnbarbato@posteo.de>.

* guix/scripts/pull.scm (build-and-install): Before returning, display a
hint if (which "guix") is not in PROFILE.
2019-01-18 17:51:34 +01:00
Ricardo Wurmus 8e9ca3ea2c
scripts: Fix typo.
* guix/scripts/download.scm (show-help): Fix typo.
2019-01-17 17:58:35 +01:00
Ludovic Courtès 0ea939fb79
guix package: '--list-available' can use data from the cache.
* gnu/packages.scm (fold-available-packages): New procedure.
* guix/scripts/package.scm (process-query): Use it instead of
'fold-packages'.
* tests/packages.scm ("fold-available-packages with/without cache"):
New test.
2019-01-15 20:24:09 +01:00
Ludovic Courtès ee8099f5b6
edit: Use 'specification->location' to read information from the cache.
That way 'guix edit' doesn't need to load any package module.

* gnu/packages.scm (find-package-locations, specification->location):
New procedures.
* guix/scripts/edit.scm (package->location-specification): Rename to...
(location->location-specification): ... this.  Expect a location object
instead of a package.
(guix-edit): Use 'specification->location' instead of
'specification->package'.
* tests/packages.scm ("find-package-locations")
("find-package-locations with cache")
("specification->location"): New tests.
2019-01-15 20:24:09 +01:00
Ludovic Courtès 5fbdc9a5aa
channels: Compute a package cache and use it.
* gnu/packages.scm (cache-is-authoritative?, load-package-cache)
(cache-lookup, generate-package-cache): New procedures.
(%package-cache-file): New variable.
(find-packages-by-name): Rename to...
(find-packages-by-name/direct): ... this.
(find-packages-by-name): Rewrite to use the package cache when
'cache-is-authoritative?' returns true.
* tests/packages.scm ("find-packages-by-name + version, with cache")
("find-packages-by-name with cache"): New tests.
* guix/channels.scm (package-cache-file): New procedure.
(%channel-profile-hooks): New variable.
(channel-instances->derivation): Use it in #:hooks.
* guix/scripts/package.scm (build-and-use-profile): Add #:hooks and
honor it.
* guix/scripts/pull.scm (build-and-install): Pass #:hooks to
UPDATE-PROFILE.
2019-01-15 20:24:09 +01:00
Ludovic Courtès 465a0d65ae
guix package: Avoid 'find-newest-available-packages'.
* guix/scripts/package.scm (transaction-upgrade-entry): Use
'find-best-packages-by-name' instead of
'find-newest-available-packages'.
* tests/packages.scm ("transaction-upgrade-entry, zero upgrades")
("transaction-upgrade-entry, one upgrade")
("transaction-upgrade-entry, superseded package"): Adjust accordingly.
2019-01-15 20:24:09 +01:00
Ludovic Courtès 35225dc579
guix package: '--upgrade' preserves package order.
Fixes <https://bugs.gnu.org/31142>.
Reported by Chris Marusich <cmmarusich@gmail.com>.

* guix/scripts/package.scm (options->installable)[upgraded]: Use 'fold'
instead of 'fold-right'.  This reverts
eca16a3d1d.
* tests/guix-package-net.sh: Add 'guix package u' test.
2019-01-15 12:05:25 +01:00
Ludovic Courtès 0ee1e47edb
copy: Add '--verbosity'.
This fixes a regression introduced in
f1de676ea8 since %DEFAULT-OPTIONS was
missing the 'debug key that 'set-build-options-from-command-line'
expects.

* guix/scripts/copy.scm (show-help, %options): Add '--verbosity'.
(%default-options): Rename 'verbosity' to 'debug'.  Add
'print-build-trace?', 'print-extended-build-trace?',
'multiplexed-build-output?', and 'verbosity'.
(guix-copy): Wrap body in 'with-status-verbosity'.
2019-01-14 23:43:49 +01:00
Ludovic Courtès 60029204ee
pull: Don't prepend "origin/" to branch names.
This is a followup to 37a6cdbf1b.

* guix/scripts/pull.scm (%options): Don't prepend "origin/" to branch
names.
2019-01-14 23:43:49 +01:00
Ricardo Wurmus 7e634c2f53
refresh: Suggest input changes when updating.
* guix/upstream.scm (<upstream-source>)[input-changes]: New field.
(<upstream-input-change>): New record.
(upstream-input-change?, upstream-input-change-name,
upstream-input-change-type, upstream-input-change-action, changed-inputs): New
procedures.
(package-update): Pass along input changes.
* guix/script/refresh.scm (update-package): Process input changes.
2019-01-12 23:35:11 +01:00
Ludovic Courtès f1de676ea8
guix build: Re-purpose '--verbosity' and add '--debug'.
The previous '--verbosity' option was misleading and rarely what users
were looking for.  The new option provides a consistent way to choose
whether or not to display the build log.

* guix/scripts/build.scm (show-build-options-help): Remove "--verbosity"
and add "--debug".
(set-build-options-from-command-line): Use the 'debug key of OPTS for
 #:verbosity.
(%standard-build-options): Change "verbosity" to "debug".  Use
'string->number*' instead of 'string->number'.
(%default-options): Change 'verbosity to 'debug and add a 'verbosity
key.
(show-help): Add '--verbosity'.
(%options): Likewise, and change '--quiet' to set the 'verbosity key of
RESULT.
(guix-build): Use 'with-status-verbosity' instead of parameterizing
CURRENT-BUILD-OUTPUT-PORT, honor the 'verbosity key of OPTS, and remove
'quiet?'.
* guix/scripts/environment.scm (show-help, %options): Add '--verbosity'.
(%default-options): Add 'debug'.
(guix-environment): Honor the 'verbosity key of OPTS.
* guix/scripts/pack.scm (%default-options): Add 'debug.
(%options, show-help): Add '--verbosity'.
(guix-pack): Honor the 'verbosity key of OPTS.
* guix/scripts/package.scm (%default-options): Add 'debug.
(show-help, %options): Add '--verbosity'.  Mark '--verbose' as
deprecated and change it to set 'verbosity.
(guix-package): Honor the 'verbosity key of OPTS and remove 'verbose?'.
* guix/scripts/pull.scm (%default-options): Add 'debug.
(show-help, %options): Add '--verbosity'.
(guix-pull): Honor the 'verbosity key of OPTS.
* guix/scripts/system.scm (show-help, %options): Add '--verbosity'.
(%default-options): Add 'debug.
(guix-system): Honor the 'verbosity key of OPTS.
* guix/scripts/archive.scm (%default-options): Add 'debug,
'print-build-trace?, 'print-extended-build-trace?, and
'multiplexed-build-output?.
(show-help, %options): Add '--verbosity'.
(export-from-store): Remove call to 'set-build-options-from-command-line'.
(guix-archive): Wrap body in 'with-status-verbosity'. Add call to
'set-build-options-from-command-line.
* doc/guix.texi (Common Build Options): Document '--verbosity' and
'--debug'.
(Additional Build Options): Adjust description of '--quiet'.
2019-01-11 12:14:38 +01:00
Ludovic Courtès 7804c45b9c
status: Add 'with-status-verbosity'.
* guix/status.scm (logger-for-level, call-with-status-verbosity): New
procedures.
(with-status-verbosity): New macro.
* guix/scripts/environment.scm (guix-environment): Use
'with-status-verbosity' instead of 'with-status-report'.
* guix/scripts/pack.scm (guix-pack): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/pull.scm (guix-pull): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* build-aux/run-system-tests.scm (run-system-tests): Likewise.
2019-01-11 12:14:38 +01:00
Ludovic Courtès 7489207ff7
refresh: Turn on warnings when '--manifest' is used.
* guix/scripts/refresh.scm (guix-refresh): Set WARN? when '-m' is used.
2019-01-11 12:14:38 +01:00
Ludovic Courtès fca43e14f7
refresh: Refactor option handling and '--recursive'.
This allows us to combine '--recursive' with other options (-u, -m,
etc.), turns off warnings when '--recursive' is used, and avoids the
hazards of I/O in the presence of multithreading.

* guix/scripts/refresh.scm (options->packages): New procedure, with code
formerly in 'guix-refresh'.
(refresh-recursive): Remove.
(guix-refresh)[keep-newest, core-package?, args-packages, packages]:
Remove.
[warn?]: Set to #f when RECURSIVE? is true.
Call 'options->packages' in monadic context.
2019-01-11 12:14:38 +01:00
Arun Isaac 40fa21c22e
guix: lint: Warn only if GitHub URI is not same as the package URI.
* guix/scripts/lint.scm (check-github-url): Warn only if the GitHub URI
obtained after following redirects is not same as the original URI.
* tests/lint.scm ("github-url: already the correct github url"): New test.
2019-01-10 15:39:35 +05:30
Ludovic Courtès 76832d3420
Remove most uses of the _IO*F constants.
These constants, for use with 'setvbuf', were deprecated in Guile 2.2
and disappeared in Guile 3.0.  Here we keep these constants in
build-side code where removing them is not feasible.

* guix/build/download-nar.scm (download-nar): Adjust 'setvbuf' calls to
the Guile 2.2+ API.
* guix/build/download.scm (open-socket-for-uri): Likewise.
(open-connection-for-uri, url-fetch): Likewise.
* guix/build/make-bootstrap.scm (make-stripped-libc): Likewise.
* guix/build/union.scm (setvbuf) [guile-2.0]: New conditional wrapper.
(union-build): Adjust to new API.
* guix/ftp-client.scm (ftp-open, ftp-list, ftp-retr): Likewise.
* guix/http-client.scm (http-fetch): Likewise.
* guix/inferior.scm (proxy): Likewise.
* guix/scripts/substitute.scm (fetch, http-multiple-get): Likewise.
* guix/self.scm (compiled-modules): Likewise.
* guix/ssh.scm (remote-daemon-channel, store-import-channel)
(store-export-channel): Likewise.
* guix/ui.scm (initialize-guix): Likewise.
* tests/publish.scm (http-get-port): Likewise.
* guix/store.scm (%newlines): Adjust comment.
2019-01-09 14:47:53 +01:00
Ludovic Courtès a65177a657
maint: Remove 'cond-expand' forms for Guile 2.0.
Note: Leave 'cond-expand' forms used in the build-side modules that can
run on %BOOTSTRAP-GUILE, which is currently Guile 2.0.

* guix/build/compile.scm: Move 'use-modules' clause from 'cond-expand'
to 'define-module' form.
(%default-optimizations): Remove 'cond-expand'.
* guix/build/download.scm (tls-wrap): Remove 'cond-expand'.
* guix/build/syscalls.scm: Remove 'cond-expand' form around
'%set-automatic-finalization-enabled?!' and
'without-automatic-finalization'.
* guix/inferior.scm (port->inferior): Remove 'cond-expand'.
* guix/scripts/pack.scm (wrapped-package)[build]: Remove 'cond-expand'.
* guix/status.scm (build-event-output-port): Remove 'cond-expand'.
* guix/store.scm (open-inet-socket): Remove 'cond-expand'.
* guix/ui.scm (install-locale): Remove 'cond-expand'.
* tests/status.scm ("current-build-output-port, UTF-8 + garbage"):
Remove 'cond-expand'.
* tests/store.scm ("current-build-output-port, UTF-8 + garbage"):
Remove 'cond-expand'.
2019-01-09 14:47:53 +01:00
Ludovic Courtès a21a906fcd
pull: Document '--system'.
Fixes <https://bugs.gnu.org/34010>.
Reported by Alex Kost <alezost@gmail.com>.

This is a followup to 5923102f7b.

* guix/scripts/pull.scm (show-help): Add '--system'.
2019-01-08 18:38:15 +01:00
Julien Lepiller 6090b0beb0
import: opam: Add recursive option.
* guix/script/import/opam.scm: Add recursive option.
* guix/import/opam.scm (opam->guix-package): return two values.
(opam-recursive-import): New variable.
2019-01-07 22:05:43 +01:00
Ludovic Courtès 54ddb6a154
lint: Avoid 'dirname' call at the top level.
* guix/scripts/lint.scm (%distro-directory): Wrap in 'mlambda'.
(check-patch-file-names): Adjust accordingly.
2019-01-07 14:41:00 +01:00
Ludovic Courtès 012bf5c4c0
lint: Rename checker to 'github-url'.
* guix/scripts/lint.scm (%checkers): Rename 'github-uri' to 'github-url'
to match the documentation.
2019-01-06 00:22:05 +01:00
Ludovic Courtès ec651f2562
guix build: Honor '--system' for file-like objects and gexps.
Fixes a bug whereby "guix build -f file.scm -s SYSTEM" would not honor
SYSTEM when 'file.scm' returns a gexp or a file-like object.

* guix/scripts/build.scm (options->derivations): Pass #:system to
'run-with-store' in the 'file-like?' and 'gexp?' cases.
2019-01-05 00:08:04 +01:00
Efraim Flashner c180017b6f
lint: Check for unstable tarballs.
* guix/scripts/lint.scm (check-source-unstable-tarball): New procedure.
(%checkers): Add it.
* tests/lint.scm ("source-unstable-tarball", "source-unstable-tarball:
source #f", "source-unstable-tarball: valid", "source-unstable-tarball:
package named archive", "source-unstable-tarball: not-github",
"source-unstable-tarball: git-fetch"): New tests.
* doc/guix.texi (Invoking guix lint): Document it.
2018-12-27 14:55:54 +02:00
Ludovic Courtès 5923102f7b
pull: Add '--system'.
* guix/scripts/pull.scm (%options): Add '--system'.
(guix-pull): Honor it.
* doc/guix.texi (Invoking guix pull): Document it.
2018-12-27 12:08:25 +01:00
Ludovic Courtès 0ef595b996
offload: Remove unnecessary locking on machine slots.
This extra level of locking turned out to be unnecessary.

* guix/scripts/offload.scm (with-machine-lock): Remove.
(machine-lock-file): Remove.
(acquire-build-slot): Remove surrounding 'with-machine-lock'.
2018-12-26 18:40:49 +01:00
Ludovic Courtès 7f4d102c2f
offload: Remove the "machine choice" lock.
This lock was unnecessary and it led to a contention when many 'guix
offload' processes are polling for available machines.

* guix/scripts/offload.scm (machine-choice-lock-file): Remove.
(choose-build-machine): Remove surrounding 'with-file-lock (machine-lock-file)'.
2018-12-26 18:40:49 +01:00
Ludovic Courtès 10b2834f82
offload: Adjust 'test' and 'status' to the latest changes.
This is a followup to ed7b44370f71126087eb953f36aad8dc4c44109f;
following that commit, 'guix offload test' and 'guix offload status'
would abort with a backtrace instead of clearly diagnosing a missing
'guix' command on the build machine.

* guix/scripts/offload.scm (assert-node-has-guix): Call 'leave' when
NODE is not an inferior.  Remove 'catch' blocks for 'node-repl-error'.
(check-machine-availability): Invoke 'assert-node-has-guix' first.
(check-machine-status): Print a warning when 'remote-inferior' returns #f.
2018-12-25 17:13:43 +01:00
Ludovic Courtès ed7b44370f
offload: Use (guix inferior) instead of (ssh dist node).
Using inferiors and thus 'guix repl' simplifies setup on build
machines (no need to worry about GUILE_LOAD_PATH etc.)

Furthermore, the 'guix repl -t machine' protocol running in a remote
pipe addresses several issues with the current implementation of nodes
and RREPLs in Guile-SSH: fewer round trips, doesn't leave a 'guile
--listen' process behind it, stateless (since a new process is started
each time), more efficient (the SSH channel can be reused), more
reliable (no 'pgrep', 'pkill', and shellology; see
<https://github.com/artyom-poptsov/guile-ssh/issues/11> as an example.)

* guix/ssh.scm (inferior-remote-eval): New procedure.
(send-files): Use it instead of 'make-node' and 'node-eval'.
* guix/scripts/offload.scm (node-guile-version): New procedure.
(node-free-disk-space, transfer-and-offload, node-load)
(choose-build-machine, assert-node-has-guix): Use 'remote-inferior'
instead of 'make-node' and 'inferior-eval' instead of 'node-eval'.
(assert-node-can-import, assert-node-can-export): Likewise, and add
'session' parameter.
(check-machine-availability): Likewise, and add calls to
'close-inferior' and 'disconnect!'.
(check-machine-status): Likewise.
* doc/guix.texi (Daemon Offload Setup): Remove bit related to 'guile' in
$PATH and $GUILE_LOAD_PATH; mention 'guix' alone.
2018-12-24 16:06:32 +01:00
Efraim Flashner c39491829a
scripts: refresh: Allow searching recursively.
* guix/scripts/refresh.scm (refresh-recursive, list-transitive): New
procedures.
(show-help): Document it.
(guix-refresh): Add flags and checks for new options.
* doc/guix.texi (Invoking guix refresh): Document new options.
2018-12-24 12:19:17 +02:00
Arun Isaac 0865d8a8f6
guix: lint: Check for source URIs redirecting to GitHub.
* guix/scripts/lint.scm (check-github-uri): New procedure.
(%checkers): Add it.
* doc/guix.texi (Invoking guix lint): Document it.
* tests/lint.scm ("github-url", "github-url: one suggestion"): New tests.
2018-12-24 08:15:17 +05:30
Ludovic Courtès 62b845c5e2
offload: Display the normalized load in 'guix offload status' output.
Fixes a regression introduced in
bbe66a530a whereby the actual
load (non-normalized) would be displayed.

* guix/scripts/offload.scm (check-machine-status): Add call to
'normalized-load'.
2018-12-23 22:14:15 +01:00
Ludovic Courtès b96e05aefd
offload: Recognize build failures due to lack of disk space.
Previously, if a remote build would fail due to lack of disk space, this
would be considered a permanent failure and thus cached as a build
failure if the local daemon runs with '--cache-failures'.

* guix/scripts/offload.scm (transfer-and-offload): Upon
'nix-protocol-error?' call 'node-free-disk-space' and return 1 instead
of 100 if the result if lower than 10 MiB.
2018-12-21 23:50:13 +01:00
Ludovic Courtès 63b0c3eacc
offload: Skip machines that are low on disk space.
Fixes <https://bugs.gnu.org/33378>.

* guix/scripts/offload.scm (node-free-disk-space): New procedure.
(%minimum-disk-space): New variable.
(choose-build-machine): Call 'node-free-disk-space' and take it into
account in addition to LOAD.
(check-machine-status): Display the free disk space.
2018-12-21 23:50:13 +01:00
Ludovic Courtès bbe66a530a
offload: Decompose 'machine-load' into simpler procedures.
* guix/scripts/offload.scm (machine-load): Remove.
(node-load, normalized-load): New procedures.
(choose-build-machine): Call 'open-ssh-session' and 'make-node' from
here; pass the node to 'node-load'.
(check-machine-status): Use 'node-load' instead of 'machine-load'.  Call
'disconnect!' on SESSION.
2018-12-21 23:50:13 +01:00
Ludovic Courtès 86974d8a92
Merge branch 'master' into core-updates 2018-12-20 18:39:04 +01:00
Ludovic Courtès b334674fe5
Use 'mapm' instead of 'sequence' + 'map'.
Previously we'd use the (sequence M (map P L)) idiom just because 'mapm'
was slower (not specialized for the given monad).  This is no longer the
case since commit dcb95c1fc9.

* guix/gexp.scm (lower-inputs): Use (mapm M P L) instead of (sequence
M (map P L)).
(lower-references, gexp->sexp, imported-files): Likewise.
* guix/profiles.scm (profile-derivation): Likewise.
* guix/scripts/environment.scm (inputs->requisites): Likewise.
* guix/scripts/system.scm (copy-closure): Likewise.
2018-12-19 23:52:24 +01:00
swedebugia bd5a81f9b8
guix system: Clarify the three strategies available.
* guix/scripts/system.scm (show-help): Clarify the three choices.
* doc/guix.texi (Invoking guix system): Add 3 @cindex to make on-error=strategy
easier to find.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-12-18 16:04:25 +01:00
Ludovic Courtès 9b9de08477
publish: Add a 'Cache-Control' header on /nar responses.
Fixes <https://bugs.gnu.org/33721>.
Reported by Chris Marusich <cmmarusich@gmail.com>.

* guix/scripts/publish.scm (render-nar/cached): Add #:ttl and honor it.
(make-request-handler): Pass #:ttl to 'render-nar/cached'.
* tests/publish.scm ("with cache, uncompressed"): Pass "--ttl=42h" to
'guix publish'.  Check 'Cache-Control' on narinfo response and on nar
response.
2018-12-17 23:33:42 +01:00
Ludovic Courtès a93c160631
environment: Support package transformation options.
Fixes <https://bugs.gnu.org/33776>.
Reported by Adrien Guilbaud <adrien.guilbaud@inria.fr>.

* guix/scripts/environment.scm (show-help): Add call to
'show-transformation-options-help'.
(%options): Add %TRANSFORMATION-OPTIONS.
(options/resolve-packages): Add 'store' parameter.
[transform, package->manifest-entry*]: New procedures.
Use 'package->manifest-entry*' instead of 'package->manifest-entry'.
(guix-environment): Move definition of 'manifest' within 'with-store'.
* tests/guix-environment.sh: Add test.
2018-12-17 23:33:42 +01:00
Ludovic Courtès 60b04024f8
substitute: Ignore irrelevant narinfo signatures.
Fixes <https://bugs.gnu.org/33733>.

Fixes a bug whereby 'guix substitute' would accept narinfos whose
signature does not cover the StorePath/NarHash/References tuple.

* guix/scripts/substitute.scm (narinfo-sha256)[%mandatory-fields]: New
variable.
Compute SIGNED-FIELDS; return #f unless each of the %MANDATORY-FIELDS
is among SIGNED-FIELDS.
 * tests/substitute.scm ("query narinfo with signature over nothing")
("query narinfo with signature over irrelevant bits"): New tests.
2018-12-14 00:02:59 +01:00
Marius Bakke b03e4fd526
Merge branch 'master' into core-updates 2018-12-11 22:18:05 +01:00
Eric Bavier cba7ddcf60
refresh: Account for overlapping updater coverage.
* guix/scripts/refresh.scm (list-updaters-and-exit): Do not assume updater
predicates are disjoint.  Track covered packages directly.
2018-12-10 19:59:01 -06:00
Ludovic Courtès 6ddc63e599
guix system: Fix bootloader config file generation by 'guix system roll-back'.
Fixes <https://bugs.gnu.org/33623>.
Reported by Diego Nicola Barbato <dnbarbato@posteo.de>.

Regression introduced in commit
46c296dcc4.

* guix/scripts/system.scm (reinstall-bootloader): Add call to
'lower-object'.
2018-12-07 15:14:12 +01:00
Ludovic Courtès ed9c8eb4e5
describe: In 'channels' format, quote the channel name.
Fixes a regression introduced in
commit 8548f99549.

* guix/scripts/describe.scm (channel->sexp): Quote the channel name.
2018-12-07 15:14:12 +01:00
Ludovic Courtès 9300e2e893
refresh: '--list-dependents' ignores deprecated packages.
* guix/scripts/refresh.scm (all-packages): Filter out deprecated packages.
2018-12-04 10:57:56 +01:00
Ludovic Courtès 0a5fa004f7
build: Default to https://ci.guix.info for substitutes.
* config-daemon.ac (guix_substitute_urls): Always default to
"https://ci.guix.info".
* doc/guix.texi (SUBSTITUTE-SERVER): Switch to ci.guix.info.
* guix/scripts/build.scm (%default-log-urls): Likewise.
* guix/scripts/substitute.scm (%default-substitute-urls): Likewise.
* guix/store.scm (%default-substitute-urls): Likewise.
2018-12-04 10:57:56 +01:00
Ludovic Courtès 0bc02becca
Remove most references to hydra.gnu.org.
* Makefile.am (assert-binaries-available): Don't mention hydra.gnu.org
in comment.
* build-aux/check-available-binaries.scm: Likewise.
* build-aux/check-final-inputs-self-contained.scm: Likewise.
* doc/guix.texi (SUBSTITUTE-SERVER): New variable.
Use it throughout instead of "mirror.hydra.gnu.org".
* doc/contributing.texi (Submitting Patches): Likewise.
* gnu/services/base.scm (hydra-key-authorization)
(guix-activation): Remove mentions of "hydra.gnu.org" in comments and
messages.
* gnu/system/install.scm (%installation-services): Likewise.
* guix/scripts/size.scm (guix-size): Likewise.
2018-12-04 10:57:56 +01:00
Oleg Pykhalov 37c6f11f8d
repl: Load user's initialization file.
* guix/scripts/repl.scm (guix-repl): Load user's initialization file.
2018-12-03 08:04:51 +03:00
Ludovic Courtès b18f7234aa
guix build: Add '--with-commit'.
* guix/git.scm (<git-checkout>)[commit]: New field.
(git-checkout-compiler): Honor it.
* guix/scripts/build.scm (evaluate-git-replacement-specs): Add 'proc'
parameter and honor it.
(transform-package-source-branch)[replace]: New procedure.
Adjust 'evaluate-git-replacement-specs' accordingly.
(transform-package-source-commit): New procedure.
(%transformations, %transformation-options)
(show-transformation-options-help): Add 'with-commit'.
* tests/guix-build-branch.sh: Add test.
* doc/guix.texi (Package Transformation Options): Document it.
2018-11-30 17:03:04 +01:00
Ludovic Courtès 96915a448c
guix build: Add '--with-branch' transformation option.
* guix/scripts/build.scm (evaluate-git-replacement-specs)
(transform-package-source-branch): New procedures.
(%transformations, %transformation-options): Add 'with-branch'.
(show-transformation-options-help): Likewise.
* tests/guix-build-branch.sh: New file.
* Makefile.am (SH_TESTS): Add it.
* doc/guix.texi (Package Transformation Options): Document it.
2018-11-30 17:03:04 +01:00
Tim Gesthuizen e91152e9f2
guix hash: Fix version and help messages
ca71942445 changes the name of the executable to
be displayed by the --version and --help commands of `guix hash` to
"gcrypt hash".
This is reverted by this commit.

* guix/scripts/hash.scm (show-help): Change string literals

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-11-28 10:39:58 +01:00
Efraim Flashner db08ea4087
pack: List the available formats.
* guix/scripts/pack.scm (show-formats): New variable.
(%options, show-help): Add 'list-formats' option.
2018-11-27 19:23:39 +02:00
Oleg Pykhalov 01262f1ece
describe: Delete 'directory' argument from 'display-checkout-info'.
This commit follows 1255400faa.

* guix/scripts/describe.scm (display-checkout-info): Delete 'directory'
argument.
2018-11-27 20:09:03 +03:00
Oleg Pykhalov 3133d678a8
repl: Do not exit repl on SIGINT.
* guix/scripts/repl.scm (guix-repl): Do not exit repl on SIGINT.
2018-11-26 15:08:05 +03:00
Ludovic Courtès 08f410834b
pack: Add '--profile-name'.
* guix/scripts/pack.scm (self-contained-tarball): Add #:profile-name and
honor it.
(squashfs-image, docker-image): Add #:profile-name.
(%default-options): Add 'profile-name'.
(%options, show-help): Add "--profile-name".
(guix-pack): Honor it.
* tests/guix-pack-localstatedir.sh: New file.
* Makefile.am (SH_TESTS): Add it.
* doc/guix.texi (Invoking guix pack): Document "--profile-name".
2018-11-23 15:42:01 +01:00
Oleg Pykhalov 85e9c4b919
describe: Add recutils format.
* guix/scripts/describe.scm (channel->recutils): New procedure.
(display-checkout-info, display-profile-info): Use this.
(%options): Add 'recutils' option.
* doc/guix.texi (Invoking guix describe): Document this.
2018-11-22 21:17:55 +03:00
Oleg Pykhalov 81a40ee0cb
describe: Add json format.
* guix/scripts/describe.scm (channel->json): New procedure.
(display-checkout-info, display-profile-info): Use this.
(%options): Add 'json' option.
* doc/guix.texi (Invoking guix describe): Document this.
2018-11-22 21:17:54 +03:00
Oleg Pykhalov 8548f99549
describe: Use a procedure to format output.
* guix/scripts/describe.scm (channel->sexp): New procedure.
(display-checkout-info, display-profile-info): Use this.
2018-11-22 21:17:38 +03:00
Ludovic Courtès a29ce1f97d
guix system: Fix 'init' again.
Fixes a regression introduced in
52ee4479ef, whereby 'install' would now be
passed a procedure instead of a lowerable object.

* guix/scripts/system.scm (perform-action): Pass BOOTLOADER-SCRIPT as
the #:bootloader-installer argument of 'install'.
2018-11-21 23:26:58 +01:00
Oleg Pykhalov 1255400faa
describe: Add profile option.
* guix/scripts/describe.scm (%options): Add profile option.
(show-help): Document this.
(display-checkout-info): Check for profile argument.
* doc/guix.texi (Invoking guix describe): Document this.
2018-11-21 14:41:13 +03:00
Oleg Pykhalov 3dd28aa37c
describe: Fix 'format' option.
Fix ‘guix describe’ ignores ‘--format=FORMAT’ option.

* guix/scripts/describe.scm (%options): Fix 'format' option.
2018-11-21 14:41:13 +03:00
Ludovic Courtès 40bbcaa65d
lint: 'check-derivation' fully disables grafts.
Previously grafting could take place indirectly, for instance when
lowering origins.

* guix/scripts/lint.scm (check-derivation)[try]: Parameterize
'%graft?'.
2018-11-20 18:36:05 +01:00
Ludovic Courtès 3b32891b12
lint: 'check-derivation' tries all the package's supported systems.
This allows us to catch architecture-specific evaluation failures.

* guix/scripts/lint.scm (check-derivation): Move body into...
[try]: ... this.  New procedure.
Call 'try' for each supported system of PACKAGE.
2018-11-20 18:36:05 +01:00
Ludovic Courtès 1d6669afef
guix system: Fix 'init'.
Fixes a regression introduced in
52ee4479ef, whereby 'install' would now be
passed a <computed-file> object instead of a derivation.

* guix/scripts/system.scm (install): Call 'lower-object' on BOOTCFG.
2018-11-19 09:59:07 +01:00
Ludovic Courtès ab6caf4f1d
guix system: Clarify 'perform-action'.
* guix/scripts/system.scm (perform-action): Move non-monadic local
variables outside the 'mlet' form.
2018-11-18 23:37:45 +01:00
Ludovic Courtès 52ee4479ef
guix system: De-monadify bootloader installation script.
* guix/scripts/system.scm (bootloader-installer-derivation): Rename
to...
(bootloader-installer-script): ... this.  Use 'scheme-file' instead of
'gexp->file'.
(perform-action): Adjust accordingly.  Move 'lower-object' call to the
point where DRVS is computed.
2018-11-18 23:37:45 +01:00
Ludovic Courtès 6e47628d4c
guix system: Simplify bootloader package handling.
* guix/scripts/system.scm (perform-action): Remove 'bootloader-package'
variable.  Pass (bootloader-package bootloader) as the 2nd argument to
'bootloader-installer-derivation'.  Remove BOOTLOADER-PACKAGE from DRVS
since it's redundant.
2018-11-18 23:37:45 +01:00