* [PATCH] import/cpan: Maybe coerce version to string
@ 2016-11-12 17:20 Alex Sassmannshausen
2016-11-12 17:20 ` Alex Sassmannshausen
0 siblings, 1 reply; 3+ messages in thread
From: Alex Sassmannshausen @ 2016-11-12 17:20 UTC (permalink / raw)
To: guix-devel; +Cc: Alex Sassmannshausen
Hello,
Sometimes json-fetch returns a number for version in the CPAN importer, when a
string is expected.
This simple patch performs a match on the value returned by json-fetch, to
coerce the number to string if necessary.
WDYT?
Alex
Alex Sassmannshausen (1):
import/cpan: Maybe coerce version to string.
guix/import/cpan.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--
2.10.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] import/cpan: Maybe coerce version to string.
2016-11-12 17:20 [PATCH] import/cpan: Maybe coerce version to string Alex Sassmannshausen
@ 2016-11-12 17:20 ` Alex Sassmannshausen
2016-11-13 12:13 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Alex Sassmannshausen @ 2016-11-12 17:20 UTC (permalink / raw)
To: guix-devel; +Cc: Alex Sassmannshausen
* guix/import/cpan.scm (cpan-module->sexp) <version>: Test if version in
meta is string or number. If it is number, coerce to string.
---
guix/import/cpan.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index 5b7c475..d244969 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -128,7 +128,9 @@ META."
(string-append "perl-" (string-downcase name))))
(define version
- (assoc-ref meta "version"))
+ (match (assoc-ref meta "version")
+ ((? number? vrs) (number->string vrs))
+ ((? string? vrs) vrs)))
(define core-module?
(let ((perl-version (package-version perl))
--
2.10.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] import/cpan: Maybe coerce version to string.
2016-11-12 17:20 ` Alex Sassmannshausen
@ 2016-11-13 12:13 ` Ludovic Courtès
0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2016-11-13 12:13 UTC (permalink / raw)
To: Alex Sassmannshausen; +Cc: guix-devel, Alex Sassmannshausen
Alex Sassmannshausen <alex.sassmannshausen@gmail.com> skribis:
> * guix/import/cpan.scm (cpan-module->sexp) <version>: Test if version in
> meta is string or number. If it is number, coerce to string.
LGTM, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-13 12:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-12 17:20 [PATCH] import/cpan: Maybe coerce version to string Alex Sassmannshausen
2016-11-12 17:20 ` Alex Sassmannshausen
2016-11-13 12:13 ` Ludovic Courtès
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.