diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2026-03-26 09:24:55 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-04-04 00:30:52 +0200 |
| commit | 95ac807edf99f6489bd06f9d00632ed8dfc19798 (patch) | |
| tree | 5a828e37b2fbe00a62eb6e289ce73455c014f6ca | |
| parent | 985715e1e33b463e09709c947dd5b185c187e64f (diff) | |
guix system: Make ‘--save-provenance’ effective for images.
Previously ‘--save-provenance’ would be silently ignored for ‘guix system
image’.
* guix/scripts/system.scm (image-with-provenance): New procedure.
(process-action): In ‘transform’, add case for ‘image?’, and emit a warning in
the default case.
Change-Id: I5020a4b3dacbe7a0820a3c4779b7d86a8133bd60
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #7485
| -rw-r--r-- | guix/scripts/system.scm | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 8a56f1cc63d..eddc2fc3e3c 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014-2024 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2014-2024, 2026 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016 Alex Kost <alezost@gmail.com> ;;; Copyright © 2016, 2017, 2018 Chris Marusich <cmmarusich@gmail.com> ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com> @@ -1250,6 +1250,14 @@ Some ACTIONS support additional ARGS.\n")) "switch-generation" "search" "edit" "docker-image" "installer")) +(define (image-with-provenance img file) + "Return IMG with provenance information recorded, including FILE, the +operating system or image configuration file." + (image (inherit img) + (operating-system + (operating-system-with-provenance (image-operating-system img) + file)))) + (define (process-action action args opts) "Process ACTION, a sub-command, with the arguments are listed in ARGS. ACTION must be one of the sub-commands that takes an operating system @@ -1272,8 +1280,16 @@ resulting from command-line parsing." (system (assoc-ref opts 'system)) (target (assoc-ref opts 'target)) (transform (lambda (obj) - (if (and save-provenance? (operating-system? obj)) - (operating-system-with-provenance obj file) + (if save-provenance? + (cond + ((operating-system? obj) + (operating-system-with-provenance obj file)) + ((image? obj) + (image-with-provenance obj file)) + (else + (warning + (G_ "'--save-provenance' has no effect~%")) + obj)) obj))) (obj (transform (ensure-operating-system-or-image |
