From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 0KQENqbHbV+0NQAA0tVLHw (envelope-from ) for ; Fri, 25 Sep 2020 10:34:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gN/IMabHbV+NMwAAB5/wlQ (envelope-from ) for ; Fri, 25 Sep 2020 10:34:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6C84A940365 for ; Fri, 25 Sep 2020 10:34:14 +0000 (UTC) Received: from localhost ([::1]:56992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLl3N-0002lU-Bm for larch@yhetil.org; Fri, 25 Sep 2020 06:34:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLkxO-0005TM-Rg for guix-patches@gnu.org; Fri, 25 Sep 2020 06:28:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59463) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLkxO-0000Iv-FW for guix-patches@gnu.org; Fri, 25 Sep 2020 06:28:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kLkxO-0004AM-C2 for guix-patches@gnu.org; Fri, 25 Sep 2020 06:28:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42338] [PATCH 01/34] guix: import: Add composer importer. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 25 Sep 2020 10:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42338 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Julien Lepiller Cc: 42338@debbugs.gnu.org Received: via spool by 42338-submit@debbugs.gnu.org id=B42338.160102963615944 (code B ref 42338); Fri, 25 Sep 2020 10:28:02 +0000 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.51 X-TUID: 6pIV8OqNQLzi 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.