guix-commits
[Top][All Lists]
Advanced

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

01/02: scripts: system: Honor target argument.


From: guix-commits
Subject: 01/02: scripts: system: Honor target argument.
Date: Fri, 2 Oct 2020 04:03:46 -0400 (EDT)

mothacehe pushed a commit to branch master
in repository guix.

commit bdbd8bf9054c88aaf694a08e49270c95e6adad27
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Fri Oct 2 09:53:45 2020 +0200

    scripts: system: Honor target argument.
    
    Since 313f492657f1d0863c641fa5ee7f5b7028e27c94 the target argument passed to
    "guix system" was not honored for 'disk-image' command.
    
    This forces the command line passed "target" to take precedence over the
    "target" field of the <image> record returned by "os->image" procedure.
    
    * guix/scripts/system.scm (system-derivation-for-action): Override the
    "target" field of the "image" record using the "target" argument from the
    command line.
---
 guix/scripts/system.scm | 64 ++++++++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 30 deletions(-)

diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 7b3eacf..939559e 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -671,36 +671,40 @@ checking this by themselves in their 'check' procedure."
                                        full-boot? container-shared-network?
                                        mappings label)
   "Return as a monadic value the derivation for OS according to ACTION."
-  (case action
-    ((build init reconfigure)
-     (operating-system-derivation os))
-    ((container)
-     (container-script
-      os
-      #:mappings mappings
-      #:shared-network? container-shared-network?))
-    ((vm-image)
-     (system-qemu-image os #:disk-image-size image-size))
-    ((vm)
-     (system-qemu-image/shared-store-script os
-                                            #:full-boot? full-boot?
-                                            #:disk-image-size
-                                            (if full-boot?
-                                                image-size
-                                                (* 70 (expt 2 20)))
-                                            #:mappings mappings))
-    ((disk-image)
-     (let ((base-image (os->image os #:type image-type)))
-       (lower-object
-        (system-image
-         (image
-          (inherit (if label
-                       (image-with-label base-image label)
-                       base-image))
-          (size image-size)
-          (operating-system os))))))
-    ((docker-image)
-     (system-docker-image os #:shared-network? container-shared-network?))))
+  (mlet %store-monad ((target (current-target-system)))
+    (case action
+      ((build init reconfigure)
+       (operating-system-derivation os))
+      ((container)
+       (container-script
+        os
+        #:mappings mappings
+        #:shared-network? container-shared-network?))
+      ((vm-image)
+       (system-qemu-image os #:disk-image-size image-size))
+      ((vm)
+       (system-qemu-image/shared-store-script os
+                                              #:full-boot? full-boot?
+                                              #:disk-image-size
+                                              (if full-boot?
+                                                  image-size
+                                                  (* 70 (expt 2 20)))
+                                              #:mappings mappings))
+      ((disk-image)
+       (let* ((base-image (os->image os #:type image-type))
+              (base-target (image-target base-image)))
+         (lower-object
+          (system-image
+           (image
+            (inherit (if label
+                         (image-with-label base-image label)
+                         base-image))
+            (target (or base-target target))
+            (size image-size)
+            (operating-system os))))))
+      ((docker-image)
+       (system-docker-image os
+                            #:shared-network? container-shared-network?)))))
 
 (define (maybe-suggest-running-guix-pull)
   "Suggest running 'guix pull' if this has never been done before."



reply via email to

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