me
/
guix
Archived
1
0
Fork 0

pack: Add "--derivation".

* guix/scripts/pack.scm (%options, show-help): Add "--derivation".
(guix-pack): Honor it.
* tests/guix-pack.sh: Test it.
* doc/guix.texi (Invoking guix pack): Document it.
master
Ludovic Courtès 2019-11-20 09:57:08 +01:00
parent 59cd751852
commit a2e661e95f
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 24 additions and 5 deletions

View File

@ -5253,6 +5253,10 @@ added to it or removed from it after extraction of the pack.
One use case for this is the Guix self-contained binary tarball One use case for this is the Guix self-contained binary tarball
(@pxref{Binary Installation}). (@pxref{Binary Installation}).
@item --derivation
@itemx -d
Print the name of the derivation that builds the pack.
@item --bootstrap @item --bootstrap
Use the bootstrap binaries to build the pack. This option is only Use the bootstrap binaries to build the pack. This option is only
useful to Guix developers. useful to Guix developers.

View File

@ -800,6 +800,10 @@ last resort for relocation."
(option '(#\n "dry-run") #f #f (option '(#\n "dry-run") #f #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'dry-run? #t (alist-cons 'graft? #f result)))) (alist-cons 'dry-run? #t (alist-cons 'graft? #f result))))
(option '(#\d "derivation") #f #f
(lambda (opt name arg result)
(alist-cons 'derivation-only? #t result)))
(option '(#\f "format") #t #f (option '(#\f "format") #t #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'format (string->symbol arg) result))) (alist-cons 'format (string->symbol arg) result)))
@ -918,6 +922,8 @@ Create a bundle of PACKAGE.\n"))
-r, --root=FILE make FILE a symlink to the result, and register it -r, --root=FILE make FILE a symlink to the result, and register it
as a garbage collector root")) as a garbage collector root"))
(display (G_ " (display (G_ "
-d, --derivation return the derivation of the pack"))
(display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL")) -v, --verbosity=LEVEL use the given verbosity LEVEL"))
(display (G_ " (display (G_ "
--bootstrap use the bootstrap binaries to build the pack")) --bootstrap use the bootstrap binaries to build the pack"))
@ -1002,6 +1008,7 @@ Create a bundle of PACKAGE.\n"))
(assoc-ref opts 'system) (assoc-ref opts 'system)
#:graft? (assoc-ref opts 'graft?)))) #:graft? (assoc-ref opts 'graft?))))
(let* ((dry-run? (assoc-ref opts 'dry-run?)) (let* ((dry-run? (assoc-ref opts 'dry-run?))
(derivation? (assoc-ref opts 'derivation-only?))
(relocatable? (assoc-ref opts 'relocatable?)) (relocatable? (assoc-ref opts 'relocatable?))
(proot? (eq? relocatable? 'proot)) (proot? (eq? relocatable? 'proot))
(manifest (let ((manifest (manifest-from-args store opts))) (manifest (let ((manifest (manifest-from-args store opts)))
@ -1070,11 +1077,15 @@ Create a bundle of PACKAGE.\n"))
#:archiver #:archiver
archiver))) archiver)))
(mbegin %store-monad (mbegin %store-monad
(show-what-to-build* (list drv) (munless derivation?
#:use-substitutes? (show-what-to-build* (list drv)
(assoc-ref opts 'substitutes?) #:use-substitutes?
#:dry-run? dry-run?) (assoc-ref opts 'substitutes?)
(munless dry-run? #:dry-run? dry-run?))
(mwhen derivation?
(return (format #t "~a~%"
(derivation-file-name drv))))
(munless (or derivation? dry-run?)
(built-derivations (list drv)) (built-derivations (list drv))
(mwhen gc-root (mwhen gc-root
(register-root* (match (derivation->output-paths drv) (register-root* (match (derivation->output-paths drv)

View File

@ -36,6 +36,10 @@ export GUIX_BUILD_OPTIONS
test_directory="`mktemp -d`" test_directory="`mktemp -d`"
trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT
# Compute the derivation of a pack.
drv="`guix pack coreutils -d --no-grafts`"
guix gc -R "$drv" | grep "`guix build coreutils -d --no-grafts`"
# Build a tarball with no compression. # Build a tarball with no compression.
guix pack --compression=none --bootstrap guile-bootstrap guix pack --compression=none --bootstrap guile-bootstrap