mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
swh: <revisions> accept null 'date' fields.
* guix/swh.scm (maybe-null): New procedure. (<revision>)[date]: Use it.
This commit is contained in:
parent
b452c3b37a
commit
63ed618e33
1 changed files with 10 additions and 1 deletions
11
guix/swh.scm
11
guix/swh.scm
|
@ -186,6 +186,12 @@ (define (ref n)
|
|||
(ref 10))))))
|
||||
str)) ;oops!
|
||||
|
||||
(define (maybe-null proc)
|
||||
(match-lambda
|
||||
((? null?) #f)
|
||||
('null #f)
|
||||
(obj (proc obj))))
|
||||
|
||||
(define string*
|
||||
;; Converts "string or #nil" coming from JSON to "string or #f".
|
||||
(match-lambda
|
||||
|
@ -319,10 +325,13 @@ (define-json-mapping <release> make-release release?
|
|||
(target-url release-target-url "target_url"))
|
||||
|
||||
;; <https://archive.softwareheritage.org/api/1/revision/359fdda40f754bbf1b5dc261e7427b75463b59be/>
|
||||
;; Note: Some revisions, such as those for "nixguix" origins (e.g.,
|
||||
;; <https://archive.softwareheritage.org/api/1/revision/b8dbc65475bbedde8e015d4730ade8864c38fad3/>),
|
||||
;; have their 'date' field set to null.
|
||||
(define-json-mapping <revision> make-revision revision?
|
||||
json->revision
|
||||
(id revision-id)
|
||||
(date revision-date "date" string->date*)
|
||||
(date revision-date "date" (maybe-null string->date*))
|
||||
(directory revision-directory)
|
||||
(directory-url revision-directory-url "directory_url"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue