diff mbox series

[bug#42634,1/3] image: Add image-type support.

Message ID 20200731144929.703345-1-othacehe@gnu.org
State Accepted
Headers show
Series Add image-type support. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Mathieu Othacehe July 31, 2020, 2:49 p.m. UTC
* gnu/image.scm (<image-type>): New record,
(image-type, image-type?, image-type-name,
image-type-constructor, os->image): new procedures.
---
 gnu/image.scm | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

Comments

Ludovic Courtès Sept. 24, 2020, 3:35 p.m. UTC | #1
Mathieu Othacehe <m.othacehe@gmail.com> skribis:

> * gnu/image.scm (<image-type>): New record,
> (image-type, image-type?, image-type-name,
> image-type-constructor, os->image): new procedures.

[...]

> +(define-record-type* <image-type>
> +  image-type make-image-type
> +  image-type?
> +  (name           image-type-name) ;string

It’s subjective, but I’d make it a symbol, like we do for service types
for instance.

Ludo’.
diff mbox series

Patch

diff --git a/gnu/image.scm b/gnu/image.scm
index dc66f2c533..6f8f4828ac 100644
--- a/gnu/image.scm
+++ b/gnu/image.scm
@@ -39,7 +39,14 @@ 
             image-partitions
             image-compression?
             image-volatile-root?
-            image-substitutable?))
+            image-substitutable?
+
+            image-type
+            image-type?
+            image-type-name
+            image-type-constructor
+
+            os->image))
 
 
 ;;;
@@ -84,3 +91,23 @@ 
                       (default #t))
   (substitutable?     image-substitutable? ;boolean
                       (default #t)))
+
+
+;;;
+;;; Image type.
+;;;
+
+(define-record-type* <image-type>
+  image-type make-image-type
+  image-type?
+  (name           image-type-name) ;string
+  (constructor    image-type-constructor)) ;<operating-system> -> <image>
+
+
+;;;
+;;; Image creation.
+;;;
+
+(define* (os->image os #:key type)
+  (let ((constructor (image-type-constructor type)))
+    (constructor os)))