diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-12-29 16:22:35 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-12-29 18:24:54 +0100 |
commit | c48e522fdbb7c749bbf6147e44c067bf1f916fdd (patch) | |
tree | f53143b6b9e7fffa6db3b7acc55fad0543920784 | |
parent | 8a705ae4c6107f43c7fbcfad913dd2675f94086a (diff) | |
download | guix-c48e522fdbb7c749bbf6147e44c067bf1f916fdd.tar.gz |
guix package: Save provenance information when using '--manifest'.
Fixes <https://bugs.gnu.org/38673>. Reported by zimoun <zimon.toutoune@gmail.com>. * guix/describe.scm (manifest-entry-with-provenance): New procedure. * guix/scripts/package.scm (process-actions): Use it when FILES is non-empty.
-rw-r--r-- | guix/describe.scm | 18 | ||||
-rw-r--r-- | guix/scripts/package.scm | 7 |
2 files changed, 22 insertions, 3 deletions
diff --git a/guix/describe.scm b/guix/describe.scm index 893dca2640..6b9b219113 100644 --- a/guix/describe.scm +++ b/guix/describe.scm @@ -30,7 +30,8 @@ current-profile-entries package-path-entries - package-provenance)) + package-provenance + manifest-entry-with-provenance)) ;;; Commentary: ;;; @@ -144,3 +145,18 @@ property of manifest entries, or #f if it could not be determined." (and main `(,main ,@(if extra (list extra) '())))))))))) + +(define (manifest-entry-with-provenance entry) + "Return ENTRY with an additional 'provenance' property if it's not already +there." + (let ((properties (manifest-entry-properties entry))) + (if (assq 'properties properties) + entry + (let ((item (manifest-entry-item entry))) + (manifest-entry + (inherit entry) + (properties + (match (and (package? item) (package-provenance item)) + (#f properties) + (sexp `((provenance ,@sexp) + ,@properties))))))))) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 92c6e34194..ea16435d2d 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -38,7 +38,7 @@ #:use-module (guix config) #:use-module (guix scripts) #:use-module (guix scripts build) - #:autoload (guix describe) (package-provenance) + #:use-module (guix describe) #:autoload (guix store roots) (gc-roots) #:use-module ((guix build utils) #:select (directory-exists? mkdir-p)) @@ -883,7 +883,10 @@ processed, #f otherwise." opts)) (manifest (match files (() (profile-manifest profile)) - (_ (concatenate-manifests (map load-manifest files))))) + (_ (map-manifest-entries + manifest-entry-with-provenance + (concatenate-manifests + (map load-manifest files)))))) (step1 (options->removable opts manifest (manifest-transaction))) (step2 (options->installable opts manifest step1)) |