unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH Cuirass 1/4] specification: Ensure name is a symbol.
@ 2024-06-13 11:03 Romain GARBAGE
  2024-06-13 11:03 ` [PATCH Cuirass 2/4] gitlab: Add module for Gitlab JSON objects definition Romain GARBAGE
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Romain GARBAGE @ 2024-06-13 11:03 UTC (permalink / raw)
  To: guix-devel; +Cc: ludovic.courtes, Romain GARBAGE

* 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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-07-17 18:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13 11:03 [PATCH Cuirass 1/4] specification: Ensure name is a symbol Romain GARBAGE
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
2024-07-17 18:31     ` Simon Tournier

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).