all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Mathieu Othacehe <othacehe@gnu.org>, 57643@debbugs.gnu.org
Subject: [bug#57643] [PATCH 1/3] image: Make the operating-system field mandatory.
Date: Sat, 24 Sep 2022 12:55:37 +0200	[thread overview]
Message-ID: <467d8638-5078-f940-600a-6204ccdca993@telenet.be> (raw)
In-Reply-To: <20220907124633.17013-1-othacehe@gnu.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 1681 bytes --]



On 07-09-2022 14:46, Mathieu Othacehe wrote:
> +(define-syntax image-without-os
> +  (lambda (x)
> +    "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 > +
> +    (define (maybe-cons field acc)
> +      ;; Return the given ACC list if FIELD is 'operating-system or the
> +      ;; concatenation of FIELD to ACC otherwise.
> +      (syntax-case field ()
> +        ((f v)
> +         (if (eq? (syntax->datum #'f) 'operating-system)
> +             acc
> +             (cons field acc)))) > +
> +    (syntax-case x (image)
> +      ;; Remove the operating-system field from the defined fields and then
> +      ;; force it to #false.
> +      ((_ fields ...)
> +       (let loop ((fields #'(fields ...))
> +                  (acc   '()))
> +         (syntax-case fields ()
> +           ((last)
> +            #`(image
> +               ;; Force it to #false.
> +               (operating-system #false)
> +               #,@(maybe-cons #'last acc)))
> +           ((field rest ...)
> +            (loop #'(rest ...) (maybe-cons #'field acc)))))))))

The complexity of this 'without os' macro seems to come from accepting 
an 'os' and then throwing it away.  However, when there is an 'os', you 
might as well use 'image' directly, without 'image-without-os', so I 
think this macro can be simplified to:

(define-syntax-rule (image-without-os . settings)
   "docstring"
   (image (operating-system #false) . settings))

(IIUC, '(guix records)' will detect duplicate definitions of fields.)

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  parent reply	other threads:[~2022-09-24 10:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07 12:44 [bug#57643] [PATCH 0/3] Document the image API Mathieu Othacehe
2022-09-07 12:46 ` [bug#57643] [PATCH 1/3] image: Make the operating-system field mandatory Mathieu Othacehe
2022-09-07 12:46   ` [bug#57643] [PATCH 2/3] doc: Add a "Platforms" chapter Mathieu Othacehe
2022-09-07 15:37     ` zimoun
2022-09-24  9:55       ` [bug#57643] [PATCH 0/3] Document the image API Ludovic Courtès
2022-09-24 10:10     ` Ludovic Courtès
2022-09-24 10:49       ` Maxime Devos
2022-09-24 13:01         ` Mathieu Othacehe
2022-09-24 16:33         ` Ludovic Courtès
2022-09-24 16:58           ` Maxime Devos
2022-09-25 20:15             ` Ludovic Courtès
2022-09-24 12:50       ` Mathieu Othacehe
2022-09-07 12:46   ` [bug#57643] [PATCH 3/3] doc: Add a "System Images" chapter Mathieu Othacehe
2022-09-07 15:47     ` zimoun
2022-09-24 10:15     ` [bug#57643] [PATCH 0/3] Document the image API Ludovic Courtès
2022-09-07 18:34   ` [bug#57643] [PATCH 1/3] image: Make the operating-system field mandatory Liliana Marie Prikler
2022-09-24 10:16     ` [bug#57643] [PATCH 0/3] Document the image API Ludovic Courtès
2022-09-24 10:55   ` Maxime Devos [this message]
2022-09-24 13:02     ` [bug#57643] [PATCH 1/3] image: Make the operating-system field mandatory Mathieu Othacehe
2022-09-24 10:18 ` [bug#57643] [PATCH 0/3] Document the image API Ludovic Courtès
2022-09-24 12:59   ` Mathieu Othacehe
2022-09-25 11:53   ` bug#57643: " Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=467d8638-5078-f940-600a-6204ccdca993@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=57643@debbugs.gnu.org \
    --cc=othacehe@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.