unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Romain GARBAGE <romain.garbage@inria.fr>
To: guix-devel@gnu.org
Cc: ludovic.courtes@inria.fr, Romain GARBAGE <romain.garbage@inria.fr>
Subject: [PATCH Cuirass 1/4] specification: Ensure name is a symbol.
Date: Thu, 13 Jun 2024 13:03:06 +0200	[thread overview]
Message-ID: <20240613110311.12126-1-romain.garbage@inria.fr> (raw)

* src/cuirass/specification.scm (ensure-symbol): New variable.
(specification)[name]: Ensure name is a symbol.
* tests/database.scm: Fix test.
---
 src/cuirass/specification.scm | 11 ++++++++++-
 tests/database.scm            |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/cuirass/specification.scm b/src/cuirass/specification.scm
index d62037e..7b237e6 100644
--- a/src/cuirass/specification.scm
+++ b/src/cuirass/specification.scm
@@ -138,10 +138,19 @@
     packages
     manifests))
 
+(define (ensure-symbol x)
+  (if (string? x)
+      (string->symbol x)
+      x))
+
 (define-record-type* <specification>
   specification make-specification
   specification?
-  (name               specification-name) ;symbol
+  (name               specification-name
+                      ;; There was a confusion in the documentation regarding
+                      ;; the type of this field. For this reason, strings are
+                      ;; accepted but silently converted into symbols.
+                      (sanitize ensure-symbol)) ;symbol
   (build              specification-build ;symbol for %build-types
                       (default 'all))
   (channels           specification-channels ;list of <channel>
diff --git a/tests/database.scm b/tests/database.scm
index c4efb0a..010c139 100644
--- a/tests/database.scm
+++ b/tests/database.scm
@@ -190,7 +190,7 @@ timestamp, checkouttime, evaltime) VALUES ('guix', 0, 0, 0, 0);")
       (let* ((spec (db-get-specification "guix"))
              (channels (specification-channels spec))
              (build-outputs (specification-build-outputs spec)))
-        (and (string=? (specification-name spec) "guix")
+        (and (eq? (specification-name spec) 'guix)
              (equal? (map channel-name channels) '(guix my-channel))
              (equal? (map build-output-job build-outputs) '("job"))))))
 
-- 
2.45.1



             reply	other threads:[~2024-06-14 16:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 11:03 Romain GARBAGE [this message]
2024-06-13 11:03 ` [PATCH Cuirass 2/4] gitlab: Add module for Gitlab JSON objects definition Romain GARBAGE
2024-06-13 11:03 ` [PATCH Cuirass 3/4] http: Add /admin/gitlab/event Romain GARBAGE
2024-06-13 11:03 ` [PATCH Cuirass 4/4] http: Add tests for Gitlab API Romain GARBAGE
2024-06-14 14:08 ` [PATCH Cuirass 1/4] specification: Ensure name is a symbol Ludovic Courtès
2024-06-17 13:16   ` Ludovic Courtès

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=20240613110311.12126-1-romain.garbage@inria.fr \
    --to=romain.garbage@inria.fr \
    --cc=guix-devel@gnu.org \
    --cc=ludovic.courtes@inria.fr \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).