From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 25 06:27:16 2020 Received: (at 42338) by debbugs.gnu.org; 25 Sep 2020 10:27:16 +0000 Received: from localhost ([127.0.0.1]:42776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kLkwe-000495-0s for submit@debbugs.gnu.org; Fri, 25 Sep 2020 06:27:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kLkwd-00048u-0t for 42338@debbugs.gnu.org; Fri, 25 Sep 2020 06:27:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55944) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLkwW-0000HE-KO; Fri, 25 Sep 2020 06:27:08 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=60850 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kLkwR-0007bR-4B; Fri, 25 Sep 2020 06:27:05 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Julien Lepiller Subject: Re: [bug#42338] [PATCH 01/34] guix: import: Add composer importer. References: <20200713002055.1553f136@tachikoma.lepiller.eu> <20200712222538.18092-1-julien@lepiller.eu> <87mu21heay.fsf@gnu.org> <20200918004333.127aa5da@tachikoma.lepiller.eu> <87sgbf1o5w.fsf@gnu.org> <20200919012055.1b2e686f@tachikoma.lepiller.eu> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 4 =?utf-8?Q?Vend=C3=A9miaire?= an 229 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 25 Sep 2020 12:27:01 +0200 In-Reply-To: <20200919012055.1b2e686f@tachikoma.lepiller.eu> (Julien Lepiller's message of "Sat, 19 Sep 2020 01:20:55 +0200") Message-ID: <87lfgy179m.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 42338 Cc: 42338@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Julien, Julien Lepiller skribis: > From 70b9cb2bb389f3e5f9dcc75a44d7d60c28f997bc Mon Sep 17 00:00:00 2001 > From: Julien Lepiller > Date: Tue, 29 Oct 2019 08:07:38 +0100 > Subject: [PATCH 01/34] guix: import: Add composer importer. > > * guix/import/composer.scm: New file. > * guix/scripts/import/composer.scm: New file. > * guix/tests/composer.scm: New file. > * Makefile.am: Add them. > * guix/scripts/import.scm: Add composer importer. > * doc/guix.texi (Invoking guix import): Mention it. [...] > +@cindex PHP > +Import metadat from the @uref{https://getcomposer.org/, Composer} package ^ Typo. > +(define* (composer-fetch name #:optional version) > + "Return an alist representation of the Composer metadata for the packa= ge NAME, > +or #f on failure." > + (let ((package (json-fetch > + (string-append (%composer-base-url) "/p/" name ".json= ")))) > + (if package > + (let* ((packages (assoc-ref package "packages")) > + (package (or (assoc-ref packages name) package)) > + (versions (filter > + (lambda (version) > + (and (not (string-contains version "dev")) > + (not (string-contains version "beta"))= )) > + (map car package))) > + (version (or (if (null? version) #f version) > + (latest-version versions)))) > + (assoc-ref package version)) > + #f))) I think this should directly return a since the all the callers pass the alist through =E2=80=98json->composer-package=E2=80=99= . The idea is that alists should be converted to records as soon as they enter the process. Also it=E2=80=99s weird that =E2=80=98package=E2=80=99 above has a =E2=80= =9Cpackages=E2=80=9D (plural) entry. Perhaps we=E2=80=99re missing another JSON mapping? [...] > +++ b/guix/scripts/import/composer.scm > @@ -0,0 +1,107 @@ > +;;; GNU Guix --- Functional package management for GNU > +;;; Copyright =C2=A9 2015 David Thompson > +;;; Copyright =C2=A9 2018 Oleg Pykhalov You can preserve these two lines if you think it=E2=80=99s relevant, but I= =E2=80=99d suggest adding one for yourself. OK to push with changes along these lines. Thanks for taking the time to convert to =E2=80=98define-json-mapping=E2=80= =99 and all! Ludo=E2=80=99.