Commit Graph

1588 Commits

Author SHA1 Message Date
Ludovic Courtès c9c8c6331e
deploy: Gracefully handle errors.
* guix/scripts/deploy.scm (guix-deploy): Wrap body in 'with-error-handling'.
2020-07-30 19:17:20 +02:00
Ludovic Courtès c6c0d5a22c
pack: "fakechroot" execution engine can load its audit module.
Fixes <https://bugs.gnu.org/42558>.

Until now, loading 'pack-audit.so' in a truly non-Guix environment would
usually fail because 'pack-audit.so' depends on 'libgcc_s.so' and
'libc.so', none of which could be found.

Furthermore, the test was not working as expected: the trick

  unshare -mrf sh -c 'mount -t tmpfs none /gnu ; ...'

would allow the fakechroot engine to make its store available as
/gnu/store as a result of another bug.

* gnu/packages/aux-files/run-in-namespace.c (relocated_search_path): New
function.
(exec_with_loader): Pass "--library-path" to the loader.
* guix/scripts/pack.scm (wrapped-package)[build](runpath): New procedure.
(elf-loader-compile-flags): Pass "-DLOADER_AUDIT_RUNPATH".
* tests/guix-pack-relocatable.sh: Remove 'STORE_PARENT'.
(run_without_store): New function.  Erase $NIX_STORE_DIR instead of
$STORE_PARENT.
Use 'run_without_store' throughout.
2020-07-28 14:41:04 +02:00
Ludovic Courtès a396dd01bc
machine: ssh: Check for potential system downgrades.
This is a followup to 8e31736b0a.

* guix/scripts/system/reconfigure.scm (check-forward-update): Add
 #:current-channels.  Use it instead of OLD.
* gnu/services.scm (sexp->system-provenance): New procedure.
(system-provenance): Use it.
* gnu/machine/ssh.scm (<machine-ssh-configuration>)[allow-downgrades?]:
New field.
(machine-check-forward-update): New procedure.
(check-deployment-sanity)[assertions]: Call it.
* doc/guix.texi (Invoking guix deploy): Document 'allow-downgrades?'
field.
2020-07-27 12:06:35 +02:00
Ludovic Courtès 9296a2e511
processes: Allow 'less' to properly estimate line length.
Until now, the first few lines in the output of 'guix processes' could
disappear in 'less'.

* guix/ui.scm (call-with-paginated-output-port): Add #:less-options
parameter and honor it.
(with-paginated-output-port): Allow callers to pass #:less-options.
* guix/scripts/processes.scm (guix-processes): Pass #:less-options to
'with-paginated-output-port'.
2020-07-27 12:06:35 +02:00
Ludovic Courtès 9a6322774d
guix system: Report file system errors using 'report-error'.
* guix/scripts/system.scm (check-file-system-availability)[file-system-location*]:
Return a <location> record instead of a string.
[error]: Use 'report-error' instead of 'format'.
Change callers accordingly.
2020-07-25 19:11:37 +02:00
Ludovic Courtès d51bfe242f
Use 'formatted-message' instead of '&message' where appropriate.
* gnu.scm (%try-use-modules): Use 'formatted-message' instead of
'&message'.
* gnu/machine/digital-ocean.scm (maybe-raise-unsupported-configuration-error):
Likewise.
* gnu/machine/ssh.scm (machine-check-file-system-availability): Likewise.
(machine-check-building-for-appropriate-system): Likewise.
(deploy-managed-host): Likewise.
(maybe-raise-unsupported-configuration-error): Likewise.
* gnu/packages.scm (search-patch): Likewise.
* gnu/services.scm (%service-with-default-value): Likewise.
(files->etc-directory): Likewise.
(fold-services): Likewise.
* gnu/system.scm (locale-name->definition*): Likewise.
* gnu/system/mapped-devices.scm (check-device-initrd-modules): Likewise.
(check-luks-device): Likewise.
* guix/channels.scm (latest-channel-instance): Likewise.
* guix/cve.scm (json->cve-items): Likewise.
* guix/git-authenticate.scm (commit-signing-key): Likewise.
(commit-authorized-keys): Likewise.
(authenticate-commit): Likewise.
(verify-introductory-commit): Likewise.
* guix/remote.scm (remote-pipe-for-gexp): Likewise.
* guix/scripts/graph.scm (assert-package): Likewise.
* guix/scripts/offload.scm (private-key-from-file*): Likewise.
* guix/ssh.scm (authenticate-server*): Likewise.
(open-ssh-session): Likewise.
(remote-inferior): Likewise.
* guix/ui.scm (matching-generations): Likewise.
* guix/upstream.scm (package-update): Likewise.
* tests/channels.scm ("latest-channel-instances, missing introduction for 'guix'"):
Catch 'formatted-message?'.
("authenticate-channel, wrong first commit signer"): Likewise.
* tests/lint.scm ("patches: not found"): Adjust message string.
* tests/packages.scm ("patch not found yields a run-time error"): Catch
'formatted-message?'.
* guix/lint.scm (check-patch-file-names): Handle 'formatted-message?'.
(check-derivation): Ditto.
2020-07-25 19:11:37 +02:00
Ludovic Courtès f9a8dd053c
utils: Move '&fix-hint' to (guix diagnostics).
* guix/utils.scm (&fix-hint): Move to...
* guix/diagnostics.scm (&fix-hint): ... here.
* gnu.scm: Adjust imports accordingly.
* gnu/system/mapped-devices.scm: Likewise.
* guix/channels.scm: Likewise.
* guix/profiles.scm: Likewise.
* guix/scripts/system/reconfigure.scm: Likewise.
* guix/ssh.scm: Likewise.
2020-07-25 19:11:36 +02:00
Ludovic Courtès a553892215
pack: '-R' applies to propagated inputs too.
Fixes <https://bugs.gnu.org/42510>.

* guix/scripts/pack.scm (wrapped-manifest-entry): Recurse on
'dependencies' field.
* tests/guix-pack-relocatable.sh: Add test.
2020-07-24 14:21:30 +02:00
Ludovic Courtès 8e31736b0a
guix system: 'reconfigure' disallows downgrades by default.
This is similar to what 9744cc7b46 did for
'guix pull'.

* guix/scripts/system/reconfigure.scm (ensure-forward-reconfigure)
(warn-about-backward-reconfigure, channel-relations)
(check-forward-update): New procedures.
* guix/scripts/system.scm (perform-action): Add #:validate-reconfigure.
Call 'check-forward-update' when ACTION is 'reconfigure.
(%options, show-help): Add "--allow-downgrades".
(%default-options): Add 'validate-reconfigure' key.
(process-action): Pass #:validate-reconfigure to 'perform-action'.
* doc/guix.texi (Invoking guix system): Document 'guix system describe'
more prominently, and document '--allow-downgrades'.
2020-07-23 00:22:25 +02:00
Ludovic Courtès b3802495f6
pack: Build the store database under a UTF-8 locale.
Fixes <https://bugs.gnu.org/42389>.
Reported by branjam4@gmail.com.

* guix/scripts/pack.scm (store-database)[build]: Add calls to 'setenv'
and 'setlocale'.
* tests/pack.scm ("self-contained-tarball + localstatedir, UTF-8 file
names"): New test.
2020-07-20 23:25:09 +02:00
Ludovic Courtès 181e0dddd6
pack: 'self-contained-tarball' runs derivation in a UTF-8local.
* guix/scripts/pack.scm (self-contained-tarball)
[set-utf8-locale]: New variable.
[build]: Use it.
* tests/pack.scm ("self-contained-tarball"): Use a <profile> record
instead of 'profile-derivation'.
2020-07-20 23:25:09 +02:00
Ludovic Courtès b91a73a6a4
services: Add 'system-provenance' procedure.
* gnu/services.scm (sexp->channel, system-provenance): New procedures.
* guix/scripts/system.scm (sexp->channel): Remove.
(display-system-generation): Use 'system-provenance' instead of parsing
the "provenance" file right here.
2020-07-15 01:36:24 +02:00
Ludovic Courtès a98712785e
Add 'guix git authenticate'.
* guix/scripts/git.scm, guix/scripts/git/authenticate.scm,
tests/guix-git-authenticate.sh: New files.
* Makefile.am (MODULES): Add the *.scm files.
(SH_TESTS): Add 'tests/guix-git-authenticate.sh'.
* doc/guix.texi (Channels)[Specifying Channel Authorizations]: Mention
'guix git authenticate'.
(Invoking guix git authenticate): New node.
* po/guix/POTFILES.in: Add 'guix/scripts/git.scm' and
'guix/scripts/git/authenticate.scm'.
2020-07-11 12:33:01 +02:00
Ludovic Courtès 69db2993b5
git: Add 'with-git-error-handling'.
* guix/scripts/pull.scm (report-git-error, with-git-error-handling):
Move to...
* guix/git.scm: ... here.
* guix/scripts/time-machine.scm: Adjust accordingly.
2020-07-11 11:51:56 +02:00
Arun Isaac 81a11883dc
weather: Print 0.0% correctly.
* guix/scripts/weather.scm (report-server-coverage): Report 0% coverage as
0.0%, not as .0%.
2020-07-05 16:13:37 +05:30
Jan (janneke) Nieuwenhuizen 28febfafbb
guix system: "describe" displays multiboot info.
* guix/scripts/system.scm (display-system-generation): Display
multiboot-modules commands if set.
2020-07-03 09:28:16 +02:00
Ludovic Courtès eb5cf39e66
services: provenance: Save channel introductions.
* gnu/services.scm (channel->code): Include CHANNEL's introduction, if
any, unless CHANNEL is the singleton %DEFAULT-CHANNELS.
(channel->sexp): Add comment.
* guix/scripts/system.scm (sexp->channel): Change pattern to allow for
extensibility.
2020-07-01 23:34:51 +02:00
Ludovic Courtès 6d39f0cb77
guix describe: Display channel introductions and add 'channels-sans-intro'.
* guix/scripts/describe.scm (%available-formats): Add "channels-sans-intro".
(channel->sexp): Add #:include-introduction?.  Emit CHANNEL's intro if
INCLUDE-INTRODUCTION? is true and CHANNEL has an introduction.
(channel->json): Include CHANNEL's introduction, if any.
(channel->recutils): Likewise.
(display-profile-info): Add 'channels-sans-intro' case.
* doc/guix.texi (Invoking guix describe): Add introduction in example.
Add 'channels-sans-intro' case.
2020-07-01 23:34:51 +02:00
Ludovic Courtès 4f060bf2fe
pack: Dereference symlinks when looking for executables.
Fixes <https://bugs.gnu.org/42127>.
Reported by Andrius Štikonas <andrius@stikonas.eu>.

* guix/scripts/pack.scm (wrapped-package)[build]: Add trailing slash to
the arguments to 'find-files'.
2020-06-30 00:18:28 +02:00
Marius Bakke fdbba544d8
Add more missing (ice-9 format) imports.
* gnu/machine/ssh.scm: Import (ice-9 format).
* guix/scripts/graph.scm: Likewise.
* guix/scripts/system/search.scm: Likewise.
* guix/remote.scm: Likewise.
2020-06-28 23:32:52 +02:00
Ludovic Courtès 1acc5e11be
processes: Write to $PAGER.
* guix/ui.scm (with-paginated-output-port): Export.
* guix/scripts/processes.scm (guix-processes): Use it instead of writing
directly to (current-output-port).
2020-06-28 23:26:53 +02:00
Ludovic Courtès 6b2e91b1fc
challenge: Fix option indentation in '--help' output.
* guix/scripts/challenge.scm (show-help): Indent '--verbose' and
'--diff' correctly (high tech!).
2020-06-26 16:19:53 +02:00
Ludovic Courtès 25b267afed
Add more (ice-9 format) imports.
* guix/scripts/describe.scm: Add missing (ice-9 format).
* guix/scripts/system.scm: Likewise.
2020-06-26 16:19:53 +02:00
Ludovic Courtès 90f496be9a
tests: Actually run 'tests/guix-environment-container.sh'.
This test was skipped since the switch to Guile 3 because
'assert-container-features' would be inlined and thus accessing it with
@@ would fail with an unbound-variable error.

* guix/scripts/environment.scm (assert-container-features): Export.
* tests/guix-environment-container.sh: Use single '@'.
2020-06-20 13:18:11 +02:00
Ludovic Courtès 97a46055ca
database: 'register-items' takes an open database.
* guix/store/database.scm (store-database-directory)
(store-database-file): New procedures.
(call-with-database): Add call to 'mkdir-p'.
(register-items): Add 'db' parameter and remove #:state-directory and #:schema.
(register-path): Use 'store-database-file' and 'with-database', and
parameterize SQL-SCHEMA.
* gnu/build/image.scm (register-closure): Likewise.
* gnu/build/vm.scm (register-closure): Likewise.
* guix/scripts/pack.scm (store-database)[build]: Likewise.
2020-06-18 14:48:17 +02:00
Ludovic Courtès 290c316621
repl: Fix typo that would lead ~/.guile to be used when running scripts.
This is a followup to c924e54139.

* guix/scripts/repl.scm (guix-repl)[opts]: Set 'ignore-dot-guile?', with
question mark.
2020-06-18 14:48:17 +02:00
Ludovic Courtès 838ac881ec
time-machine: Add '--disable-authentication'.
* guix/inferior.scm (cached-channel-instance): Add #:authenticate? and
pass it to 'latest-channel-instances'.
* guix/scripts/time-machine.scm (show-help, %options): Add
'--disable-authentication'.
(%default-options): Add 'authenticate-channels?'.
(guix-time-machine): Honor it.
2020-06-16 16:10:47 +02:00
Ludovic Courtès a9eeeaa6ae
pull: Add '--disable-authentication'.
* guix/channels.scm (latest-channel-instance): Add #:authenticate? and
honor it.
(latest-channel-instances): Likewise.
* guix/scripts/pull.scm (%default-options): Add 'authenticate-channels?'.
(show-help, %options): Add '--disable-authentication'.
(guix-pull): Pass #:authenticate? to 'latest-channel-instances'.
* doc/guix.texi (Invoking guix pull): Document it.
2020-06-16 16:10:47 +02:00
Ludovic Courtès 5bafc70d1e
channels: Make 'validate-pull' call right after clone/pull.
This should come before patching, authentication, etc.

* guix/channels.scm (latest-channel-instance): Add #:validate-pull
parameter and honor it.  Return a single value: the instance.
(ensure-forward-channel-update): Change 'instance' parameter to 'commit'
and adjust accordingly.
(latest-channel-instances): Adjust to 'latest-channel-instance' changes.
* guix/scripts/pull.scm (warn-about-backward-updates): Change 'instance'
parameter to 'commit' and adjust accordingly.
* tests/channels.scm ("latest-channel-instances #:validate-pull"):
Likewise.
2020-06-16 16:10:47 +02:00
Tobias Geerinckx-Rice 38ee8f7dba
pack: Add zstd compressor.
* guix/scripts/pack.scm (%compressors): Add zstd.
* doc/guix.texi (Invoking guix pack): Document it.
2020-06-16 13:35:33 +02:00
Konrad Hinsen c924e54139
guix repl: Add script execution.
* guix/scripts/repl.scm: Add filename options for script execution.
* doc/guix.texi (Invoking guix repl): Document it.
* tests/guix-repl.sh: Test it.
* Makefile.am: (SH_TESTS): Add it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-06-14 23:02:36 +02:00
Mathieu Othacehe 80f92866e3
scripts: system: Fix "init" command.
This is a follow-up of 7ca533c723. The
introduced "target" variable is shadowing the target argument.

* guix/scripts/system.scm (perform-action): Rename "target" variable to
"target*".
2020-06-14 17:42:36 +02:00
Jan (janneke) Nieuwenhuizen 7ca533c723
image: Make 'find-image' non-monadic.
* gnu/system/image.scm (find-image): Make non-monadic.  Add 'target'
parameter.
* gnu/tests/install.scm (run-install): Update caller,
passing (%current-target-system).
* guix/scripts/system.scm (perform-action): Likewise.
2020-06-13 15:03:55 +02:00
Pierre Neidhardt e70e097882
size: Document that positional arguments can be store items.
* guix/scripts/size.scm (show-help): Mention STORE-ITEM positional argument
  alternative.
2020-05-29 18:48:44 +02:00
Mathieu Othacehe e3f0155c41
image: Do not use VM to create disk-images.
Now that installing Grub on raw disk-images is supported, we do not need to
rely on (gnu system vm) module.

* gnu/system/image.scm (make-system-image): Rename to ...
(system-image): ... this, and remove the compatibility wrapper.
(find-image): Turn to a monadic procedure. This will become useful when
introducing Hurd support, to be able to detect the target system.
* gnu/ci.scm (qemu-jobs): Use lower-object now that system-image returns a
file-like object.
* gnu/tests/install.scm (run-install): Ditto.
* guix/scripts/system.scm (system-derivation-for-action): Add a 'base-image'
argument,
(perform-action): adapt accordingly.
2020-05-29 09:12:11 +02:00
Ludovic Courtès 9744cc7b46
pull: Protect against downgrade attacks.
* guix/scripts/pull.scm (%default-options): Add 'validate-pull'.
(%options, show-help): Add '--allow-downgrades'.
(warn-about-backward-updates): New procedure.
(guix-pull): Pass #:current-channels and #:validate-pull to
'latest-channel-instances'.
* guix/channels.scm (ensure-forward-channel-update): Add hint for
when (channel-commit channel) is true.
* doc/guix.texi (Invoking guix pull): Document '--allow-downgrades'.
2020-05-25 00:00:28 +02:00
zimoun 881eaae1ab
guix package: Support multiple profiles with '--list-installed'.
* guix/scripts/package.scm (process-query): List installed multiple profiles.
* tests/guix-package-net.sh: Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-05-23 16:29:29 +02:00
Ludovic Courtès 0e4e9c8e76
guix hash, guix download: Support base64 format.
* guix/scripts/download.scm (show-help, %options): Support "base64"
format.
* guix/scripts/hash.scm (show-help, %options): Likewise.
* tests/guix-hash.sh: Test it.
* doc/guix.texi (Invoking guix hash): Document it.
2020-05-22 00:35:24 +02:00
Ludovic Courtès 18ae1ec3ec
guix hash, guix download: Add '--hash'.
* guix/scripts/download.scm (%default-options): Add 'hash-algorithm'.
(show-help, %options): Add "--hash".
(guix-download): Honor it.
* guix/scripts/hash.scm (%default-options): Add 'hash-algorithm'.
(show-help, %options): Add "--hash".
(guix-hash): Honor it.
* tests/guix-hash.sh: Test '-H sha512'.
* doc/guix.texi (Invoking guix download): Document it.
(Invoking guix hash): Document it.
2020-05-22 00:35:24 +02:00
Ricardo Wurmus 5e3d169945
publish: Improve performance by increasing buffer size.
* guix/scripts/publish.scm (http-write): Increase socket send buffer.
2020-05-19 23:15:41 +02:00
Ekaitz Zarraga 9a27d84b7a
guix describe: Add '--list-formats'
* guix/scripts/describe.scm (%available-formats): New variable.
(list-formats): New procedure.
(%options, show-help): Add --list-formats
* doc/guix.texi: Add --list-formats

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-05-18 15:08:58 +02:00
Ludovic Courtès 6456232164
pack: Add relocation via ld.so and fakechroot.
* gnu/packages/aux-files/run-in-namespace.c (HAVE_EXEC_WITH_LOADER): New
macro.
(bind_mount): Rename to...
(mirror_directory): ... this.  Add 'firmlink' argument and use it
instead of calling mkdir/open/close/mount directly.
(bind_mount, make_symlink): New functions.
(exec_in_user_namespace): Adjust accordingly.
(exec_with_loader) [HAVE_EXEC_WITH_LOADER]: New function.
(exec_performance): New function.
(engines): Add them.
* guix/scripts/pack.scm (wrapped-package)[fakechroot-library]
[audit-module]: New procedures.
[audit-source]: New variable.
[build](elf-interpreter, elf-loader-compile-flags): New procedures.
(build-wrapper): Use them.
* tests/guix-pack-relocatable.sh: Test with
'GUIX_EXECUTION_ENGINE=fakechroot'.
* doc/guix.texi (Invoking guix pack): Document the 'performance' and
'fakechroot' engines.
* gnu/packages/aux-files/pack-audit.c: New file.
* Makefile.am (AUX_FILES): Add it.
2020-05-14 17:21:27 +02:00
Ludovic Courtès a89df83c79
pack: Do not cross-compile the image building tools.
Until now, something like:

  guix pack -f docker --target=arm-linux-gnueabihf

would attempt to cross-compile tar.

* guix/scripts/pack.scm (self-contained-tarball): Pass #:target to
'gexp->derivation'.
(squashfs-image): Use #+ instead of #$ for ARCHIVER.  Use 'file-append'
instead of 'string-append'.  Pass #:target to 'gexp->derivation'.
(docker-image): Likewise.
2020-05-14 17:21:27 +02:00
Ludovic Courtès 88a96c568c
guix graph: Add '--path'.
* guix/scripts/graph.scm (display-path): New procedure.
(%options, show-help): Add '--path'.
(guix-graph): Handle it.
* tests/guix-graph.sh: Add tests.
* doc/guix.texi (Invoking guix graph): Document it.
(Invoking guix size): Mention it.
2020-05-11 23:30:55 +02:00
Ludovic Courtès 7240202136
graph: reference/referrer node types work with graph traversal.
The graph traversal procedures in (guix graph) assume that nodes can be
compared with 'eq?', which was not the case for nodes of
%REFERENCE-NODE-TYPE and %REFERRER-NODE-TYPE (strings).

* guix/scripts/graph.scm (intern): New procedure.
(ensure-store-items, references*)
(%reference-node-type, non-derivation-referrers)
(%referrer-node-type): Use it on all store items.
* tests/graph.scm ("node-transitive-edges, references"): New test.
2020-05-11 23:30:55 +02:00
zimoun baf1ce82b1
guix package, show: Support multiple queries.
* guix/scripts/package.scm (process-query): Show multiple queries.
* guix/scripts/show.scm (guix-show): Reverse to display in order.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-05-11 23:30:54 +02:00
Marius Bakke 4bdf4182fe
Merge branch 'core-updates' 2020-05-08 21:40:51 +02:00
Ludovic Courtès d6c43d7bc1
guix system: 'docker-image' honors '--network'.
* gnu/system/vm.scm (system-docker-image): Add #:shared-network? and
pass it to 'containerized-operating-system'.
(qemu-image):
* guix/scripts/system.scm (system-derivation-for-action): Pass
 #:shared-network? to 'system-docker-image'.
* doc/guix.texi (Invoking guix system): Document it.
2020-05-07 12:55:14 +02:00
Marius Bakke 87a40d7203
Merge branch 'master' into core-updates 2020-05-05 20:43:21 +02:00
Mathieu Othacehe f19cf27c2b
image: Add a new API.
Raw disk-images and ISO9660 images are created in a Qemu virtual machine. This
is quite fragile, very slow, and almost unusable without KVM.

For all these reasons, add support for host image generation. This implies the
use new image generation mechanisms.

- Raw disk images: images of partitions are created using tools such as mke2fs
  and mkdosfs depending on the partition file-system type. The partition
  images are then assembled into a final image using genimage.

- ISO9660 images: the ISO root directory is populated within the store. GNU
  xorriso is then called on that directory, in the exact same way as this is
  done in (gnu build vm) module.

Those mechanisms are built upon the new (gnu image) module.

* gnu/image.scm: New file.
* gnu/system/image.scm: New file.
* gnu/build/image: New file.
* gnu/local.mk: Add them.
* gnu/system/vm.scm (system-disk-image): Rename to system-disk-image-in-vm.
* gnu/ci.scm (qemu-jobs): Adapt to new API.
* gnu/tests/install.scm (run-install): Ditto.
* guix/scripts/system.scm (system-derivation-for-action): Ditto.
2020-05-05 16:13:53 +02:00