summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-09-06 14:03:28 +0200
committerLudovic Courtès <ludo@gnu.org>2021-09-06 22:58:12 +0200
commit63ed618e337a466772aadd6ef3b919b7f04b666d (patch)
tree98236d1515fca7d4ac56e8fba0a4c2d2684a9e1e /guix
parentb452c3b37a09e0d52b55c301a916074760efbafa (diff)
swh: <revisions> accept null 'date' fields.
* guix/swh.scm (maybe-null): New procedure. (<revision>)[date]: Use it.
Diffstat (limited to 'guix')
-rw-r--r--guix/swh.scm11
1 files changed, 10 insertions, 1 deletions
diff --git a/guix/swh.scm b/guix/swh.scm
index 7b14a70693..4d0a647d6f 100644
--- a/guix/swh.scm
+++ b/guix/swh.scm
@@ -186,6 +186,12 @@ Software Heritage."
(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 @@ FALSE-IF-404? is true, return #f upon 404 responses."
(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"))