[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

06/10: guix package: Support package transformation options.

From: Ludovic Courtès
Subject: 06/10: guix package: Support package transformation options.
Date: Mon, 01 Feb 2016 09:13:00 +0000

civodul pushed a commit to branch master
in repository guix.

commit b8638f03471a0c45f441caef1acf2dad7c457661
Author: Ludovic Courtès <address@hidden>
Date:   Sun Jan 31 21:33:08 2016 +0100

    guix package: Support package transformation options.
    * guix/scripts/package.scm (show-help): Call
    (%options): Append %TRANSFORMATION-OPTIONS.
    (process-actions)[transform, transform-entry]: New procedures.
    * doc/guix.texi (Invoking guix package): Mention package
    (Package Transformation Options): Mention 'guix package'.
 doc/guix.texi            |   19 +++++++++++++------
 guix/scripts/package.scm |   16 +++++++++++++---
 2 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 10ca9b7..dcced79 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -1643,7 +1643,13 @@ Consequently, this command must be used with care.
 Finally, since @command{guix package} may actually start build
 processes, it supports all the common build options (@pxref{Common Build
+Options}).  It also support package transformation options, such as
address@hidden (@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
 @section Substitutes
@@ -3946,11 +3952,12 @@ the parsed command-line options.
 @cindex package variants
 Another set of command-line options supported by @command{guix build}
-are @dfn{package transformation options}.  These are options that allow,
-from the command-line, to define @dfn{package variants}---for instance,
-packages built from different source code.  This is a convenient way to
-create customized packages on the fly without having to type in the
-definitions of package variants (@pxref{Defining Packages}).
+and also @command{guix package} are @dfn{package transformation
+options}.  These are options that allow you to define @dfn{package
+variants}---for instance, packages built from different source code.
+This is a convenient way to create customized packages on the fly
+without having to type in the definitions of package variants
+(@pxref{Defining Packages}).
 @table @code
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 02eb600..b93ffb0 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -379,6 +379,8 @@ Install, remove, or upgrade packages in a single 
+  (show-transformation-options-help)
+  (newline)
   (display (_ "
   -h, --help             display this help and exit"))
   (display (_ "
@@ -511,7 +513,8 @@ kind of search path~%")
-         %standard-build-options))
+         (append %transformation-options
+                 %standard-build-options)))
 (define (options->upgrade-predicate 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 substitutes? (assoc-ref opts 'substitutes?))
   (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.
   (for-each (match-lambda
@@ -803,8 +812,9 @@ processed, #f otherwise."
   (let* ((manifest    (profile-manifest profile))
          (install     (options->installable opts manifest))
          (remove      (options->removable opts manifest))
-         (transaction (manifest-transaction (install install)
-                                            (remove remove)))
+         (transaction (manifest-transaction
+                       (install (map transform-entry install))
+                       (remove remove)))
          (new         (manifest-perform-transaction manifest transaction)))
     (unless (and (null? install) (null? remove))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]