From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yJvYIkaGuGA+VwAAgWs5BA (envelope-from ) for ; Thu, 03 Jun 2021 09:35:34 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id METmHUaGuGDuLwAAbx9fmQ (envelope-from ) for ; Thu, 03 Jun 2021 07:35:34 +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 4235F15088 for ; Thu, 3 Jun 2021 09:35:34 +0200 (CEST) Received: from localhost ([::1]:47488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loht7-0005OD-DJ for larch@yhetil.org; Thu, 03 Jun 2021 03:35:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lohse-0004gJ-Hg for guix-patches@gnu.org; Thu, 03 Jun 2021 03:35:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lohse-0001vj-9b for guix-patches@gnu.org; Thu, 03 Jun 2021 03:35:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lohse-0001Wy-5u for guix-patches@gnu.org; Thu, 03 Jun 2021 03:35:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48806] [PATCH 5/7] store: Remove 'references/substitutes'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 03 Jun 2021 07:35:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48806 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48806@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 48806-submit@debbugs.gnu.org id=B48806.16227056895810 (code B ref 48806); Thu, 03 Jun 2021 07:35:04 +0000 Received: (at 48806) by debbugs.gnu.org; 3 Jun 2021 07:34:49 +0000 Received: from localhost ([127.0.0.1]:42017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lohsO-0001Vc-Tm for submit@debbugs.gnu.org; Thu, 03 Jun 2021 03:34:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lohsL-0001UV-DX for 48806@debbugs.gnu.org; Thu, 03 Jun 2021 03:34:45 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60216) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lohsG-0001Y0-7J; Thu, 03 Jun 2021 03:34:40 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57488 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 1lohsF-0005sA-Pq; Thu, 03 Jun 2021 03:34:40 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Thu, 3 Jun 2021 09:33:59 +0200 Message-Id: <20210603073401.13629-5-ludo@gnu.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210603073401.13629-1-ludo@gnu.org> References: <20210603073401.13629-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622705734; h=from:from:sender:sender: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=91EHoGcheW0siZJ8oZGGlB3oiPptnLEXiY0B7AXs6S8=; b=hxMI1QTeoBQDrUKwmvCmzhrrBmxwNpD0Vh5pfSOpzLmQ1KALFU30s0yAihO7CsI4/rq5oO rG2CJXQJb0uBau1Vnvof08J8yEXl7vsj40vbMZ1v3F5r7IiSvn3+ey+b3/CjX3Z/LFZ8RF LkW5YaFywCSN991OwGbQbm4II0xf3hzdqHdROeBBXvIlQOKaN74SiReAmpPWyWulc7hfJn dUfGJS0OBano5+nw2Nx1H7DFLHvjPCUP08529vAoY6doh9DtGU75QRjY5t3Qte6I0Dvxk5 NewKOymgHFfvINsCog88r2jAxyIIppkhkkd2NMSUFadad8tI6vK0B+Slz63MUw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622705734; a=rsa-sha256; cv=none; b=gmDp2ZRUTGBn+77GGgiV0iP7+sJSdXCen9iTl/h5afOtZh/o3G169rvrmRydj9fcsC4F6O DRMZRTSp36Z55xpRGD4hNTeQYaDlL3vPhCCuFZzgRs6KH+VAgazM+H7SdeXOmrH8r8UzDd cn7zrCK9l6DvIGbPSA4KIg8NVnlMEy7hhyA3UJPfak2hhGqh60EKZShK5YFWmJbPr8RQhg 4AXIkTrS/rY7j7fbouGPLFoqWhDzb0oV/f9GoaxWXK2EDRpgY6yLvKomh08DNLpvU1LRgB rFWgi7p4JAwhIXQZMXSHM7uj7zjBBT2dipe9g85usMI7m+JE3Zsw7TQ9XSoXLg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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-Spam-Score: 2.07 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@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 4235F15088 X-Spam-Score: 2.07 X-Migadu-Scanner: scn1.migadu.com X-TUID: hKHr1/YkeL0D This procedure lost its only user in commit 710854304b1ab29332edcb76f3de532e0724c197. * guix/store.scm (references/substitutes): Remove. * tests/store.scm ("references/substitutes missing reference info") ("references/substitutes with substitute info"): Remove. --- guix/store.scm | 55 +------------------------------------------------ tests/store.scm | 36 -------------------------------- 2 files changed, 1 insertion(+), 90 deletions(-) diff --git a/guix/store.scm b/guix/store.scm index 38d12ac5d7..ea784a33d2 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -148,7 +148,6 @@ built-in-builders references references/cached - references/substitutes references* query-path-info* requisites @@ -1481,7 +1480,7 @@ error if there is no such root." ;; Brute-force cache mapping store items to their list of references. ;; Caching matters because when building a profile in the presence of ;; grafts, we keep calling 'graft-derivation', which in turn calls - ;; 'references/substitutes' many times with the same arguments. Ideally we + ;; 'references/cached' many times with the same arguments. Ideally we ;; would use a cache associated with the daemon connection instead (XXX). (make-hash-table 100)) @@ -1492,58 +1491,6 @@ error if there is no such root." (hash-set! %reference-cache item references) references))) -(define (references/substitutes store items) - "Return the list of list of references of ITEMS; the result has the same -length as ITEMS. Query substitute information for any item missing from the -store at once. Raise a '&store-protocol-error' exception if reference -information for one of ITEMS is missing." - (let* ((requested items) - (local-refs (map (lambda (item) - (or (hash-ref %reference-cache item) - (guard (c ((store-protocol-error? c) #f)) - (references store item)))) - items)) - (missing (fold-right (lambda (item local-ref result) - (if local-ref - result - (cons item result))) - '() - items local-refs)) - - ;; Query all the substitutes at once to minimize the cost of - ;; launching 'guix substitute' and making HTTP requests. - (substs (if (null? missing) - '() - (substitutable-path-info store missing)))) - (when (< (length substs) (length missing)) - (raise (condition (&store-protocol-error - (message "cannot determine \ -the list of references") - (status 1))))) - - ;; Intersperse SUBSTS and LOCAL-REFS. - (let loop ((items items) - (local-refs local-refs) - (result '())) - (match items - (() - (let ((result (reverse result))) - (for-each (cut hash-set! %reference-cache <> <>) - requested result) - result)) - ((item items ...) - (match local-refs - ((#f tail ...) - (loop items tail - (cons (any (lambda (subst) - (and (string=? (substitutable-path subst) item) - (substitutable-references subst))) - substs) - result))) - ((head tail ...) - (loop items tail - (cons head result))))))))) - (define* (fold-path store proc seed paths #:optional (relatives (cut references store <>))) "Call PROC for each of the RELATIVES of PATHS, exactly once, and return the diff --git a/tests/store.scm b/tests/store.scm index 9c25adf5e9..3266fa7a82 100644 --- a/tests/store.scm +++ b/tests/store.scm @@ -308,42 +308,6 @@ (null? (references %store t1)) (null? (referrers %store t2))))) -(test-assert "references/substitutes missing reference info" - (with-store s - (set-build-options s #:use-substitutes? #f) - (guard (c ((store-protocol-error? c) #t)) - (let* ((b (add-to-store s "bash" #t "sha256" - (search-bootstrap-binary "bash" - (%current-system)))) - (d (derivation s "the-thing" b '("--help") - #:inputs `((,b))))) - (references/substitutes s (list (derivation->output-path d) b)) - #f)))) - -(test-assert "references/substitutes with substitute info" - (with-store s - (set-build-options s #:use-substitutes? #t) - (let* ((t1 (add-text-to-store s "random1" (random-text))) - (t2 (add-text-to-store s "random2" (random-text) - (list t1))) - (t3 (add-text-to-store s "build" "echo -n $t2 > $out")) - (b (add-to-store s "bash" #t "sha256" - (search-bootstrap-binary "bash" - (%current-system)))) - (d (derivation s "the-thing" b `("-e" ,t3) - #:inputs `((,b) (,t3) (,t2)) - #:env-vars `(("t2" . ,t2)))) - (o (derivation->output-path d))) - (with-derivation-narinfo d - (sha256 => (gcrypt:sha256 (string->utf8 t2))) - (references => (list t2)) - - (equal? (references/substitutes s (list o t3 t2 t1)) - `((,t2) ;refs of O - () ;refs of T3 - (,t1) ;refs of T2 - ())))))) ;refs of T1 - (test-equal "substitutable-path-info when substitutes are turned off" '() (with-store s -- 2.31.1