From patchwork Fri May 13 15:00:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 39239 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 386E927BBEA; Fri, 13 May 2022 16:02:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E2D0F27BBE9 for ; Fri, 13 May 2022 16:02:16 +0100 (BST) Received: from localhost ([::1]:39252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npWo4-0001BL-4F for patchwork@mira.cbaines.net; Fri, 13 May 2022 11:02:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npWnq-0000td-JG for guix-patches@gnu.org; Fri, 13 May 2022 11:02:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50645) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npWnq-0000xb-B1 for guix-patches@gnu.org; Fri, 13 May 2022 11:02:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1npWnq-0008As-7p for guix-patches@gnu.org; Fri, 13 May 2022 11:02:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55398] [PATCH 2/3] packages: Use separate package/graft cache. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 13 May 2022 15:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55398 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55398@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 55398-submit@debbugs.gnu.org id=B55398.165245406831297 (code B ref 55398); Fri, 13 May 2022 15:02:02 +0000 Received: (at 55398) by debbugs.gnu.org; 13 May 2022 15:01:08 +0000 Received: from localhost ([127.0.0.1]:44531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npWmx-00088h-Ls for submit@debbugs.gnu.org; Fri, 13 May 2022 11:01:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npWmt-00087h-QS for 55398@debbugs.gnu.org; Fri, 13 May 2022 11:01:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34262) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npWmo-0000rH-H3; Fri, 13 May 2022 11:00:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=0cQFKIpDUfvrcCbC9mkJ6n1Bs20ZI4Mt7Tm0RlaPSiw=; b=F7b7jBxOSBtNzCzqR0i2 0eMUtdVJ41aY3zprKFvNt6s8kabCG8QtGHaV5Pl6D5O2XNZhzjS9MPQ4HAw3ZRnkKsAswk+fAY6I6 /wmv2d/9Cobz/jsEcxmSwJ7kBTku95CdXQn0z22JZnoChWe8AHHEHXrT00iPw9dmoC2otHEtolsws 7eKNAIR8jn7UbdZsK5KAEN1gNK7a6VUZLGWtQ6FfieSwgUJyqHL/cUKcN+8ZRGMO2ZChNOXpba35F WFwFtCccfAk5GWI1iZmJYVHX4L0itn3pSAcZegrF4sg3uS0Z1AGD97szCjDTMH3qbtiL2a1mRXpxF VScEWpATABiHdw==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=44956 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npWmo-0002Q4-4D; Fri, 13 May 2022 11:00:58 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 13 May 2022 17:00:43 +0200 Message-Id: <20220513150044.11991-2-ludo@gnu.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220513150044.11991-1-ludo@gnu.org> References: <20220513150044.11991-1-ludo@gnu.org> MIME-Version: 1.0 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/packages.scm (%package-graft-cache): New variable. (input-graft): Add (=> %package-graft-cache). --- guix/packages.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/guix/packages.scm b/guix/packages.scm index a79b36d03d..7ee65e9b6b 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -1618,6 +1618,11 @@ (define* (package->bag package #:optional (&package-error (package package)))))))))))) +(define %package-graft-cache + ;; Cache mapping records to records, for packages that + ;; have a replacement. + (allocate-store-connection-cache 'package-graft-cache)) + (define (input-graft system) "Return a monadic procedure that, given a package with a graft, returns a graft, and #f otherwise." @@ -1626,9 +1631,8 @@ (define (input-graft system) (((? package? package) output) (let ((replacement (package-replacement package))) (if replacement - ;; XXX: We should use a separate cache instead of abusing the - ;; object cache. - (mcached (mlet %store-monad ((orig (package->derivation package system + (mcached eq? (=> %package-graft-cache) + (mlet %store-monad ((orig (package->derivation package system #:graft? #f)) (new (package->derivation replacement system #:graft? #t))) @@ -1637,7 +1641,7 @@ (define (input-graft system) (origin-output output) (replacement new) (replacement-output output)))) - package 'graft output system) + package output system) (return #f)))) (_ (return #f)))))