[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH Cuirass 1/4] specification: Ensure name is a symbol.
From: |
Romain GARBAGE |
Subject: |
[PATCH Cuirass 1/4] specification: Ensure name is a symbol. |
Date: |
Thu, 13 Jun 2024 13:03:06 +0200 |
* 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
- [PATCH Cuirass 1/4] specification: Ensure name is a symbol.,
Romain GARBAGE <=