From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GO/3GS9O8GEkCAEAgWs5BA (envelope-from ) for ; Tue, 25 Jan 2022 20:23:27 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id yFMsFy9O8GGrTgAA9RJhRA (envelope-from ) for ; Tue, 25 Jan 2022 20:23:27 +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 F0C3A1B92B for ; Tue, 25 Jan 2022 20:23:26 +0100 (CET) Received: from localhost ([::1]:47254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCRPa-0004EA-5i for larch@yhetil.org; Tue, 25 Jan 2022 14:23:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCRPE-000496-PQ for guix-patches@gnu.org; Tue, 25 Jan 2022 14:23:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:57256) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nCRPE-0000BV-E7 for guix-patches@gnu.org; Tue, 25 Jan 2022 14:23:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nCRPE-0001FA-BX for guix-patches@gnu.org; Tue, 25 Jan 2022 14:23:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52555] [RFC PATCH v2 5/5] substitute: Fetch substitutes using ERIS. Resent-From: pukkamustard Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 25 Jan 2022 19:23:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52555 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52555@debbugs.gnu.org Cc: pukkamustard , ~pukkamustard/eris@lists.sr.ht Received: via spool by 52555-submit@debbugs.gnu.org id=B52555.16431385644699 (code B ref 52555); Tue, 25 Jan 2022 19:23:04 +0000 Received: (at 52555) by debbugs.gnu.org; 25 Jan 2022 19:22:44 +0000 Received: from localhost ([127.0.0.1]:50154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCROt-0001De-So for submit@debbugs.gnu.org; Tue, 25 Jan 2022 14:22:44 -0500 Received: from mout01.posteo.de ([185.67.36.65]:41807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCROf-0001CR-O1 for 52555@debbugs.gnu.org; Tue, 25 Jan 2022 14:22:30 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 2BFA2240029 for <52555@debbugs.gnu.org>; Tue, 25 Jan 2022 20:22:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1643138544; bh=j7T0v7hpPHZH+YN4wChkVCZNNIqTEpqBrEMRdms1Xc4=; h=From:To:Cc:Subject:Date:From; b=aCsMaZzdU2NgT+wR3r3pQ6awfvPTBY/ROM+4GQsQrm0YW0BD+bgZsQiRm7MdfRV2/ vx/b76cm1NwC+84qbrS2xAyMHdLiC1nNu/YHZ6oRKLoPL6akpybgp3MITSUU99pMXf IJHqO7EuONC5H0GwBXjD9Jz+PfX6nIXkl1a5huc1bKbNF0w7r1NN4pfgVUsARHdVgz 3jw2phmXQCDJ1Ta6NCAHztahZKj9mkP7lsROG9+FjJnDcRjZPThEuE6iSYk8oS7Mzp yAcXjYxeajUzQssVumj3m1pTiaguZYKhdeFVZbwU/OFD/me0V5RKu/Op0zzZeHLP1L 8bmk5mH9vFRxQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4JjxZ72hWgz9rxV; Tue, 25 Jan 2022 20:22:23 +0100 (CET) From: pukkamustard Date: Tue, 25 Jan 2022 19:22:01 +0000 Message-Id: <20220125192201.7582-6-pukkamustard@posteo.net> In-Reply-To: <20220125192201.7582-1-pukkamustard@posteo.net> References: <20220125192201.7582-1-pukkamustard@posteo.net> 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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643138607; 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:dkim-signature; bh=dXf41o+X29Whs28Dt1h7A9Wbhnr+aH75NyLrhMPYKAc=; b=e+IF1JL9rp9b2icBZZ+wERbv2FUXB97R7QbSgxldbSK7CzKlJbD1i+cRjNVAvUozGHk6wj K9DFH7/gWczehleT8t8F/uaWhptaESh99xui5E5Px9pLL3eYU8NAkx3TOc94NsnIq41gLS U6szQumkNbldW0py6Qx0odLByGv5LCn65u4L/jOmVIwC4FnkVN6O2wXvSN2dEvoWYhM7Bv aVGGNPxOSzp9sLH9vD5T78YBgABDKsfKdUIH9x/maG5OYUJlP+mawltzbfGImpnAXL5s0E ypl0KjzLh612GwBQx5gxVVMMAqAFb6rtGbzGu29T9wweJzM99QBKgzMmTahkYQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643138607; a=rsa-sha256; cv=none; b=ugTQ2FDrCvWTyCJqyMxi7M5W5u1njOwpsB1b6HRpiHvYO+C0A8+6TsSCwRJeTNVxotDfMU TXj/7jC983G2LqpFEmG3uWbY9IgJo1oZoSQEveR2Dyy+PhgVFsM6QJyjG2tsKk0bP790aH +qDq7cwoyQ4iubUklvRoRpjwcd0azt4Kai59TdNNGZyh7M8YoVX9a23JEMF5PQ5ajjPZlN ZXH/WwyOZbGsha1VjUHgjsbTq5f8PAnGG9KVqK4ny5gv8DdOF8cYMdBcf6wsPTnyL6Hl82 6Qo6qWFyc2J5VIeBOSC+Gm3CDd1HT+Ko1jot37QUhjbo54akA70mAPy/otp4gg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=aCsMaZzd; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=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" X-Migadu-Spam-Score: -0.73 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=aCsMaZzd; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=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" X-Migadu-Queue-Id: F0C3A1B92B X-Spam-Score: -0.73 X-Migadu-Scanner: scn1.migadu.com X-TUID: 79nwZKIju9My * guix/scripts/substitute.scm (process-substitution): Fetch substitutes using ERIS. * guix/eris.scm (guix-eris-block-ref): New procedure. --- guix/eris.scm | 7 ++++++- guix/scripts/substitute.scm | 21 ++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/guix/eris.scm b/guix/eris.scm index 163bbe05ac..0999564c1f 100644 --- a/guix/eris.scm +++ b/guix/eris.scm @@ -23,7 +23,8 @@ (define-module (guix eris) #:use-module (web response) #:use-module (srfi srfi-71) - #:export (guix-eris-block-reducer)) + #:export (guix-eris-block-reducer + guix-eris-block-ref)) (define (ipfs-daemon-alive?) "Attempt to connect to the IPFS daemon. Returns #t if the daemon is alive @@ -53,3 +54,7 @@ (define guix-eris-block-reducer (if ipfs (eris-blocks-ipfs-reducer ipfs ref-block) ipfs)))) + +(define (guix-eris-block-ref ref) + "Dereference a block for decoding ERIS content" + (eris-blocks-ipfs-ref ref)) diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 908a8334a8..852264976e 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -62,6 +62,8 @@ (define-module (guix scripts substitute) #:use-module (srfi srfi-35) #:use-module (web uri) #:use-module (guix http-client) + #:use-module (guix eris) + #:use-module (eris) #:export (%allow-unauthenticated-substitutes? %reply-file-descriptor @@ -486,18 +488,27 @@ (define (fetch uri) #:port port #:keep-alive? #t #:buffered? #f))))) + (else - (leave (G_ "unsupported substitute URI scheme: ~a~%") - (uri->string uri))))) + (if (and (eris-read-capability? uri)) + (values (eris-decode->port uri + #:block-ref + guix-eris-block-ref) #f) + (leave (G_ "unsupported substitute URI scheme: ~a~%") + (uri->string uri)))))) + + (define* (best-uri narinfo #:key (eris? #f)) + (if (and eris? (narinfo-eris-urn narinfo)) + (values (narinfo-eris-urn narinfo) "zstd" #f) + (narinfo-best-uri narinfo #:fast-decompression? + %prefer-fast-decompression?))) (unless narinfo (leave (G_ "no valid substitute for '~a'~%") store-item)) (let-values (((uri compression file-size) - (narinfo-best-uri narinfo - #:fast-decompression? - %prefer-fast-decompression?))) + (best-uri narinfo #:eris? #t))) (unless print-build-trace? (format (current-error-port) (G_ "Downloading ~a...~%") (uri->string uri))) -- 2.34.0