Commit Graph

1145 Commits (d422cbb3d6a1cc7e4553a2335b113475a05d68ad)

Author SHA1 Message Date
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
Ludovic Courtès 9782c82217
system: De-monadify 'operating-system-bootcfg'.
* gnu/system.scm (operating-system-bootcfg): Remove 'mlet*' and
'lower-object' call.
* gnu/system/vm.scm (system-disk-image)
(system-qemu-image/shared-store): Adjust accordingly.
* guix/scripts/system.scm (perform-action): Add 'lower-object' call for
BOOTCFG.
2018-11-18 23:37:45 +01:00
Ludovic Courtès 6c843907e9
guix system: Invoking 'guix system init' twice keeps timestamps zeroed.
Fixes a bug whereby running 'guix system init config.scm /mnt' twice
would, on the second run, change timestamps in /mnt/gnu/store from the
Epoch to now.  This is because the 'register-path' call would bypass the
'reset-timestamps' phase altogether in that case, as a consequence of
commit bb3b6ccb05.

Reported by Christopher Baines.

* guix/scripts/system.scm (install): When TARGET/var/guix exists, delete
it.  As a side-effect, this ensures that later on, the 'register-path'
call invokes 'reset-timestamps' on all the copied store items.
2018-11-11 23:53:29 +01:00
Ludovic Courtès 652163154c
guix package: '--show' errors when asked for a non-existent package.
Fixes <https://bugs.gnu.org/33323>.
Reported by swedebugia <swedebugia@riseup.net>.

* guix/scripts/package.scm (process-query): Call 'leave' when
'find-packages-by-name' returns the empty list.
* tests/guix-package.sh: Test it.
2018-11-11 23:53:29 +01:00
Ludovic Courtès ea68b3f652
pull: Add missing monadic 'return'.
Fixes a regression introduced in
5f7dd092ca where, upon completion, 'guix
pull' would fail (instead of printing the new/upgraded packages) with
ugly errors like:

  successfully built /gnu/store/…-profile.drv
  1 package in profile
  Backtrace:
  […]
  In guix/store.scm:
    1605:24  1 (run-with-store _ _ #:guile-for-build _ #:system _ # _)
  In unknown file:
	     0 (_ #<build-daemon 256.97 2476b40>)

  ERROR: Wrong type to apply: #t

Reported by thorwil on #guix.

* guix/scripts/pull.scm (build-and-install): Add missing 'return' when
DRY-RUN? is wrong.
2018-11-07 21:56:16 +01:00
Ludovic Courtès 598a6b87cc
pack: Squashfs backend now honors '--localstatedir'.
* guix/scripts/pack.scm (squashfs-image)[database]: New variable.
[build]: Add (gnu build install) to the closure.  Call
'install-database-and-gc-roots' when DATABASE is true, and invoke
mksquashfs once more.
* tests/pack.scm ("squashfs-image + localstatedir"): New test.
2018-11-06 23:21:24 +01:00
Ludovic Courtès f5a2fb1bfb
pack: Docker backend now honors '--localstatedir'.
* guix/docker.scm (build-docker-image): Add #:database parameter.
Create /var/guix/db, /var/guix/profiles, etc. when DATABASE is true.
* guix/scripts/pack.scm (docker-image): Export.  Remove #:deduplicate?
parameter.  Define 'database' and pass it to 'docker-image'.
* tests/pack.scm (test-assertm): Recompile the derivation of
%BOOTSTRAP-GUILE.
("docker-image + localstatedir"): New test.
2018-11-06 23:21:24 +01:00
Ludovic Courtès b27ef1d46c
pack: Import (guix store database) only when '--localstatedir' is passed.
This is another way to address <https://bugs.gnu.org/32184>, which was
previously addressed in commit 19c924af4f.

* gnu/build/install.scm (register-closure): Move to...
* gnu/build/vm.scm (register-closure): ... here.  New procedure.
* guix/scripts/pack.scm (self-contained-tarball)[build]: Remove
now unneeded 'with-extensions' form and custom (guix config) module.
* tests/guix-pack.sh: Revert the strategy from
commit 19c924af4f.
* tests/pack.scm ("self-contained-tarball"): Likewise.
2018-11-06 23:21:23 +01:00
Ludovic Courtès ec4c81fe32
pack: Move store database creation to a separate derivation.
* guix/scripts/pack.scm (store-database): New procedure.
(self-contained-tarball): Use it when LOCALSTATEDIR? is true.
Remove 'schema' and add 'database'.
[build]: Pass DATABASE to 'populate-single-profile-directory'.
(squashfs-image): Remove #:deduplicate? parameter.
[build]: Remove (gnu build install) and (guix config) from the imported
modules.  Remove 'with-extensions'.
* gnu/build/install.scm (populate-single-profile-directory): Remove
 #:deduplicate?, #:register?, and #:schema; add #:database.  Remove call
to 'register-closure' and simply copy DATABASE instead.
2018-11-06 23:21:23 +01:00
Ludovic Courtès 5f7dd092ca
pull: Make '--dry-run' behave as expected.
* guix/scripts/pull.scm (show-help): Document '--dry-run'.
(build-and-install): Add #:dry-run? parameter and honor it.
(guix-pull): Remove (assoc-ref opts 'dry-run?) condition.  Instead, pass
it as #:dry-run? to 'build-and-install'.
* doc/guix.texi (Invoking guix pull): Document '--dry-run'.  Move
'--verbose' to the bottom.
2018-11-06 00:04:11 +01:00
Ludovic Courtès 63eb2b899b
Add 'guix processes'.
* guix/scripts/processes.scm, tests/processes.scm: New files.
* Makefile.am (MODULES): Add the former.
(SCM_TESTS): Add the latter.
* po/guix/POTFILES.in: Add guix/scripts/processes.scm.
* doc/guix.texi (Invoking guix processes): New node.
(Invoking guix-daemon): Reference it.
2018-10-29 00:13:38 +01:00
Ludovic Courtès 003789e837
pack: Hide 'zip' colliding binding.
* guix/scripts/pack.scm: Hide 'zip' from (gnu packages compression).
2018-10-27 16:39:29 +02:00
Ludovic Courtès 46727e3a9d
pack: Remove unused variable.
* guix/scripts/pack.scm (self-contained-tarball)[libgcrypt]: Remove.
2018-10-27 16:39:29 +02:00
Ludovic Courtès 62a14bd26f
scripts: Suggest running 'guix gc' when we're short on disk space.
* guix/scripts.scm (%disk-space-warning): New variable.
(warn-about-disk-space): New procedure.
* guix/scripts/package.scm (build-and-use-profile): Use it.
* guix/scripts/system.scm (process-action): Likewise.
2018-10-23 01:04:39 +02:00
Ludovic Courtès fbdb7b9526
pack: Fix "-C none -f tarball".
Fixes a regression introduced in
48b444304e whereby "guix pack -C none
hello" would fail with:

  ERROR: In procedure string-join:
  In procedure string-join: Wrong type argument in position 1: #f
  builder for `/gnu/store/…-tarball-pack.tar.drv' failed with exit code 1

* guix/scripts/pack.scm (self-contained-tarball): Adjust for when
'compressor-command' returns #f.
2018-10-19 18:28:57 +02:00
Pierre Neidhardt c4d62443eb
import cran: Document "recursive" option.
* guix/scripts/import/cran.scm: (show-help): Document "recursive" option.
2018-10-17 13:06:25 +02:00
Ludovic Courtès f9a8fce10f
status: Build upon multiplexed build output.
This allows for more accurate status tracking and parsing of extended
build traces.

* guix/status.scm (multiplexed-output-supported?): New procedure.
(print-build-event): Don't print \r when PRINT-LOG? is true.
Adjust 'build-log' handling for when 'multiplexed-output-supported?'
returns true.
(bytevector-index, split-lines): New procedures.
(build-event-output-port)[%build-output-pid, %build-output]
[%build-output-left]: New variables.
[process-line]: Handle "@ build-output" traces.
[process-build-output]: New procedure.
[write!]: Add case for when %BUILD-OUTPUT-PID is true.  Use
'bytevector-index' rather than 'string-index'.
(compute-status): Add #:derivation-path->output-path.  Use it.
* tests/status.scm ("compute-status, multiplexed build output"):
New test.
("build-output-port, UTF-8")
("current-build-output-port, UTF-8 + garbage"): Adjust to new
'build-log' output.
* guix/scripts/build.scm (set-build-options-from-command-line):
Pass #:multiplexed-build-output?.
(%default-options): Add 'multiplexed-build-output?'.
* guix/scripts/environment.scm (%default-options): Likewise.
* guix/scripts/pack.scm (%default-options): Likewise.
* guix/scripts/package.scm (%default-options): Likewise.
* guix/scripts/pull.scm (%default-options): Likewise.
* guix/scripts/system.scm (%default-options): Likewise.
2018-10-15 23:06:55 +02:00
Ludovic Courtès e0caff9ed0
describe: Canonicalize the profile.
Fixes a regression introduced in
795d430d90 whereby 'guix describe' would
no longer display the generation number of ~/.config/guix/current.

* guix/scripts/describe.scm (guix-describe): Call 'canonicalize-profile'.
2018-10-14 23:48:49 +02:00
Ludovic Courtès aa227b3be3
pull: Fix target of /var/guix/profiles/per-user/USER/current-guix.
This is a followup to 8155a20907.

* guix/scripts/pull.scm (migrate-generations): Compute the right target
for /var/guix/profiles/per-user/USER/current-guix.  Previously we'd
return "current-N-link" instead of "current-guix-N-link'.
2018-10-12 16:45:34 +02:00
Ludovic Courtès 8036b0942b
pull: Don't use rename(2) across potentially different devices.
Reported by Formbi on #guix.

* guix/scripts/pull.scm (migrate-generations): Use 'symlink' and
'delete-file' instead of 'rename-file'.  The latter could lead to EXDEV
when $HOME and /var were different partitions.
2018-10-12 15:18:41 +02:00
Ludovic Courtès 8155a20907
pull: Create /var/guix/profiles/per-user/USER/current-guix.
Previously the migration code would fail to create that file, so
~/.config/guix/current would be dangling.

* guix/scripts/pull.scm (migrate-generations): Create
/var/guix/profiles/per-user/USER/current-guix.
2018-10-12 00:13:14 +02:00
Ludovic Courtès 795d430d90
pull: Turn ~/.config/guix/current into a symlink to /var/guix/profiles.
This is more consistent with what 'guix package' does, more pleasant for
users (we no longer clobber ~/.config/guix), and more
cluster-friendly (since /var/guix/profiles is usually an NFS share
already.)

* guix/scripts/pull.scm (%current-profile, %user-profile-directory): New
variables.
(migrate-generations, ensure-default-profile): New procedures.
(guix-pull): Use %CURRENT-PROFILE by default.  Call
'ensure-default-profile'.
* doc/guix.texi (Invoking guix pull): Adjust 'guix package -p
~/.config/guix/current' example.
* guix/scripts.scm (warn-about-old-distro): Check %PROFILE-DIRECTORY
"/current-guix".
2018-10-11 18:29:11 +02:00
Ludovic Courtès 77dcfb4c02
profiles: Add 'ensure-profile-directory'.
* guix/scripts/package.scm (ensure-default-profile): Move
/var/guix/profiles/per-user handling to...
* guix/profiles.scm (ensure-profile-directory): ... here.  New
procedure.
* po/guix/POTFILES.in: Add 'guix/profiles.scm'.
2018-10-11 18:29:11 +02:00
Ludovic Courtès b33e191c86
guix build: '-f' accepts file-like objects.
* guix/scripts/build.scm (options->things-to-build)[validate-type]:
Check for 'file-like?'.
(options->derivations): Accept 'file-like?'.
* tests/guix-build.sh: Add a test with 'computed-file'.
* doc/guix.texi (Additional Build Options): Mention file-like objects.
2018-10-09 18:54:12 +02:00
Ludovic Courtès e54aec7b8e
pull: '-l' now honors '-p'.
* guix/scripts/pull.scm (process-query): Add 'profile' parameter and
remove 'profile' local variable.
(guix-pull): Adjust caller.
2018-10-09 18:54:12 +02:00
Ludovic Courtès 240a9c69a6
perform-download: Optionally report a "download-progress" trace.
* guix/scripts/perform-download.scm (perform-download): Add
 #:print-build-trace? and pass it to 'url-fetch'.
(guix-perform-download): Define 'print-build-trace?' and pass it to
'perform-download'.
* guix/build/download.scm (ftp-fetch): Add #:print-build-trace? and
honor it.
(url-fetch): Likewise.
* nix/libstore/builtins.cc (builtinDownload): Set _NIX_OPTIONS
environment variable.
2018-09-27 23:21:53 +02:00
Ludovic Courtès dc0f74e5fc
Add (guix status) and use it for pretty colored output.
* guix/progress.scm (progress-reporter/trace): New procedure.
(%progress-interval): New variable.
(progress-reporter/file): Use it.
* guix/scripts/build.scm (set-build-options-from-command-line): Pass
 #:print-extended-build-trace?.
(%default-options): Add 'print-extended-build-trace?'.
(guix-build): Parameterize CURRENT-TERMINAL-COLUMNS.  Use
'build-status-updater'.
* guix/scripts/environment.scm (%default-options): Add
'print-extended-build-trace?'.
(guix-environment): Wrap body in 'with-status-report'.
* guix/scripts/pack.scm (%default-options): Add 'print-build-trace?' and
'print-extended-build-trace?'.
(guix-pack): Wrap body in 'with-status-report'.
* guix/scripts/package.scm (%default-options, guix-package): Likewise.
* guix/scripts/system.scm (%default-options, guix-system): Likewise.
* guix/scripts/pull.scm (%default-options, guix-pull): Likewise.
* guix/scripts/substitute.scm (progress-report-port): Don't call STOP
when TOTAL is zero.
(process-substitution): Add #:print-build-trace? and honor it.
(guix-substitute)[print-build-trace?]: New variable.
Pass #:print-build-trace? to 'process-substitution'.
* guix/status.scm: New file.
* guix/store.scm (set-build-options): Add #:print-extended-build-trace?;
pass it into PAIRS.
(%protocol-version): Bump.
(protocol-version, nix-server-version): New procedures.
(current-store-protocol-version): New variable.
(with-store, build-things): Parameterize it.
* guix/ui.scm (build-output-port): Remove.
(colorize-string): Export.
* po/guix/POTFILES.in: Add guix/status.scm.
* tests/status.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
* nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x162.
* nix/libstore/build.cc (DerivationGoal::registerOutputs)
(SubstitutionGoal::finished): Print a "@ hash-mismatch" trace before
throwing.
2018-09-27 23:21:53 +02:00
Carlo Zancanaro 4245ddcbc9
guix system: Load all services on reconfigure, not just stopped ones.
This uses the 'replacement' service slot introduced in the Shepherd
version 0.5.0.

* gnu/services/shepherd.scm (shepherd-service-upgrade): Return a list of
  services that need to be restarted to complete their upgrade.
* guix/scripts/system.scm (call-with-service-upgrade-info): Rename an internal
  variable to reflect the change to shepherd-service-upgrade.
  (upgrade-shepherd-services): Call 'load-services/safe' instead of
  'load-services'.  Print a message about services that need to be
  manually restarted.
* gnu/services/herd.scm (load-services/safe): New procedure.
* doc/guix.texi (Invoking guix system): Document the new behaviour.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2018-09-26 23:40:36 +02:00
Ludovic Courtès 88268a34bc
pull: Try harder to use the host's X.509 certificates.
* guix/scripts/pull.scm (honor-x509-certificates): Use commonly-found
certificate bundles.
2018-09-25 18:45:51 +02:00
Ludovic Courtès f85dbc4f3b
substitute: Progress port really closes underlying port.
* guix/scripts/substitute.scm (progress-report-port): Use 'close-port'
instead of 'close-connection'.  Move 'stop' call first.
2018-09-25 18:45:50 +02:00
Ludovic Courtès 20f8d73fac
pull: Use /etc/ssl/certs by default if it exists and is non-empty.
Previously, on machines where /etc/ssl/certs did exist, we'd have this:

  $ unset SSL_CERT_DIR
  $ unset SSL_CERT_FILE
  $ guix pull
  Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
  guix pull: error: Git error: the SSL certificate is invalid

This is because we'd let OpenSSL look for certificates in its default
location, which is an empty directory in its own prefix.

* guix/scripts/pull.scm (honor-x509-certificates): New procedure.
(guix-pull): Use it instead of calling 'honor-lets-encrypt-certificates!'.
2018-09-18 23:23:44 +02:00
Ludovic Courtès 1d2b542d34
pull: Assume 'set-tls-certificate-locations!' is available.
* guix/scripts/pull.scm (honor-lets-encrypt-certificates!): Call
'set-tls-certificate-locations!' unconditionally.
2018-09-18 23:23:44 +02:00
Ludovic Courtès 912adda316
describe: Work correctly on generation-less profiles.
Previously a command like:

  $(readlink -f ~/.config/guix/current)/bin/guix describe

would succeed without printing anything.

* guix/scripts/describe.scm (display-profile-info): Don't call
'generation-file-name' when NUMBER is zero.
* guix/scripts/pull.scm (display-profile-content): Likewise.
2018-09-18 23:23:44 +02:00
Ludovic Courtès b9e1fddfd8
gnupg: Use 'gpgv' and keybox files; adjust 'guix refresh' accordingly.
* guix/gnupg.scm (%gpgv-command, current-keyring): New variables
(gnupg-verify): Add optional 'keyring' parameter.  Use 'gpgv' instead of
'gpg' and pass it '--keyring'.
(gnupg-receive-keys): Add optional 'keyring' parameter and honor it.
(gnupg-verify*): Add #:keyring and honor it.
* guix/scripts/refresh.scm (%options, show-help): Add '--keyring'.
(guix-refresh): Parameterize CURRENT-KEYRING.
* doc/guix.texi (Invoking guix refresh): Document '--keyring' and the
keybox format.
2018-09-16 23:00:44 +02:00
Ludovic Courtès ebbfc59c21
graph: Add '--system'.
* guix/scripts/graph.scm (%options, show-help): Add '--system'.
(%default-options): Add 'system'.
(guix-graph): Pass #:system to 'run-with-store'.
2018-09-16 23:00:44 +02:00
Ricardo Wurmus 1afd1fbf3c
guix: Do not close current-error-port.
Reported-by: Ludovic Courtès <ludo@gnu.org>.

* guix/scripts/build.scm (guix-build),
guix/scripts/package.scm (guix-package): Duplicate port before handing it to
build-output-port.
2018-09-11 23:19:42 +02:00
Ludovic Courtès 7d05868847
substitute: Ignore exceptions thrown by 'set-thread-name'.
Fixes <https://bugs.gnu.org/32669>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

* guix/scripts/substitute.scm (guix-substitute): Swallow 'system-error'
exceptions around 'set-thread-name' call.
2018-09-10 17:47:52 +02:00
Ricardo Wurmus 15cc7e6adf
ui: Add soft port for styling and filtering build output.
* guix/ui.scm (build-output-port): New procedure.
* guix/scripts/package.scm (%default-options): Print build trace.
(guix-package): Use build-output-port.
* guix/scripts/build.scm (guix-build): Use build-output-port.

Co-authored-by: Sahithi Yarlagadda <sahi@swecha.net>
2018-09-09 23:18:21 +02:00
Ludovic Courtès da34a19f3a
guix describe: Display information about the current generation.
* guix/scripts/describe.scm (display-profile-info)[number]: Use the
current generation number instead of the last generation number.
2018-09-07 14:19:42 +02:00
Ludovic Courtès 2b73d82830
guix package: Record package provenance in manifest entries.
* guix/profiles.scm (package->manifest-entry): Add #:properties and
honor it.
* guix/scripts/package.scm (package-provenance)
(package->manifest-entry*): New procedures.
(transaction-upgrade-entry, options->installable): Use
'package->manifest-entry*' instead of 'package->manifest-entry'.
2018-09-07 11:40:25 +02:00
Ludovic Courtès bd7470185b
Add 'guix describe'.
* guix/scripts/describe.scm: New file.
* Makefile.am (MODULES): Add it.
(SH_TESTS): Add tests/guix-describe.sh.
* po/guix/POTFILES.in: Add it.
* guix/scripts/pull.scm (display-profile-content): Export.
* guix/describe.scm (current-profile, current-profile-entries): Export.
* tests/guix-describe.sh: New file.
* doc/guix.texi (Features): Mention 'guix pull' and provenance tracking.
(Invoking guix pull): Link to 'guix describe'.
(Channels): Likewise.
(Invoking guix describe): New node.
2018-09-07 11:40:22 +02:00
Ludovic Courtès ee94cfeb99
pull: Add '--profile'.
* guix/scripts/pull.scm (show-help, %options): Add '--profile'.
(build-and-install): Change 'config-dir' argument to 'profile'.
(guix-pull): Honor '--profile'.
* doc/guix.texi (Invoking guix pull): Document it.
2018-09-07 11:40:18 +02:00