From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:41795) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3kge-0000wl-Ae for guix-patches@gnu.org; Mon, 17 Feb 2020 13:00:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3kgd-0001YJ-33 for guix-patches@gnu.org; Mon, 17 Feb 2020 13:00:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33216) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3kgc-0001Y7-Uo for guix-patches@gnu.org; Mon, 17 Feb 2020 13:00:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j3kgc-0000Pe-TX for guix-patches@gnu.org; Mon, 17 Feb 2020 13:00:02 -0500 Subject: [bug#39547] [PATCH] website: Provide JSON sources list used by Software Heritage. Resent-Message-ID: MIME-Version: 1.0 References: <20200210170418.32076-1-zimon.toutoune@gmail.com> <87pnehk1de.fsf@gnu.org> <8736bdjwqx.fsf@inria.fr> In-Reply-To: <8736bdjwqx.fsf@inria.fr> From: zimoun Date: Mon, 17 Feb 2020 18:59:24 +0100 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 39547@debbugs.gnu.org Hi Ludo, On Fri, 14 Feb 2020 at 11:20, Ludovic Court=C3=A8s wrote: > zimoun skribis: > >> Could you, in a first patch, move =E2=80=98origin->json=E2=80=99 out o= f > >> =E2=80=98packages-json-builder=E2=80=99, and in a second patch, add mi= rror-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"? > > Yes, exactly. No reason to have two copies of that code. The minor "issue" is the 'match' piece of 'origin->json': --8<---------------cut here---------------start------------->8--- `(("url" . ,(match uri ((? string? url) (vector url)) ((urls ...) (list->vector urls)))))) --8<---------------cut here---------------end--------------->8--- Because in the 'sources.json' it is always one unique string. However, in 'packages.json' it is always a vector of one or several elements. And in the previous patch, the job of 'resolve' was to uniquify these elements for 'sources.json'. For example, see the package 'adns' in 'packages.json' --8<---------------cut here---------------start------------->8--- { "name": "adns", "version": "1.5.1", "source": { "type": "url", "url": [ "mirror://gnu/adns/adns-1.5.1.tar.gz", "http://www.chiark.greenend.org.uk/~ian/adns/ftp/adns-1.5.1.tar.gz" ] }, "synopsis": "Asynchronous DNS client library and utilities", "homepage": "https://www.gnu.org/software/adns/", "location": "gnu/packages/adns.scm:32" }, --8<---------------cut here---------------end--------------->8--- Just to be on the same wavelength, does 'packages.json' stay as it is (vector for the source url field)? Or is 'packages.json' modified to record only one url for the source url field with mirror:// expanded? Cheers, simon