From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id mDnrBny9Q2XM2gAAG6o9tA:P1 (envelope-from ) for ; Thu, 02 Nov 2023 16:17:16 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id mDnrBny9Q2XM2gAAG6o9tA (envelope-from ) for ; Thu, 02 Nov 2023 16:17:16 +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 C416565C71 for ; Thu, 2 Nov 2023 16:17:15 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=none; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1698938235; 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=K53Sp36aXNpopJf9MeO4B0gtMXJAEOfaoQEocAdiRa3L1tdwZ+h2GMVgbh94refBGxZPz0 m94/iB+xjVdIErJcZOo9IQ/uGFCnnNBiaYNe7wPGmmYUpfnoM3lBzXeh9M2QACJlmEZVGr yHgAUeVO0uQOPKPL0OrHSoYSpJVDG1srpJgDgER9PbyfASTNMHS7TJA1g1v/3/G07G5viY JnVygfna35uLhQhSCbudehHTIsOjsZploy1XNWSun/d3PSEwAjUDlyFJ5IRCN630XZOvt/ DkFYibqknKEHv/oomkAUDmg6hML0LXHOdLezxDo+QSClpW+Q/2n3RS2KQsBoMw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1698938235; a=rsa-sha256; cv=none; b=sMtZOW81fRMYSszFg1/+BPvALRw5/DKGHuiwfkDgccLbHXGZhbdaFA4VbDgyMPuDGYjCS3 jcQyUUKjikKQp9Bp+I4YGUoM1JY3XAtUKfyKxXzCU/EINmB/4A4DYHxnZ148QEvVxBftsQ MPddDjb5WkZW0Y0zI5q9RtERrtGILVLCDBLXNGXgCBs6H0+jhApFX/SMRJ76tJGdmazXQf hErkkRmgxpChgi8RlKvHMpSQvH65oMjSzFVFW1/wN5LlzLA1sBdCaLuzP/Y/yIvcUNtap0 5Q4O2AmElrzA7MZDLUCwuJK17dUqvklMe25sDcUcFxeOTwXvYMsFV4cRFrVjLw== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyZRF-0007dl-Fx; Thu, 02 Nov 2023 11:16:53 -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 1qyZQr-0007X2-WE for guix-patches@gnu.org; Thu, 02 Nov 2023 11:16:30 -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 1qyZQr-0002Nx-Jd for guix-patches@gnu.org; Thu, 02 Nov 2023 11:16:29 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qyZRQ-0006Vn-Fi for guix-patches@gnu.org; Thu, 02 Nov 2023 11:17:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42338] [PATCH 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:17:04 +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.169893817824887 (code B ref 42338); Thu, 02 Nov 2023 15:17:04 +0000 Received: (at 42338) by debbugs.gnu.org; 2 Nov 2023 15:16:18 +0000 Received: from localhost ([127.0.0.1]:55742 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyZQf-0006TB-Bc for submit@debbugs.gnu.org; Thu, 02 Nov 2023 11:16:17 -0400 Received: from 14.mo561.mail-out.ovh.net ([188.165.43.98]:50435) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyZQa-0006Rq-1p for 42338@debbugs.gnu.org; Thu, 02 Nov 2023 11:16:14 -0400 Received: from director1.ghost.mail-out.ovh.net (unknown [10.109.138.16]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id 3A0A324C0A for <42338@debbugs.gnu.org>; Thu, 2 Nov 2023 15:15:35 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-lx9jx (unknown [10.110.115.9]) by director1.ghost.mail-out.ovh.net (Postfix) with ESMTPS id D442B1FD4A; Thu, 2 Nov 2023 15:15:34 +0000 (UTC) Received: from ngraves.fr ([37.59.142.101]) by ghost-submission-6684bf9d7b-lx9jx with ESMTPSA id klFlLha9Q2WgCgEAHdxDdw (envelope-from ); Thu, 02 Nov 2023 15:15:34 +0000 X-OVh-ClientIp: 87.88.157.103 Date: Thu, 2 Nov 2023 16:04:24 +0100 Message-ID: <20231102151523.30581-5-ngraves@ngraves.fr> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102151523.30581-1-ngraves@ngraves.fr> References: <20231102151523.30581-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 13625359200884286178 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedruddtiedgjeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepgffgfeevhfegueetgeektdeiueejieelteffudeugfefffelffegveeffeetffdtnecuffhomhgrihhnpehprggtkhgrghhishhtrdhorhhgnecukfhppeduvdejrddtrddtrddupdekjedrkeekrdduheejrddutdefpdefjedrheelrddugedvrddutddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqedpnhgspghrtghpthhtohepuddprhgtphhtthhopeegvdeffeekseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehiedupdhmohguvgepshhmthhpohhuth 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-Spam-Score: -6.11 X-Spam-Score: -6.11 X-Migadu-Queue-Id: C416565C71 X-Migadu-Scanner: mx13.migadu.com X-TUID: 0dNMXMbNQ/1b --- 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