From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cBAEAwXKDmCTEgAA0tVLHw (envelope-from ) for ; Mon, 25 Jan 2021 13:39:17 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id AFZgOgTKDmAIKAAAbx9fmQ (envelope-from ) for ; Mon, 25 Jan 2021 13:39:16 +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 AA1749403A4 for ; Mon, 25 Jan 2021 13:39:16 +0000 (UTC) Received: from localhost ([::1]:48080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l425L-0001QF-Kr for larch@yhetil.org; Mon, 25 Jan 2021 08:39:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4259-0001Pe-AO for guix-patches@gnu.org; Mon, 25 Jan 2021 08:39:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:54945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l4258-0004y8-Q0 for guix-patches@gnu.org; Mon, 25 Jan 2021 08:39:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l4258-0001yS-NV for guix-patches@gnu.org; Mon, 25 Jan 2021 08:39:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46100] [PATCH 4/4] inferior: Memoize package input field access. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 25 Jan 2021 13:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46100 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46100@debbugs.gnu.org X-Debbugs-Original-To: 46100@debbugs.gnu.org, guix-patches@gnu.org Received: via spool by 46100-submit@debbugs.gnu.org id=B46100.16115818937504 (code B ref 46100); Mon, 25 Jan 2021 13:39:02 +0000 Received: (at 46100) by debbugs.gnu.org; 25 Jan 2021 13:38:13 +0000 Received: from localhost ([127.0.0.1]:38255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l424L-0001wt-2s for submit@debbugs.gnu.org; Mon, 25 Jan 2021 08:38:13 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21114) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l424G-0001wQ-IY for 46100@debbugs.gnu.org; Mon, 25 Jan 2021 08:38:09 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1611581879; cv=none; d=zohomail.com; s=zohoarc; b=m9C4L6nK9hU/pb155aU5PQvCmFlQXkUqzGXcwf1eP69zTxW+CzoAwfXZzrGKkJJ4BT6pPkjTOXpfPguX8L9l/kuFEaQwpwQF3uUJI03UbIVG5PD786cqFrZMWwhkjcAsrh7Ckit0szFxHCl0wogRfuGe1AE9aUDJ5O+PcGPHIs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611581879; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=8kTEVM6w1p3TWeNXVVkIWF7+WBNaws/XuAlHfHtOZgc=; b=aicLLtD6Gnio8b7646Bd+sdarRxzuv5jBQ4e8nBUw6bQQ+SCWaazYv3LeXWAGYE9PfnTQDZ268k3HMhppLXJKf71M2M7ZvKJ9fcZdT/9F0FBXBd7e/yKhn37Eh4aUsE3+kGYAH9Wa+auQxHwRC6dSAxsmo+L4bw0eX3hvec6r+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1611581879; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=8kTEVM6w1p3TWeNXVVkIWF7+WBNaws/XuAlHfHtOZgc=; b=ZnmrWgUJCaMeZhXNUbi2e2zqovFJiGj9FxCDxTELCijk76T7r6pOfpROe5m6RIXS TGzyqvy8tv0Aa32oGEwbu7aWEPjmL2GS/LJzx2AlaO5btjR32zJq+WqONn5sYrS+raw nQxaZVFK6O+YI/eCxa2v3J5GZtRo4biYxtPfwuEg= Received: from localhost (p54ad4ec7.dip0.t-ipconnect.de [84.173.78.199]) by mx.zohomail.com with SMTPS id 1611581877141429.7993420843868; Mon, 25 Jan 2021 05:37:57 -0800 (PST) From: Ricardo Wurmus Message-ID: <20210125133738.15609-4-rekado@elephly.net> Date: Mon, 25 Jan 2021 14:37:38 +0100 X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210125133738.15609-1-rekado@elephly.net> References: <20210125133738.15609-1-rekado@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External 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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 1.65 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elephly.net header.s=zoho header.b=ZnmrWgUJ; arc=reject ("signature check failed: fail, {[1] = sig:zohomail.com:reject}"); dmarc=none; 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-Migadu-Queue-Id: AA1749403A4 X-Spam-Score: 1.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: JDDaR26H0WXF From: Ludovic Court=C3=A8s * guix/inferior.scm (inferior-package-input-field): Return memoized procedu= re accepting a package. (inferior-package-inputs, inferior-package-native-inputs, inferior-package-propagated-inputs, inferior-package-transitive-propagated-inputs): Adapt. --- guix/inferior.scm | 71 ++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index 0c85a9ea08..b5e8939a1d 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2018, 2019, 2020 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2018, 2019, 2020, 2021 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2021 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. @@ -386,50 +386,51 @@ record." loc))) package-location)))) =20 -(define (inferior-package-input-field package field) +(define (inferior-package-input-field field) "Return the input field FIELD (e.g., 'native-inputs') of PACKAGE, an inferior package." - (define field* - `(compose (lambda (inputs) - (map (match-lambda - ;; XXX: Origins are not handled. - ((label (? package? package) rest ...) - (let ((id (object-address package))) - (hashv-set! %package-table id package) - `(,label (package ,id - ,(package-name package) - ,(package-version package)) - ,@rest))) - (x - x)) - inputs)) - ,field)) - - (define inputs - (inferior-package-field package field*)) - - (define inferior - (inferior-package-inferior package)) - - (map (match-lambda - ((label ('package id name version) . rest) - ;; XXX: eq?-ness of inferior packages is not preserved here. - `(,label ,(inferior-package inferior name version id) - ,@rest)) - (x x)) - inputs)) + (mlambdaq (package) + (define field* + `(compose (lambda (inputs) + (map (match-lambda + ;; XXX: Origins are not handled. + ((label (? package? package) rest ...) + (let ((id (object-address package))) + (hashv-set! %package-table id package) + `(,label (package ,id + ,(package-name package) + ,(package-version package)) + ,@rest))) + (x + x)) + inputs)) + ,field)) + + (define inputs + (inferior-package-field package field*)) + + (define inferior + (inferior-package-inferior package)) + + (map (match-lambda + ((label ('package id name version) . rest) + ;; XXX: eq?-ness of inferior packages is not preserved here. + `(,label ,(inferior-package inferior name version id) + ,@rest)) + (x x)) + inputs))) =20 (define inferior-package-inputs - (cut inferior-package-input-field <> 'package-inputs)) + (inferior-package-input-field 'package-inputs)) =20 (define inferior-package-native-inputs - (cut inferior-package-input-field <> 'package-native-inputs)) + (inferior-package-input-field 'package-native-inputs)) =20 (define inferior-package-propagated-inputs - (cut inferior-package-input-field <> 'package-propagated-inputs)) + (inferior-package-input-field 'package-propagated-inputs)) =20 (define inferior-package-transitive-propagated-inputs - (cut inferior-package-input-field <> 'package-transitive-propagated-inpu= ts)) + (inferior-package-input-field 'package-transitive-propagated-inputs)) =20 (define (%inferior-package-search-paths field) "Return the list of search path specifications of PACKAGE, an inferior --=20 2.29.2