From: zimoun <zimon.toutoune@gmail.com>
To: "Ludovic Courtès" <ludovic.courtes@inria.fr>
Cc: 39547@debbugs.gnu.org
Subject: [bug#39547] [PATCH] website: Provide JSON sources list used by Software Heritage.
Date: Fri, 14 Feb 2020 10:04:01 +0100 [thread overview]
Message-ID: <CAJ3okZ3KJT1O8xgN53gdiPvgXTR5T103RbxYgfqJnB3yZ+tZaw@mail.gmail.com> (raw)
In-Reply-To: <87pnehk1de.fsf@gnu.org>
Hi Ludo,
Thank you for the review.
On Fri, 14 Feb 2020 at 09:40, Ludovic Courtès <ludovic.courtes@inria.fr> wrote:
> zimoun <zimon.toutoune@gmail.com> skribis:
> > Format discussed here <https://forge.softwareheritage.org/D2025#51269>.
> >
> > * website/apps/packages/builder.scm (sources-json-builder): New procedure.
>
> [...]
>
> > +(define (sources-json-builder)
> > + "Return a JSON page listing all the sources."
>
> Please add a reference to
> <https://forge.softwareheritage.org/D2025#51269> here.
ok
> > + (define (origin->json origin)
> > + (define method
> > + (origin-method origin))
> > +
> > + (define uri ;represented as string
> > + (origin-uri origin))
> > +
> > + (define (mirror->url uri)
> > + (uri->string (car (maybe-expand-mirrors uri %mirrors))))
> > +
> > + (define (resolve urls)
> > + (let* ((url (car urls))
> > + (uri (string->uri url))
> > + (rest (cdr urls)))
> > + (case (uri-scheme uri)
> > + ((mirror) (mirror->url uri))
> > + ((http) url)
> > + ((https) url)
> > + (else
> > + (if (null? rest)
> > + url
> > + (resolve rest))))))
> > +
> > + `((type . ,(cond ((eq? url-fetch method) 'url)
> > + ((eq? git-fetch method) 'git)
> > + ((eq? svn-fetch method) 'svn)
> > + (else #nil)))
> > + ,@(cond ((eq? url-fetch method)
> > + `(("url" . ,(match uri
> > + ((? string? url) (mirror->url (string->uri url)))
> > + ((urls ...) (resolve urls))))))
> > + ((eq? git-fetch method)
> > + `(("git_url" . ,(git-reference-url uri))))
> > + ((eq? svn-fetch method)
> > + `(("svn_url" . ,(svn-reference-url uri))))
> > + (else '()))
> > + ,@(if (eq? method git-fetch)
> > + `(("git_ref" . ,(git-reference-commit uri)))
> > + '())
> > + ,@(if (eq? method svn-fetch)
> > + `(("svn_revision" . ,(svn-reference-revision
> > + uri)))
> > + '())))
>
> Could you, in a first patch, move ‘origin->json’ out of
> ‘packages-json-builder’, and in a second patch, add mirror-expansion
> feature?
Yes, I will try but I am a bit lost. There is:
- packages-json-builder that I did not modified
- sources-json-builder which the "adaptation" of the former to output
to the sources.json format.
Well, do you want a refactor of 'origin->json' shared by the 2
"{sources,packages}-json-builder"?
> For mirror:// expansion, I think you can just write something like:
>
> (define uris
> (append-map (cut maybe-expand-mirrors <> %mirrors)
> (match url
> ((_ ...) (map string->uri url))
> (_ (list (string->uri url))))))
>
> and then pick the first element of the list.
Yes, it is better. :-)
> In parallel, I’d recommend suggesting a format change or addition that
> would allow us to provide all the URLs. :-)
Ok :-)
> With those changes in place, I think we’ll be ready to go!
Working on updating the package Julia, I have seen that some patches
are 'origin' and live for example upstream
(https://blablab/project.git/patches/fancy-name.patch) and the current
patch will not list them. Therefore, if upstream disappears and/or
change in-place the patches, Guix would not be able to re-build in the
future (time-machine).
I am trying to implement a recursive exporter.
Well, I will try to make that the v2 contains your suggestions and all
the patches.
Cheers,
simon
next prev parent reply other threads:[~2020-02-14 9:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-10 17:04 [bug#39547] [PATCH] website: Provide JSON sources list used by Software Heritage zimoun
2020-02-14 8:40 ` Ludovic Courtès
2020-02-14 9:04 ` zimoun [this message]
2020-02-14 10:20 ` Ludovic Courtès
2020-02-17 17:59 ` zimoun
2020-02-18 8:24 ` Ludovic Courtès
2020-02-18 8:38 ` zimoun
2020-02-18 8:43 ` Ludovic Courtès
2020-02-18 12:32 ` [bug#39547] [PATCH v2 1/2] website: Refactor and resolve mirror:// of JSON package list zimoun
2020-02-18 12:32 ` [bug#39547] [PATCH v2 2/2] website: Provide JSON sources list used by Software Heritage zimoun
2020-03-02 17:24 ` [bug#39547] [PATCH v3] sources.json: array instead of list zimoun
2020-03-06 11:01 ` Ludovic Courtès
2020-03-07 22:17 ` zimoun
2020-03-09 9:53 ` bug#39547: " Ludovic Courtès
2020-03-03 18:00 ` [bug#39547] Addition of %content-addressed-mirrors to sources.json (SWH)? zimoun
2020-03-05 16:19 ` Ludovic Courtès
2020-03-06 9:26 ` zimoun
2020-03-06 10:57 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJ3okZ3KJT1O8xgN53gdiPvgXTR5T103RbxYgfqJnB3yZ+tZaw@mail.gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=39547@debbugs.gnu.org \
--cc=ludovic.courtes@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.