summaryrefslogtreecommitdiff
path: root/guix/scripts/pack.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-03-06 23:53:08 +0100
committerLudovic Courtès <ludo@gnu.org>2019-03-07 00:00:18 +0100
commitd40ec4a0d00df08ec4f866467080235f5a9fea87 (patch)
treed229b46acb5af4407f9bba5993884d1b8dfcdf57 /guix/scripts/pack.scm
parent2cb658a9a7c491ee8ea13da9682170e40deb25ed (diff)
downloadpatches-d40ec4a0d00df08ec4f866467080235f5a9fea87.tar
patches-d40ec4a0d00df08ec4f866467080235f5a9fea87.tar.gz
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.
Diffstat (limited to 'guix/scripts/pack.scm')
-rw-r--r--guix/scripts/pack.scm27
1 files changed, 26 insertions, 1 deletions
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 86e15d9bab..e2ecddfbfc 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -32,6 +32,7 @@
#:use-module (guix modules)
#:use-module (guix packages)
#:use-module (guix profiles)
+ #:use-module (guix describe)
#:use-module (guix derivations)
#:use-module (guix search-paths)
#:use-module (guix build-system gnu)
@@ -678,6 +679,9 @@ please email '~a'~%")
(x
(leave (G_ "~a: invalid symlink specification~%")
arg)))))
+ (option '("save-provenance") #f #f
+ (lambda (opt name arg result)
+ (alist-cons 'save-provenance? #t result)))
(option '("localstatedir") #f #f
(lambda (opt name arg result)
(alist-cons 'localstatedir? #t result)))
@@ -726,6 +730,8 @@ Create a bundle of PACKAGE.\n"))
(display (G_ "
-m, --manifest=FILE create a pack with the manifest from FILE"))
(display (G_ "
+ --save-provenance save provenance information"))
+ (display (G_ "
--localstatedir include /var/guix in the resulting pack"))
(display (G_ "
--profile-name=NAME
@@ -772,13 +778,32 @@ Create a bundle of PACKAGE.\n"))
(list (transform store package) "out")))
(filter-map maybe-package-argument opts)))
(manifest-file (assoc-ref opts 'manifest)))
+ (define properties
+ (if (assoc-ref opts 'save-provenance?)
+ (lambda (package)
+ (match (package-provenance package)
+ (#f
+ (warning (G_ "could not determine provenance of package ~a~%")
+ (package-full-name package))
+ '())
+ (sexp
+ `((provenance . ,sexp)))))
+ (const '())))
+
(cond
((and manifest-file (not (null? packages)))
(leave (G_ "both a manifest and a package list were given~%")))
(manifest-file
(let ((user-module (make-user-module '((guix profiles) (gnu)))))
(load* manifest-file user-module)))
- (else (packages->manifest packages)))))
+ (else
+ (manifest
+ (map (match-lambda
+ ((package output)
+ (package->manifest-entry package output
+ #:properties
+ (properties package))))
+ packages))))))
(with-error-handling
(with-store store