guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH qa-frontpage WIP] Add a library to parse patchwork json data


From: Christopher Baines
Subject: Re: [PATCH qa-frontpage WIP] Add a library to parse patchwork json data
Date: Mon, 25 Sep 2023 13:59:15 +0100
User-agent: mu4e 1.10.5; emacs 28.2

Vivien Kraus <vivien@planete-kraus.eu> writes:

> Hi!
>
> Here is a small library that exports 3 types:
> − <patch-name-metadata> is the collection of metadata that is present
>   in the square brackets in the patch names;
> − <patch> is an individual item of the patch series;
> − <patch-series> is a whole series of patches;
>
> And a set of functions to parse and serialize these.
>
> A fun experiment is to run the following script:
>
> (use-modules (guix-qa-frontpage patchwork patch-series))
> (use-modules (rnrs bytevectors))
> (use-modules (web client))
> (use-modules (ice-9 receive))
> (use-modules (json))
>
> (define patchwork-data
>   (receive (r body)
>       (http-get 
> "https://patches.guix-patches.cbaines.net/api/patches/?order=-id";)
>     (json-string->scm (utf8->string body))))
>
> (define patchwork-series
>   (map scm->patch-series (vector->list patchwork-data)))
>
> (for-each
>  (lambda (correct-series)
>    (display correct-series)
>    (newline))
>  (map patch-series->scm patchwork-series))
>
> You will see that patchwork has quite a lot of creativity when it
> comes to breaking my expectations. I made sure to add as much
> information in exceptions so that we can understand what is happening.

This looks good, but would it be possible to adapt this to work with the
series endpoint [1], rather than the patches one?

1: https://patches.guix-patches.cbaines.net/api/series/?order=-id

I think the use of the patches endpoint currently is just because
previously the Patchwork checks information was used. Now that Patchwork
checks aren't used, I think the series endpoint can be used instead, and
this should map much more closely to the data structures you're trying
to construct.

Thanks,

Chris

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]