guix-commits
[Top][All Lists]
Advanced

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

01/08: image: Make the operating-system field mandatory.


From: guix-commits
Subject: 01/08: image: Make the operating-system field mandatory.
Date: Sat, 24 Sep 2022 08:49:23 -0400 (EDT)

mothacehe pushed a commit to branch master
in repository guix.

commit c009c286a23f48b56731c3e7bc4875a9e88857c4
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Mon Sep 5 18:12:22 2022 +0200

    image: Make the operating-system field mandatory.
    
    Make the operating-system field mandatory as creating an image without it
    makes no sense. Introduce a new macro, image-without-os for the specific 
cases
    where the image is only created to be inherited from afterwards.
    
    * gnu/image.scm (<image>)[operating-system]: Make it mandatory.
    * gnu/system/image.scm (image-without-os): New macro.
    (efi-disk-image, efi32-disk-image, iso9660-image, docker-image,
    raw-with-offset-disk-image): Use it.
    * gnu/system/images/hurd.scm (hurd-disk-image): Ditto.
---
 gnu/image.scm              |  3 +--
 gnu/system/image.scm       | 17 ++++++++++++-----
 gnu/system/images/hurd.scm |  2 +-
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/gnu/image.scm b/gnu/image.scm
index 4a0068934e..68784deb12 100644
--- a/gnu/image.scm
+++ b/gnu/image.scm
@@ -170,8 +170,7 @@ that is not in SET, mentioning FIELD in the error message."
   (size               image-size  ;size in bytes as integer
                       (default 'guess)
                       (sanitize validate-size))
-  (operating-system   image-operating-system  ;<operating-system>
-                      (default #f))
+  (operating-system   image-operating-system)  ;<operating-system>
   (partition-table-type image-partition-table-type ; 'mbr or 'gpt
                       (default 'mbr)
                       (sanitize validate-partition-table-type))
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index a04363a130..c59b7eafd7 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -65,6 +65,7 @@
   #:use-module (ice-9 match)
   #:export (root-offset
             root-label
+            image-without-os
 
             esp-partition
             esp32-partition
@@ -102,6 +103,12 @@
 ;; Generic root partition label.
 (define root-label "Guix_image")
 
+(define-syntax-rule (image-without-os . fields)
+    "Return an image record with the mandatory operating-system field set to
+#false.  This is useful when creating an image record that will serve as a
+parent image record."
+   (image (operating-system #false) . fields))
+
 (define esp-partition
   (partition
    (size (* 40 (expt 2 20)))
@@ -127,17 +134,17 @@
    (initializer (gexp initialize-root-partition))))
 
 (define efi-disk-image
-  (image
+  (image-without-os
    (format 'disk-image)
    (partitions (list esp-partition root-partition))))
 
 (define efi32-disk-image
-  (image
+  (image-without-os
    (format 'disk-image)
    (partitions (list esp32-partition root-partition))))
 
 (define iso9660-image
-  (image
+  (image-without-os
    (format 'iso9660)
    (partitions
     (list (partition
@@ -146,11 +153,11 @@
            (flags '(boot)))))))
 
 (define docker-image
-  (image
+  (image-without-os
    (format 'docker)))
 
 (define* (raw-with-offset-disk-image #:optional (offset root-offset))
-  (image
+  (image-without-os
    (format 'disk-image)
    (partitions
     (list (partition
diff --git a/gnu/system/images/hurd.scm b/gnu/system/images/hurd.scm
index 6da09b855a..2c64117c08 100644
--- a/gnu/system/images/hurd.scm
+++ b/gnu/system/images/hurd.scm
@@ -74,7 +74,7 @@
                            #:wal-mode? #f)))))
 
 (define hurd-disk-image
-  (image
+  (image-without-os
    (format 'disk-image)
    (platform hurd)
    (partitions



reply via email to

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