From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id KNp9L9e9Q2U0pAAA9RJhRA:P1 (envelope-from ) for ; Thu, 02 Nov 2023 16:18:47 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id KNp9L9e9Q2U0pAAA9RJhRA (envelope-from ) for ; Thu, 02 Nov 2023 16:18:47 +0100 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 77FFA64CF3 for ; Thu, 2 Nov 2023 16:18:47 +0100 (CET) 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+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1698938327; a=rsa-sha256; cv=none; b=m88HxD6Ece5SbZO1JylEvhUPo9YcUpR177LmhXOVQwiFsvpfIcoOvjCF+asvlg5BKjpzWz e6ZUCePtNXO4SSbl3ZGftyZkRTC0mEBLQTpk6KmPMTHBkCM2ArU2MNB64D7y7NejupXuf3 nNi9p/ZhLWdGciE3qHeBqcytnw5IvanPMgWQCFlS9oSK/x9WQb5Hj3lYmNb+ML9XuyKehG JveWcMT2Z9Vo5280bgsFpDAk0TCuZtnurrp5M0owApdguqRmoh5MfbyxV8TbCUAG5iFZKD MXoKeTs4SGLy6Gtjxu4NWWllvJjjVZip7I4OJ0RIEhTgvhoicsQC3o02v2X+ow== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1698938327; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=IQgkNk05s6w4pdMKTI6YkgNnRRQJKOuOUaTH2QoMf/A=; b=gqVGCsb1vWnD+ecF4cNEpNlTbfNm6Qs2on0gR0Vc/P9367KLNoPAYWHWCwp1hBya93vsjS tf5JTgl6/63ts9/jYh0ueVE6nsXY8l6kLwG68/2xLraSBOnyuiCoTSvGSLqbM9a9/PegoB WKaeyimTIILOQLkfU7EJexyIJIv2B9ylaUdLiix/EIBVY7upsP3MLspHgBZw42Ps1rQZi3 25SGzPL6ldC9SNlfi9vh9XcewVTHdf2v4vQpEtcfSTpO8QMLD19lDy6rAf6uDKQx6653Zt oOaDaDb+hw6bfdonoBHTkp6yRtyTpt7dRgDhLFIf8hfph+7dApbx9b9CZNTX4g== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyZSp-00006E-6T; Thu, 02 Nov 2023 11:18:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qyZSn-00004r-4d for guix-patches@gnu.org; Thu, 02 Nov 2023 11:18:29 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyZSm-0003ps-S7 for guix-patches@gnu.org; Thu, 02 Nov 2023 11:18:28 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qyZTL-0006bz-RT for guix-patches@gnu.org; Thu, 02 Nov 2023 11:19:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42338] [PATCH v5 4/9] guix: import: composer: Use memoization. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 02 Nov 2023 15:19:03 +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: 42338@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 42338-submit@debbugs.gnu.org id=B42338.169893830125280 (code B ref 42338); Thu, 02 Nov 2023 15:19:03 +0000 Received: (at 42338) by debbugs.gnu.org; 2 Nov 2023 15:18:21 +0000 Received: from localhost ([127.0.0.1]:55783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyZSe-0006ZZ-QG for submit@debbugs.gnu.org; Thu, 02 Nov 2023 11:18:21 -0400 Received: from 3.mo560.mail-out.ovh.net ([46.105.58.226]:58487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyZSZ-0006Yr-W6 for 42338@debbugs.gnu.org; Thu, 02 Nov 2023 11:18:17 -0400 Received: from director9.ghost.mail-out.ovh.net (unknown [10.108.1.219]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id CDC4226DC5 for <42338@debbugs.gnu.org>; Thu, 2 Nov 2023 15:17:39 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-4qhnc (unknown [10.110.103.155]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 70B6F1FE2D; Thu, 2 Nov 2023 15:17:39 +0000 (UTC) Received: from ngraves.fr ([37.59.142.107]) by ghost-submission-6684bf9d7b-4qhnc with ESMTPSA id po6fDJO9Q2UHFAEAIaFYXg (envelope-from ); Thu, 02 Nov 2023 15:17:39 +0000 X-OVh-ClientIp: 87.88.157.103 Date: Thu, 2 Nov 2023 16:16:51 +0100 Message-ID: <20231102151725.31362-5-ngraves@ngraves.fr> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102151725.31362-1-ngraves@ngraves.fr> References: <20231102151725.31362-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 13660262095901156066 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedruddtiedgjeehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepgffgfeevhfegueetgeektdeiueejieelteffudeugfefffelffegveeffeetffdtnecuffhomhgrihhnpehprggtkhgrghhishhtrdhorhhgnecukfhppeduvdejrddtrddtrddupdekjedrkeekrdduheejrddutdefpdefjedrheelrddugedvrddutdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqedpnhgspghrtghpthhtohepuddprhgtphhtthhopeegvdeffeekseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehiedtpdhmohguvgepshhmthhpohhuth X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches From: Nicolas Graves via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 77FFA64CF3 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -6.11 X-Spam-Score: -6.11 X-TUID: 11DGrolgppSH --- guix/import/composer.scm | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/guix/import/composer.scm b/guix/import/composer.scm index c152f402bb..177dc63092 100644 --- a/guix/import/composer.scm +++ b/guix/import/composer.scm @@ -27,6 +27,7 @@ (define-module (guix import composer) #:use-module (guix import json) #:use-module (guix import utils) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix memoization) #:use-module (guix packages) #:use-module (guix serialization) #:use-module (guix upstream) @@ -197,16 +198,18 @@ (define (make-php-sexp composer-package) ((license) license) (_ license))))))))) -(define* (composer->guix-package package-name #:optional version) - "Fetch the metadata for PACKAGE-NAME from packagist.org, and return the +(define composer->guix-package + (memoize + (lambda* (package-name #:key version #:allow-other-keys) + "Fetch the metadata for PACKAGE-NAME from packagist.org, and return the `package' s-expression corresponding to that package, or #f on failure." - (let ((package (composer-fetch package-name version))) - (and package - (let* ((package (json->composer-package package)) - (dependencies-names (composer-package-require package)) - (dev-dependencies-names (composer-package-dev-require package))) - (values (make-php-sexp package) - (append dependencies-names dev-dependencies-names)))))) + (let ((package (composer-fetch package-name version))) + (and package + (let* ((package (json->composer-package package)) + (dependencies-names (composer-package-require package)) + (dev-dependencies-names (composer-package-dev-require package))) + (values (make-php-sexp package) + (append dependencies-names dev-dependencies-names)))))))) (define (guix-name->composer-name name) "Given a guix package name, return the name of the package in Packagist." @@ -265,6 +268,7 @@ (define %composer-updater (import latest-release))) (define* (composer-recursive-import package-name #:optional version) - (recursive-import package-name '() + (recursive-import package-name + #:version version #:repo->guix-package composer->guix-package #:guix-name php-package-name)) -- 2.41.0