GNU bug report logs

#52555 [RFC PATCH 0/3] Decentralized substitute distribution with ERIS

PackageSource(s)Maintainer(s)
guix-patches PTS Buildd Popcon
Full log

Message #43 received at 52555@debbugs.gnu.org (full text, mbox, reply):

Received: (at 52555) by debbugs.gnu.org; 25 Jan 2022 19:22:44 +0000
From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 25 14:22:44 2022
Received: from localhost ([127.0.0.1]:50154 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	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 <pukkamustard@posteo.net>) 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 <pukkamustard@posteo.net>
To: 52555@debbugs.gnu.org
Subject: [RFC PATCH v2 5/5] substitute: Fetch substitutes using ERIS.
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-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 52555
Cc: pukkamustard <pukkamustard@posteo.net>, ~pukkamustard/eris@lists.sr.ht
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit@debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
* 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





Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Mon Sep 8 11:28:20 2025; Machine Name: wallace-server

GNU bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.