guix-patches
[Top][All Lists]
Advanced

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

[bug#53060] [PATCH 0/2] Allow the github updater to update git sources


From: Ludovic Courtès
Subject: [bug#53060] [PATCH 0/2] Allow the github updater to update git sources
Date: Sun, 16 Jan 2022 23:19:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi,

Maxime Devos <maximedevos@telenet.be> skribis:

> Follow-up to <https://issues.guix.gnu.org/50072>.
>
> To test, you can do
>
> $ make check
> $ ./pre-inst-env guix refresh -t github -u zig
>
> and verify that the version and sha256/base32 has been updated
> (zig@0.9.0 doesn't work though; patches aren't applying cleanly).

Nice, applied!

One comment:

> +(define (call-with-releases thunk tags releases)
> +  (mock ((guix http-client) http-fetch
> +         (lambda* (uri #:key headers)
> +           (unless (string-prefix? "mock://" uri)
> +             (error "the URI ~a should not be used" uri))
> +           (define components
> +             (string-split (substring uri 8) #\/))
> +           (pk 'stuff components headers)
> +           (define (scm->json-port scm)
> +             (open-input-string (scm->json-string scm)))
> +           (match components
> +             (("repos" "foo" "foomatics" "releases")
> +              (scm->json-port releases))
> +             (("repos" "foo" "foomatics" "tags")
> +              (scm->json-port tags))
> +             (rest (error "TODO ~a" rest)))))
> +        (parameterize ((%github-api "mock://"))
> +          (thunk))))

I think the whole point of having the ‘%github-api’ parameter is that it
allows us to mock the HTTP server instead of having to override bindings
such as ‘http-fetch’.

I’d have a slight preference for doing that, similar to what is done in
tests/cpan.scm for instance.  WDYT?

Thanks,
Ludo’.





reply via email to

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