mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
pack: Honor package transformation options.
Previously they would silently be ignored. * guix/scripts/pack.scm (guix-pack)[manifest-from-args]: Add 'store' parameter. Call 'options->transformation' and use it. Move 'with-store' and 'parameterize' around the 'let'. * tests/guix-pack.sh: Add test using '--with-source'.
This commit is contained in:
parent
df6f86a0cb
commit
aad16cc196
2 changed files with 44 additions and 30 deletions
|
@ -43,6 +43,7 @@ (define-module (guix scripts pack)
|
|||
#:autoload (gnu packages guile) (guile2.0-json guile-json)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-9)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (ice-9 match)
|
||||
#:export (compressor?
|
||||
|
@ -397,8 +398,13 @@ (define maybe-package-argument
|
|||
(read/eval-package-expression exp))
|
||||
(x #f)))
|
||||
|
||||
(define (manifest-from-args opts)
|
||||
(let ((packages (filter-map maybe-package-argument opts))
|
||||
(define (manifest-from-args store opts)
|
||||
(let* ((transform (options->transformation opts))
|
||||
(packages (map (match-lambda
|
||||
(((? package? package) output)
|
||||
(list (transform store package)
|
||||
output)))
|
||||
(filter-map maybe-package-argument opts)))
|
||||
(manifest-file (assoc-ref opts 'manifest)))
|
||||
(cond
|
||||
((and manifest-file (not (null? packages)))
|
||||
|
@ -409,8 +415,16 @@ (define (manifest-from-args opts)
|
|||
(else (packages->manifest packages)))))
|
||||
|
||||
(with-error-handling
|
||||
(with-store store
|
||||
(parameterize ((%graft? (assoc-ref opts 'graft?))
|
||||
(%guile-for-build (package-derivation
|
||||
store
|
||||
(if (assoc-ref opts 'bootstrap?)
|
||||
%bootstrap-guile
|
||||
(canonical-package guile-2.2))
|
||||
#:graft? (assoc-ref opts 'graft?))))
|
||||
(let* ((dry-run? (assoc-ref opts 'dry-run?))
|
||||
(manifest (manifest-from-args opts))
|
||||
(manifest (manifest-from-args store opts))
|
||||
(pack-format (assoc-ref opts 'format))
|
||||
(name (string-append (symbol->string pack-format)
|
||||
"-pack"))
|
||||
|
@ -429,13 +443,6 @@ (define (manifest-from-args opts)
|
|||
(leave (G_ "~a: unknown pack format")
|
||||
format))))
|
||||
(localstatedir? (assoc-ref opts 'localstatedir?)))
|
||||
(with-store store
|
||||
(parameterize ((%graft? (assoc-ref opts 'graft?))
|
||||
(%guile-for-build (package-derivation
|
||||
store
|
||||
(if (assoc-ref opts 'bootstrap?)
|
||||
%bootstrap-guile
|
||||
(canonical-package guile-2.2)))))
|
||||
;; Set the build options before we do anything else.
|
||||
(set-build-options-from-command-line store opts)
|
||||
|
||||
|
|
|
@ -83,3 +83,10 @@ guix pack --dry-run --bootstrap -f docker -S /opt/gnu=/ guile-bootstrap
|
|||
# Build a tarball pack of cross-compiled software. Use coreutils because
|
||||
# guile-bootstrap is not intended to be cross-compiled.
|
||||
guix pack --dry-run --bootstrap --target=arm-unknown-linux-gnueabihf coreutils
|
||||
|
||||
# Make sure package transformation options are honored.
|
||||
mkdir -p "$test_directory"
|
||||
drv1="`guix pack -n guile 2>&1 | grep pack.*\.drv`"
|
||||
drv2="`guix pack -n --with-source=guile=$test_directory guile 2>&1 | grep pack.*\.drv`"
|
||||
test -n "$drv1"
|
||||
test "$drv1" != "$drv2"
|
||||
|
|
Loading…
Reference in a new issue