guix package: Support package transformation options.
* guix/scripts/package.scm (show-help): Call 'show-transformation-options-help'. (%options): Append %TRANSFORMATION-OPTIONS. (process-actions)[transform, transform-entry]: New procedures. * doc/guix.texi (Invoking guix package): Mention package transformations. (Package Transformation Options): Mention 'guix package'.
This commit is contained in:
parent
88ad6deda6
commit
b8638f0347
|
@ -1643,7 +1643,13 @@ Consequently, this command must be used with care.
|
||||||
|
|
||||||
Finally, since @command{guix package} may actually start build
|
Finally, since @command{guix package} may actually start build
|
||||||
processes, it supports all the common build options (@pxref{Common Build
|
processes, it supports all the common build options (@pxref{Common Build
|
||||||
Options}).
|
Options}). It also support package transformation options, such as
|
||||||
|
@option{--with-source} (@pxref{Package Transformation Options}).
|
||||||
|
However, note that package transformations are lost when upgrading; to
|
||||||
|
preserve transformation across upgrades, you should define your own
|
||||||
|
package variant in a Guile module and add it to @code{GUIX_PACKAGE_PATH}
|
||||||
|
(@pxref{Defining Packages}).
|
||||||
|
|
||||||
|
|
||||||
@node Substitutes
|
@node Substitutes
|
||||||
@section Substitutes
|
@section Substitutes
|
||||||
|
@ -3946,11 +3952,12 @@ the parsed command-line options.
|
||||||
|
|
||||||
@cindex package variants
|
@cindex package variants
|
||||||
Another set of command-line options supported by @command{guix build}
|
Another set of command-line options supported by @command{guix build}
|
||||||
are @dfn{package transformation options}. These are options that allow,
|
and also @command{guix package} are @dfn{package transformation
|
||||||
from the command-line, to define @dfn{package variants}---for instance,
|
options}. These are options that allow you to define @dfn{package
|
||||||
packages built from different source code. This is a convenient way to
|
variants}---for instance, packages built from different source code.
|
||||||
create customized packages on the fly without having to type in the
|
This is a convenient way to create customized packages on the fly
|
||||||
definitions of package variants (@pxref{Defining Packages}).
|
without having to type in the definitions of package variants
|
||||||
|
(@pxref{Defining Packages}).
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,8 @@ Install, remove, or upgrade packages in a single transaction.\n"))
|
||||||
(newline)
|
(newline)
|
||||||
(show-build-options-help)
|
(show-build-options-help)
|
||||||
(newline)
|
(newline)
|
||||||
|
(show-transformation-options-help)
|
||||||
|
(newline)
|
||||||
(display (_ "
|
(display (_ "
|
||||||
-h, --help display this help and exit"))
|
-h, --help display this help and exit"))
|
||||||
(display (_ "
|
(display (_ "
|
||||||
|
@ -511,7 +513,8 @@ kind of search path~%")
|
||||||
result)
|
result)
|
||||||
#f)))
|
#f)))
|
||||||
|
|
||||||
%standard-build-options))
|
(append %transformation-options
|
||||||
|
%standard-build-options)))
|
||||||
|
|
||||||
(define (options->upgrade-predicate opts)
|
(define (options->upgrade-predicate opts)
|
||||||
"Return a predicate based on the upgrade/do-not-upgrade regexps in OPTS
|
"Return a predicate based on the upgrade/do-not-upgrade regexps in OPTS
|
||||||
|
@ -789,6 +792,12 @@ processed, #f otherwise."
|
||||||
(define bootstrap? (assoc-ref opts 'bootstrap?))
|
(define bootstrap? (assoc-ref opts 'bootstrap?))
|
||||||
(define substitutes? (assoc-ref opts 'substitutes?))
|
(define substitutes? (assoc-ref opts 'substitutes?))
|
||||||
(define profile (or (assoc-ref opts 'profile) %current-profile))
|
(define profile (or (assoc-ref opts 'profile) %current-profile))
|
||||||
|
(define transform (options->transformation opts))
|
||||||
|
|
||||||
|
(define (transform-entry entry)
|
||||||
|
(manifest-entry
|
||||||
|
(inherit entry)
|
||||||
|
(item (transform store (manifest-entry-item entry)))))
|
||||||
|
|
||||||
;; First, process roll-backs, generation removals, etc.
|
;; First, process roll-backs, generation removals, etc.
|
||||||
(for-each (match-lambda
|
(for-each (match-lambda
|
||||||
|
@ -803,7 +812,8 @@ processed, #f otherwise."
|
||||||
(let* ((manifest (profile-manifest profile))
|
(let* ((manifest (profile-manifest profile))
|
||||||
(install (options->installable opts manifest))
|
(install (options->installable opts manifest))
|
||||||
(remove (options->removable opts manifest))
|
(remove (options->removable opts manifest))
|
||||||
(transaction (manifest-transaction (install install)
|
(transaction (manifest-transaction
|
||||||
|
(install (map transform-entry install))
|
||||||
(remove remove)))
|
(remove remove)))
|
||||||
(new (manifest-perform-transaction manifest transaction)))
|
(new (manifest-perform-transaction manifest transaction)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue