From patchwork Sun Jan 31 11:11:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: M X-Patchwork-Id: 26788 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 C716B27BC1E; Sun, 31 Jan 2021 16:18:12 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 781BF27BC1D for ; Sun, 31 Jan 2021 16:18:10 +0000 (GMT) Received: from localhost ([::1]:36528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6FQP-0000rk-Gc for patchwork@mira.cbaines.net; Sun, 31 Jan 2021 11:18:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6FQI-0000rF-P8 for guix-patches@gnu.org; Sun, 31 Jan 2021 11:18:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l6FQI-00015U-He for guix-patches@gnu.org; Sun, 31 Jan 2021 11:18:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l6FQI-0007er-DG for guix-patches@gnu.org; Sun, 31 Jan 2021 11:18:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46214] [PATCH] DRAFT: narinfo hooks for =?utf-8?b?4oCYZ3VpeCBw?= =?utf-8?b?dWJsaXNo4oCZ?= Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 31 Jan 2021 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46214 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46214@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161210985229397 (code B ref -1); Sun, 31 Jan 2021 16:18:02 +0000 Received: (at submit) by debbugs.gnu.org; 31 Jan 2021 16:17:32 +0000 Received: from localhost ([127.0.0.1]:57797 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6FPl-0007e2-47 for submit@debbugs.gnu.org; Sun, 31 Jan 2021 11:17:32 -0500 Received: from lists.gnu.org ([209.51.188.17]:58874) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6FPg-0007ds-Dy for submit@debbugs.gnu.org; Sun, 31 Jan 2021 11:17:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6FPd-0000jH-As for guix-patches@gnu.org; Sun, 31 Jan 2021 11:17:24 -0500 Received: from andre.telenet-ops.be ([2a02:1800:120:4::f00:15]:51592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l6FPZ-0000uE-Os for guix-patches@gnu.org; Sun, 31 Jan 2021 11:17:21 -0500 Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by andre.telenet-ops.be with bizsmtp id PUHD2400a0mfAB401UHD76; Sun, 31 Jan 2021 17:17:13 +0100 Message-ID: <20432b68d12d95a23ae3713e8a904bf9dfc003e1.camel@telenet.be> From: Maxime Devos Date: Sun, 31 Jan 2021 12:11:25 +0100 MIME-Version: 1.0 User-Agent: Evolution 3.34.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1612109833; bh=/iyGDFPao4bvHjvMQd3UKbpB7CkBWp6+FPu22z/xZ6c=; h=Subject:From:To:Date; b=RfXNoi/TlOrTsujgwutHUUTtE+HOZufHcx18NEUElTRtyKPg8esGBGqkkPOS3l6+E 4WIo8nKW8y1mlWtcCAj9M97wtAJoe36nnn6biHg4eD2Tk7konTxoxdj/A4/67fsfeP CThVkk6ucTZXf3bvo+ymflPxQWIuVEklSlg3TTYSXiLqgNvRIYKtcBjg0Z3+CeaHDM EyAqfcz7m2go90+hrbyGJJ4JyZpJe6taCCYfv8loOC9mi0F751leB+3lcK9U5Pxvv+ XO2onOns3JPSBZxhKLrgd/kIavv0mjILB405/jGpzO0F0Gs41656bG3hniIuk4xIFo nbsndLM9/Hbsg== Received-SPF: pass client-ip=2a02:1800:120:4::f00:15; envelope-from=maximedevos@telenet.be; helo=andre.telenet-ops.be X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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 Hello Guix! I've a proposal to make ‘guix publish’ somewhat extensible. The draft patch allows for passing a list of ‘hooks’ to guix publish, with "guix publish --hooks=FILE-WITH-HOOKS.scm --hooks=MORE-HOOKS.go". "guix publish" then will consult this list of hooks at some points. I've defined a ‘narinfo-hook’, which allows adding extra key value pairs to the generated narinfos. See the last patch that adds a ‘hook.scm’ file for a silly example that includes a random number and some arbitrary strings. A TODO for a future revision of the patch, is modifying ‘guix-publish-service-type’ to allow passing a list of hooks (as gexps). The use case I had in mind: this could be used for Guix+IPFS and Guix+GNUnet integration (at least on the "guix publish" side), by implementing a hook that inserts the store item into IPFS and GNUnet respectively, and add an appropriate IPFS and GNUnet URI. (I'll look into appropriate "guix substitute" hooks later.) Guix+IPFS and Guix+GNUnet integrations could of course use a forked guix (until the integration is merged upstream when it is in a good state), but a hook system seems more practical for experimentation to me. (Also, if hypothetically, in the future "guix publish" supports, say, IPFS, GNUnet, BitTorrent and Dat, then using the approach of wip-ipfs-substitutes, there would be four keyword arguments that need to be passed everywhere. This patch only passes a single #:hooks argument.) Also a question for guix-devel: the wip-ipfs-substitutes patch adds the "IPFS: etcetera" line *after* the signed part, while this patch only allows for addings key-value pairs that will be signed. Would it be problematic for the "IPFS: etcetera" or "GNUnet: etcetera" line to be signed? If this proposal seems OK to guix-devel, I'll write up some documentation, tests and changes to guix-publish-service-type. (Patch can also be found as signed tag wip-publish-narinfo-hook0 at https://notabug.org/mdevos/guix-gnunet.) Greetings, Maxime From 61c681cbe0b29b31587e71a905f34f0f12757a13 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Sun, 31 Jan 2021 11:06:46 +0100 Subject: [PATCH 2/2] DRAFT: add hook example TODO: should be located elsewere. --- hook.scm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 hook.scm diff --git a/hook.scm b/hook.scm new file mode 100644 index 0000000000..7b81c8d761 --- /dev/null +++ b/hook.scm @@ -0,0 +1,27 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Maxime Devos +;;; +;;; 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 . +(use-modules (guix scripts publish)) + +(list + (narinfo-hook + (lambda (pathinfo . rest) + `(("LuckyNumber" . ,(random 1000)) + ("Stuff" . ,(object->string pathinfo))))) + (narinfo-hook + (lambda (pathinfo . rest) + `(("Cool" . "Beans"))))) -- 2.30.0