me
/
guix
Archived
1
0
Fork 0

import: launchpad: Gracefully handle 404s from api.launchpad.net.

Fixes <https://bugs.gnu.org/49031>.
Reported by Emad Alblueshi <emad.albloushi@gmail.com>.

* guix/import/launchpad.scm (latest-released-version): Gracefully handle
'json-fetch' returning #f.
master
Ludovic Courtès 2021-06-15 23:18:46 +02:00
parent bccf2a9e25
commit f371972e78
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 8 additions and 9 deletions

View File

@ -110,15 +110,14 @@ for example, 'linuxdcpp'. Return #f if there is no releases."
char-set:digit)
(assoc-ref x "version"))))
(assoc-ref
(last (remove
pre-release?
(vector->list
(assoc-ref (json-fetch
(string-append "https://api.launchpad.net/1.0/"
package-name "/releases"))
"entries"))))
"version"))
(match (json-fetch
(string-append "https://api.launchpad.net/1.0/"
package-name "/releases"))
(#f #f) ;404 or similar
(json
(assoc-ref
(last (remove pre-release? (vector->list (assoc-ref json "entries"))))
"version"))))
(define (latest-release pkg)
"Return an <upstream-source> for the latest release of PKG."