From patchwork Mon Jan 25 13:37:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 26627 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B10FF27BC1C; Mon, 25 Jan 2021 13:38:12 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 07D2127BC1B for ; Mon, 25 Jan 2021 13:38:12 +0000 (GMT) Received: from localhost ([::1]:46544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l424J-0000cx-58 for patchwork@mira.cbaines.net; Mon, 25 Jan 2021 08:38:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l424B-0000ZB-2l for guix-patches@gnu.org; Mon, 25 Jan 2021 08:38:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:54924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l424A-0004YS-R0 for guix-patches@gnu.org; Mon, 25 Jan 2021 08:38:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l424A-0001v2-NZ for guix-patches@gnu.org; Mon, 25 Jan 2021 08:38:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46101] [PATCH 1/4] guix: Fix typo. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 25 Jan 2021 13:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46101 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46100@debbugs.gnu.org, 46101@debbugs.gnu.org X-Debbugs-Original-To: 46100@debbugs.gnu.org, guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16115818737332 (code B ref -1); Mon, 25 Jan 2021 13:38:02 +0000 Received: (at submit) by debbugs.gnu.org; 25 Jan 2021 13:37:53 +0000 Received: from localhost ([127.0.0.1]:38231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4241-0001u7-4O for submit@debbugs.gnu.org; Mon, 25 Jan 2021 08:37:53 -0500 Received: from lists.gnu.org ([209.51.188.17]:40364) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l423z-0001tt-SV for submit@debbugs.gnu.org; Mon, 25 Jan 2021 08:37:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l423z-0000Qz-6d for guix-patches@gnu.org; Mon, 25 Jan 2021 08:37:51 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21197) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l423x-0004RJ-Np for guix-patches@gnu.org; Mon, 25 Jan 2021 08:37:51 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1611581867; cv=none; d=zohomail.com; s=zohoarc; b=S5CJTfGvaNkA6oaaXDz5mJ+kG4dSMB2J5PG++VEV6HyN7lNO7CkrjpDh3PLa3dsFu+0qK5Fm2umLyY28qpntGeDTgeR93quDV9+6Ez1W5TBpu2mNdhPhgVMfDxCFz2RR0+N2PGX26TMCYbwjyeh3gdlERb7IBhDjyiebZe9t/jo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611581867; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=6UH5E1aB1D/0XFXNBiUgCFHiWKb5ysbfOvEUqn/YDL4=; b=OnlNNsTeQ7rkxUMGoLA3O98Uf2DlG7hATGi5TXq47u8Rq6nyK5WexguxAzYL6FwniAo8Z0t8cbWKCUVXXKGr453xmf4aIER+BQHyuQHk18kXRpL9bQTwd5trEELPyI5lWFcJ8x+VJRlWs61ewdJvYzQnNIuMWmES4f7fTIldE9Q= 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=1611581867; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=6UH5E1aB1D/0XFXNBiUgCFHiWKb5ysbfOvEUqn/YDL4=; b=DsaelqKDY9QwXfOLcvOMiAE4pNNZxpqXnWtgNUwtyf3IEDoRDFtOaNhVD2cU6nYK GVANWqAbtcePS1gNjHxJb8fojwV/kM0tstVHyP4FRpw7E+0998A2qplVBm7/xN6+7Be pt6uXXCFzcZEYTUA6yu6fGwvmhP1kS0kcPlT1m64= Received: from localhost (p54ad4ec7.dip0.t-ipconnect.de [84.173.78.199]) by mx.zohomail.com with SMTPS id 1611581865172871.2063357970442; Mon, 25 Jan 2021 05:37:45 -0800 (PST) From: Ricardo Wurmus Message-ID: <20210125133738.15609-1-rekado@elephly.net> Date: Mon, 25 Jan 2021 14:37:35 +0100 X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.51; envelope-from=rekado@elephly.net; helo=sender4-of-o51.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/inferior.scm (inferior-available-packages): Remove extra word in docstring. --- guix/inferior.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index 2fe91beaab..da6983d9a6 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -311,8 +311,7 @@ Raise '&inferior-exception' when an exception is read from PORT." "Return the list of name/version pairs corresponding to the set of packages available in INFERIOR. -This is faster and requires less resource-intensive than calling -'inferior-packages'." +This is faster and less resource-intensive than calling 'inferior-packages'." (if (inferior-eval '(defined? 'fold-available-packages) inferior) (inferior-eval '(fold-available-packages From patchwork Mon Jan 25 13:37:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 26628 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 7A18F27BC1B; Mon, 25 Jan 2021 13:38:14 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A6B2227BC1A for ; Mon, 25 Jan 2021 13:38:13 +0000 (GMT) Received: from localhost ([::1]:46632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l424K-0000j1-Rf for patchwork@mira.cbaines.net; Mon, 25 Jan 2021 08:38:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l424C-0000c1-AB for guix-patches@gnu.org; Mon, 25 Jan 2021 08:38:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:54928) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l424C-0004ZF-3M for guix-patches@gnu.org; Mon, 25 Jan 2021 08:38:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l424B-0001vQ-Vq for guix-patches@gnu.org; Mon, 25 Jan 2021 08:38:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46102] [PATCH 2/4] inferior: Memoize inferior-package->manifest-entry. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 25 Jan 2021 13:38:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46102 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46100@debbugs.gnu.org, 46102@debbugs.gnu.org X-Debbugs-Original-To: 46100@debbugs.gnu.org, guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16115818827371 (code B ref -1); Mon, 25 Jan 2021 13:38:03 +0000 Received: (at submit) by debbugs.gnu.org; 25 Jan 2021 13:38:02 +0000 Received: from localhost ([127.0.0.1]:38237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4249-0001uk-NA for submit@debbugs.gnu.org; Mon, 25 Jan 2021 08:38:01 -0500 Received: from lists.gnu.org ([209.51.188.17]:40442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4246-0001uV-GK for submit@debbugs.gnu.org; Mon, 25 Jan 2021 08:37:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4245-0000T5-4a for guix-patches@gnu.org; Mon, 25 Jan 2021 08:37:58 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21104) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4243-0004Tu-7o for guix-patches@gnu.org; Mon, 25 Jan 2021 08:37:56 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1611581871; cv=none; d=zohomail.com; s=zohoarc; b=CWnD/gwIqd53rHHGNxn8aVy63UCpjh8J7QKMNVtyij8FrcJVO0vSDqTf6QwWLf8m+VHz1a6yAquMGm5MzwucOyJGUku1TKvn+uq+a0j2Lgb3ozeInjYcL8rEqmjBa07Sv32vPNgNFc7zHx++5Ati/blIvHBnyqyX+e9ulB3kixc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611581871; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=cAPpwspxUMRYLMxOYgtP5Nr+GXLx0YRveoeqjP/TTB4=; b=Gig9Lplb7GtcF2qaZUAYcvOHAKf0Hi45s2oZel2jkjAYKABXJW6CpG3AspmFc1L1nwqw19/0I6tVug8xEETtJmj6hD81GjXfrphd0V6qFQjjHVaw3PjipmBSEONdiZ6zH615YpiApZk/dYl60cHlVZ1/dFooSP6zYJQFJdtxjyY= 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=1611581871; 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=cAPpwspxUMRYLMxOYgtP5Nr+GXLx0YRveoeqjP/TTB4=; b=azYrMg50V74i6Mq1LfWtNsY3XnULIpJHr1z7Ow5Veug1RYS58s1+iPpYcRi2V4LA mOSaLssudN9ziZ/Z9xpaRI9jhbEw5lMeRGIxxP7/MyAdd+tqH734jTg//TWkUAER6Db zLYEfZK6STxuv6N8bUHFbECM6G2cvqmO7sTvPsyQ= Received: from localhost (p54ad4ec7.dip0.t-ipconnect.de [84.173.78.199]) by mx.zohomail.com with SMTPS id 1611581868760918.1867490546068; Mon, 25 Jan 2021 05:37:48 -0800 (PST) From: Ricardo Wurmus Message-ID: <20210125133738.15609-2-rekado@elephly.net> Date: Mon, 25 Jan 2021 14:37:36 +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 X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.51; envelope-from=rekado@elephly.net; helo=sender4-of-o51.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/inferior.scm (inferior-package->manifest-entry): Memoize. --- guix/inferior.scm | 55 ++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index da6983d9a6..7bfce5d810 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2021 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -639,31 +640,35 @@ failing when GUIX is too old and lacks the 'guix repl' command." ;;; Manifest entries. ;;; -(define* (inferior-package->manifest-entry package - #:optional (output "out") - #:key (parent (delay #f)) - (properties '())) - "Return a manifest entry for the OUTPUT of package PACKAGE." - ;; For each dependency, keep a promise pointing to its "parent" entry. - (letrec* ((deps (map (match-lambda - ((label package) - (inferior-package->manifest-entry package - #:parent (delay entry))) - ((label package output) - (inferior-package->manifest-entry package output - #:parent (delay entry)))) - (inferior-package-propagated-inputs package))) - (entry (manifest-entry - (name (inferior-package-name package)) - (version (inferior-package-version package)) - (output output) - (item package) - (dependencies (delete-duplicates deps)) - (search-paths - (inferior-package-transitive-native-search-paths package)) - (parent parent) - (properties properties)))) - entry)) +(define inferior-package->manifest-entry + (let ((results vlist-null)) + (lambda* (package #:optional (output "out") + #:key (parent (delay #f)) + (properties '())) + "Return a manifest entry for the OUTPUT of package PACKAGE." + (or (and=> (vhash-assoc package results) cdr) + ;; For each dependency, keep a promise pointing to its "parent" entry. + (letrec* ((deps (map (match-lambda + ((label package) + (inferior-package->manifest-entry package + #:parent (delay entry))) + ((label package output) + (inferior-package->manifest-entry package output + #:parent (delay entry)))) + (inferior-package-propagated-inputs package))) + (entry (manifest-entry + (name (inferior-package-name package)) + (version (inferior-package-version package)) + (output output) + (item package) + (dependencies (delete-duplicates deps)) + (search-paths + (inferior-package-transitive-native-search-paths package)) + (parent parent) + (properties properties)))) + (begin + (set! results (vhash-cons package entry results)) + entry)))))) ;;; From patchwork Mon Jan 25 13:37:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 26630 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8C7F327BC1C; Mon, 25 Jan 2021 13:39:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 31FFC27BC1B for ; Mon, 25 Jan 2021 13:39:15 +0000 (GMT) Received: from localhost ([::1]:48070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l425K-0001Pq-CM for patchwork@mira.cbaines.net; Mon, 25 Jan 2021 08:39:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4257-0001Og-Rw for guix-patches@gnu.org; Mon, 25 Jan 2021 08:39:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:54942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l4257-0004xw-L0 for guix-patches@gnu.org; Mon, 25 Jan 2021 08:39:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l4257-0001y3-Gt for guix-patches@gnu.org; Mon, 25 Jan 2021 08:39:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46101] [PATCH 3/4] inferior: Memoize inferior package search path access. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 25 Jan 2021 13:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46101 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46100@debbugs.gnu.org, 46101@debbugs.gnu.org X-Debbugs-Original-To: 46100@debbugs.gnu.org, guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16115818887474 (code B ref -1); Mon, 25 Jan 2021 13:39:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 Jan 2021 13:38:08 +0000 Received: from localhost ([127.0.0.1]:38249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l424G-0001wS-Av for submit@debbugs.gnu.org; Mon, 25 Jan 2021 08:38:08 -0500 Received: from lists.gnu.org ([209.51.188.17]:40624) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l424A-0001vB-T0 for submit@debbugs.gnu.org; Mon, 25 Jan 2021 08:38:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l424A-0000YK-JW for guix-patches@gnu.org; Mon, 25 Jan 2021 08:38:02 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4247-0004Vt-Pv for guix-patches@gnu.org; Mon, 25 Jan 2021 08:38:02 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1611581875; cv=none; d=zohomail.com; s=zohoarc; b=nc5AEciNdvs5xK5c/8lNVw11qA3/5PngPAHJ5iX2tXe/BreS2ZsvCyWScBFgAxJVN50PMFZ1p9sqdOv2sbDtSvbNWj+Y90sM3SmdjmOtG7+ZtfNcdjSIBmzyjiIKhs6dEGeAJIyaeQquA/Dzs6eBkRZcG7N+ovM8NAzFnzw+uQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611581875; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=OA/Bh6Hl4/PIxHtpZEs7jz/FNcsenzfolLCuCE5k+fc=; b=G1epHyWLJZKlmbwzhEVuVrbrMyVBRmBuzCulXbkOKGZzIkiRpzfawdRe18C5uUIDiNhd6hd/giGZI8kEZ9kmS3qy2TBwG8LFhl+vfIm3GfCtbr2JreGyq54RaUvWHzSX8kdbM65x7G1xacqePDQi9DwH+qArtzeITMi2EDmq4cY= 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=1611581875; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=OA/Bh6Hl4/PIxHtpZEs7jz/FNcsenzfolLCuCE5k+fc=; b=aONhdJKjKSx/RTR1Q41r8hEx87V8xund1kLxPJiwpiK+3zVAX5gLSfNwAbtJkPaF R3GQTJd5AYcYtPpMnMKPjNdp9jziVd9RerN4afLLrGRT7DGJNB2928EKATLE48gxXzk zKgKw32g4ekBeTpU9J5tAoltOic7T8jNquNljNAs= Received: from localhost (p54ad4ec7.dip0.t-ipconnect.de [84.173.78.199]) by mx.zohomail.com with SMTPS id 1611581873054657.0029672331033; Mon, 25 Jan 2021 05:37:53 -0800 (PST) From: Ricardo Wurmus Message-ID: <20210125133738.15609-3-rekado@elephly.net> Date: Mon, 25 Jan 2021 14:37:37 +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 X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.51; envelope-from=rekado@elephly.net; helo=sender4-of-o51.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/inferior.scm (%inferior-package-search-paths): Return memoized procedure accepting a package. (inferior-package-native-search-paths, inferior-package-search-paths, inferior-package-transitive-native-search-paths): Adapt. --- guix/inferior.scm | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index 7bfce5d810..0c85a9ea08 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -45,6 +45,7 @@ #:use-module (guix store) #:use-module (guix derivations) #:use-module (guix base32) + #:use-module ((guix memoization) #:select (mlambdaq)) #:use-module (gcrypt hash) #:autoload (guix cache) (maybe-remove-expired-cache-entries file-expiration-time) @@ -430,27 +431,28 @@ inferior package." (define inferior-package-transitive-propagated-inputs (cut inferior-package-input-field <> 'package-transitive-propagated-inputs)) -(define (%inferior-package-search-paths package field) +(define (%inferior-package-search-paths field) "Return the list of search path specifications of PACKAGE, an inferior package." - (define paths - (inferior-package-field package - `(compose (lambda (paths) - (map (@ (guix search-paths) - search-path-specification->sexp) - paths)) - ,field))) + (mlambdaq (package) + (define paths + (inferior-package-field package + `(compose (lambda (paths) + (map (@ (guix search-paths) + search-path-specification->sexp) + paths)) + ,field))) - (map sexp->search-path-specification paths)) + (map sexp->search-path-specification paths))) (define inferior-package-native-search-paths - (cut %inferior-package-search-paths <> 'package-native-search-paths)) + (%inferior-package-search-paths 'package-native-search-paths)) (define inferior-package-search-paths - (cut %inferior-package-search-paths <> 'package-search-paths)) + (%inferior-package-search-paths 'package-search-paths)) (define inferior-package-transitive-native-search-paths - (cut %inferior-package-search-paths <> 'package-transitive-native-search-paths)) + (%inferior-package-search-paths 'package-transitive-native-search-paths)) (define (inferior-package-provenance package) "Return a \"provenance sexp\" for PACKAGE, an inferior package. The result From patchwork Mon Jan 25 13:37:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 26629 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 10B5027BC1D; Mon, 25 Jan 2021 13:39:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1096427BC1C for ; Mon, 25 Jan 2021 13:39:15 +0000 (GMT) Received: from localhost ([::1]:48080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l425K-0001QF-7Y for patchwork@mira.cbaines.net; Mon, 25 Jan 2021 08:39:14 -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 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From: Ludovic Courtès * guix/inferior.scm (inferior-package-input-field): Return memoized procedure 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 © 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2021 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. @@ -386,50 +386,51 @@ record." loc))) package-location)))) -(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))) (define inferior-package-inputs - (cut inferior-package-input-field <> 'package-inputs)) + (inferior-package-input-field 'package-inputs)) (define inferior-package-native-inputs - (cut inferior-package-input-field <> 'package-native-inputs)) + (inferior-package-input-field 'package-native-inputs)) (define inferior-package-propagated-inputs - (cut inferior-package-input-field <> 'package-propagated-inputs)) + (inferior-package-input-field 'package-propagated-inputs)) (define inferior-package-transitive-propagated-inputs - (cut inferior-package-input-field <> 'package-transitive-propagated-inputs)) + (inferior-package-input-field 'package-transitive-propagated-inputs)) (define (%inferior-package-search-paths field) "Return the list of search path specifications of PACKAGE, an inferior