From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iMnfN9hO8GH5JwEAgWs5BA (envelope-from ) for ; Tue, 25 Jan 2022 20:26:16 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kIhINdhO8GEIJQEA9RJhRA (envelope-from ) for ; Tue, 25 Jan 2022 20:26:16 +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 723961274A for ; Tue, 25 Jan 2022 20:26:16 +0100 (CET) Received: from localhost ([::1]:48536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCRSH-0004nL-0G for larch@yhetil.org; Tue, 25 Jan 2022 14:26:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCRPD-000475-Jz for guix-patches@gnu.org; Tue, 25 Jan 2022 14:23:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:57253) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nCRPD-0000B6-9i for guix-patches@gnu.org; Tue, 25 Jan 2022 14:23:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nCRPD-0001Eo-6o for guix-patches@gnu.org; Tue, 25 Jan 2022 14:23:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52555] [RFC PATCH v2 3/5] Add (guix eris). Resent-From: pukkamustard Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 25 Jan 2022 19:23:03 +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.16431385634679 (code B ref 52555); Tue, 25 Jan 2022 19:23:03 +0000 Received: (at 52555) by debbugs.gnu.org; 25 Jan 2022 19:22:43 +0000 Received: from localhost ([127.0.0.1]:50148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCROs-0001DI-BI for submit@debbugs.gnu.org; Tue, 25 Jan 2022 14:22:43 -0500 Received: from mout01.posteo.de ([185.67.36.65]:36957) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCROb-0001CE-9T for 52555@debbugs.gnu.org; Tue, 25 Jan 2022 14:22:26 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id B5880240027 for <52555@debbugs.gnu.org>; Tue, 25 Jan 2022 20:22:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1643138539; bh=fVwvh/6zrIV6B6hs8ZwDshihybQDuGkAoOjNHeNPWh0=; h=From:To:Cc:Subject:Date:From; b=fTYsV4CtQohwGGN+e0QsRfHniRoyA+0SWQRTT2GBxL7YZcRXo45y1ErrC2zwJvy2O PGflmXpSURrMEQnNriXAl/8Fe66gU++bDKN2+VC6DAoPKaStR8NStByTW+aOSYcv9M 1RhQ0Dlcw1kCPXpJe5qJQPaaTSkGLhFm+xPuNLbXFDxvatMP82Jpmr3917yYvi91eF ClknkBsjLiwHbFnA8oALpQ9uES/59k4i08LYdruI8+2X31Vvoyfx+Wq0DXtlDy8BHk fDTxGjJKyQ+J0yTlRGW+3TvbKzVlwtKrvFq8oB+7h4iYVwfFXgu16tYk8114pkHRo3 lRS+RrCvPAw3Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4JjxZ25J44z9rxF; Tue, 25 Jan 2022 20:22:18 +0100 (CET) From: pukkamustard Date: Tue, 25 Jan 2022 19:21:59 +0000 Message-Id: <20220125192201.7582-4-pukkamustard@posteo.net> In-Reply-To: <20220125192201.7582-1-pukkamustard@posteo.net> References: <20220125192201.7582-1-pukkamustard@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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=1643138776; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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=XwrLBNCt4OI9zAbyjKppBXrCc2mhfCdg+IXq5AeZq/s=; b=jwenXzlAxlod+NYdNG+Jz0ibZ26UsxlV7ewsx9JoJJTk1fVg4VoxvCS99Tz2rLFpW2ceBL DW1BEd8+1MUYYrXI2SNjm7GvFlDM9bGBVRWRciJWHSBZlgm5ZJmWhT36ATE6GGXf7gS14G nuSoQ+B0eOpUQBZimk1uyyy/Tef+CxvGJYay5fKAwDANv6uIPX0iw9rkBPSFPjtSisI5WB VoyMTh0lRMNs35KFR54x2wWNtZuP2uH9LThxrEac11qmCz69yYYBROB+fcofbNtTShBADY dqVMcwc/gwkYAvowI8Cmp4aMLpBZ0xtAjgrbR9+Hd6kAKPDipLBLQKqw8eFR0Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643138776; a=rsa-sha256; cv=none; b=abfYMeYmCIzfZ4IE9zD60gbPnY+J8Vvr4qrdBumVNyDNqQ4dleLuBwKECc79YaJhHxyD1Y f78yjNn9ux5UslG3HzMM8uVff/36/bZzXSxSL7ByOYZQqnppQR/J20i8Aw9ahTfFy3rIdA WEbj81nZ1uB7VyXmRGGtE8/1pld1B083bRMDuuLFTxNrrV7wEQdm4z0symYfYRv2Q6+6Sg IqglbMoGLxtNcUf6tNe+BBQB1dZxja9yVOHI+OHivrABvmAVWXm9jDB0aM0JY87GySeD6e qFiAV0vwJ5WQuwR6CjukvPlSNDXw4DaNZGPOTOQ093rxWXirvvw6y5GUDkGoXA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=fTYsV4Ct; 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: -1.23 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=fTYsV4Ct; 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: 723961274A X-Spam-Score: -1.23 X-Migadu-Scanner: scn1.migadu.com X-TUID: aLx4ydXc0hFv * guix/ipfs.scm: New file. * Makefile.am (MODULES): Add it. --- Makefile.am | 1 + guix/eris.scm | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 guix/eris.scm diff --git a/Makefile.am b/Makefile.am index a10aeb817b..7219386361 100644 --- a/Makefile.am +++ b/Makefile.am @@ -131,6 +131,7 @@ MODULES = \ guix/cve.scm \ guix/workers.scm \ guix/ipfs.scm \ + guix/eris.scm \ guix/build-system.scm \ guix/build-system/android-ndk.scm \ guix/build-system/ant.scm \ diff --git a/guix/eris.scm b/guix/eris.scm new file mode 100644 index 0000000000..163bbe05ac --- /dev/null +++ b/guix/eris.scm @@ -0,0 +1,55 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 pukkamustard +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix eris) + #:use-module (eris) + #:use-module (eris blocks ipfs) + #:use-module (web client) + #:use-module (web response) + #:use-module (srfi srfi-71) + + #:export (guix-eris-block-reducer)) + +(define (ipfs-daemon-alive?) + "Attempt to connect to the IPFS daemon. Returns #t if the daemon is alive +and #f else." + (with-exception-handler + (const #f) + (lambda _ + (let ((response _ + (http-post (string-append (%ipfs-base-url) + "/api/v0/version")))) + (equal? 200 (response-code response)))) + #:unwind? #t)) + +(define guix-eris-block-reducer + (case-lambda + + ;; Check if IPFS Daemon is running. + (() (if (ipfs-daemon-alive?) + (eris-blocks-ipfs-reducer) + #f)) + + ;; Completion. Nothing to do. + ((_) #t) + + ((ipfs ref-block) + ;; If IPFS has been initialized store block there + (if ipfs + (eris-blocks-ipfs-reducer ipfs ref-block) + ipfs)))) -- 2.34.0