blob: 0910566537f9110cac8260589c733cc0ddd6f6d5 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
(define-module (guix-qa-frontpage patchwork)
#:use-module (srfi srfi-11)
#:use-module (rnrs bytevectors)
#:use-module (json)
#:use-module (web uri)
#:use-module (web client)
#:use-module (web request)
#:use-module (web response)
#:use-module (guix-build-coordinator utils)
#:export (%patchwork-instance
patchwork-patches))
(define %patchwork-instance
(make-parameter "https://patches.guix-patches.cbaines.net"))
(define* (patchwork-patches
#:key patchwork
(archived? #f)
(order "-id")
(states '("1" "2" "7" "11")))
(define initial-uri
(string->uri
(string-append (or patchwork
(%patchwork-instance))
"/api/patches/?"
"order=" order "&"
"archived=" (if archived? "true" "false") "&"
(string-join
(map (lambda (state)
(string-append "state=" state))
states)
"&"))))
(define (make-request uri)
(let-values (((response body)
(http-request uri
#:decode-body? #f)))
(values
(and body (json-string->scm (utf8->string body)))
response)))
(retry-on-error (lambda () (make-request initial-uri))
#:times 9
#:delay 10))
|