From patchwork Tue Sep 28 16:01:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liliana Marie Prikler X-Patchwork-Id: 33390 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 71C5A27BBE3; Tue, 28 Sep 2021 17:08:17 +0100 (BST) 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_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, 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 CBC8C27BBE1 for ; Tue, 28 Sep 2021 17:08:16 +0100 (BST) Received: from localhost ([::1]:57988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVFeR-0008VL-RC for patchwork@mira.cbaines.net; Tue, 28 Sep 2021 12:08:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVFZO-0002G7-Oh for guix-patches@gnu.org; Tue, 28 Sep 2021 12:03:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35214) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVFZO-0003Qp-Gc for guix-patches@gnu.org; Tue, 28 Sep 2021 12:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mVFZO-0004y1-96 for guix-patches@gnu.org; Tue, 28 Sep 2021 12:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50620] [PATCH 1/2] guix: packages: Document 'computed-origin-method'. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 28 Sep 2021 16:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50620 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mark H Weaver , zimoun Cc: 50620@debbugs.gnu.org Received: via spool by 50620-submit@debbugs.gnu.org id=B50620.163284492419017 (code B ref 50620); Tue, 28 Sep 2021 16:03:02 +0000 Received: (at 50620) by debbugs.gnu.org; 28 Sep 2021 16:02:04 +0000 Received: from localhost ([127.0.0.1]:46760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mVFYS-0004we-7y for submit@debbugs.gnu.org; Tue, 28 Sep 2021 12:02:04 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:36440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mVFYM-0004w6-L0 for 50620@debbugs.gnu.org; Tue, 28 Sep 2021 12:02:02 -0400 Received: by mail-wr1-f66.google.com with SMTP id g16so58936326wrb.3 for <50620@debbugs.gnu.org>; Tue, 28 Sep 2021 09:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version; bh=IxM5UgeJGpQnUDmMsd6rP22VIUDbJ4knH5+UMAdA/p0=; b=IWmAS3pHGBqBpelbw14TFVilnAl/IhZp0YtYzTFApzg90U+vYtlSd9wBufKTfFDdDu knjxq6O4A2ruNHFPe6UriQSeENwT+JIlYu07Aoo2F4TaYv9qBYcctO2eJB94IJb8XFGM glpckUsf+fd++y/ZNnDLF+VER7nmMZ91LINkEtX5TKUc24KajE5dPHmnnSUb/yERe5kj 7GXZ6I4VGAwcPiCKreieisa2rjlg9kM8wMJUSINgqMRtQ9Xkqpsi96G+t1zsB9/8NgZI r44kqtYOUxQySDJEDIa0mTF6LnCYErk9OgKhZsuXOXRwizSmZ3WhWrCB9TQQWmjOxPIe BdFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version; bh=IxM5UgeJGpQnUDmMsd6rP22VIUDbJ4knH5+UMAdA/p0=; b=NuX1b9OF1PUWrOfeDUZSn1iTaZ5YghbAb9l53sw1wSyu1DX3swtGnwiMosO6J79mhy Wy88XDf0Vc1yimahu7uxj4jmd8hcI0o+LbPYsj6AfYvbrewtUZqLNSLMpIIQwVl0T2zZ CXVpsDLQadgR96xWSVFTxPOnQcL1Opw+KGZXVWrcw6YNPFhKjUzyk0ljkHdFXHI1vDQC EYR1vi5owpVECjiVTbQWog1Zv79CTniVQ1Uk+3BEvJY42bTBvRWnZNqUjSTXCY4jd72u C4d4LBjDyC2wfxTeVUH5jamGJl6w20tS2wfs1sj+mNdY7VO0L3wdB3IzqcICW350W+3h NTIw== X-Gm-Message-State: AOAM5317GxkF/0f/D66TJAW5cBxaXQvDijd9kHMdguoZfGIn7nDqYx3l cbee1ZiYMmUodANIUYriw7I= X-Google-Smtp-Source: ABdhPJzSFDhvGUrTiIHCrfn5E9XFc4k2ksFLOyZ5s76NgnLYOHgjYecj0riOPd64AX3NlYsiVwn8Kg== X-Received: by 2002:a5d:4608:: with SMTP id t8mr1056448wrq.136.1632844912795; Tue, 28 Sep 2021 09:01:52 -0700 (PDT) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id e21sm3130424wme.42.2021.09.28.09.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 09:01:52 -0700 (PDT) Message-ID: From: Liliana Marie Prikler Date: Tue, 28 Sep 2021 18:01:51 +0200 In-Reply-To: <87pmstghx0.fsf@netris.org> References: <20210916114734.2686426-1-zimon.toutoune@gmail.com> <9b6ee27ff10e1042a5d61d0f93d957cf760e9ecb.camel@gmail.com> <87v930ay5y.fsf@netris.org> <87pmstghx0.fsf@netris.org> User-Agent: Evolution 3.34.2 MIME-Version: 1.0 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 Hi everyone, Am Dienstag, den 28.09.2021, 05:36 -0400 schrieb Mark H Weaver: > Hi Simon, > > zimoun writes: > > On Fri, 17 Sept 2021 at 01:40, Mark H Weaver > > wrote: > > > Liliana Marie Prikler wrote: > [...] > > > > If done this way, there'd be the benefit that modules with > > > > packages > > > > using this thing would have to explicitly request the presence > > > > of the > > > > symbol through their use-modules clauses. > > > > > > Actually, for better or worse, Guile's '@@' form does not require > > > the named module to be imported using 'use-modules', so I don't > > > think this benefit strictly exists as stated above. However, I > > > agree that it's good practice to list all imported modules in > > > the '#:use-module' clauses at the top of the file wherever > > > possible [*], and that there may be somebenefit in declaring the > > > use of 'computed-origins' at the top of each file. > > > > I am not deeply familiar with Guile module. > > > > I chose to put this in (guix packages) instead of its own module > > because the module would contain only one function and nothing > > exported. The aim for now, as discussed, is to not make this > > 'method' part of the public API. If so, one could argue that (gnu packages) is a better location to hide it, but my main issue is that we still need to hide it! This will cause other channels to refer to it using @@ or roll their own implementations. > > Then if the function is not exported by the module, the '#:use- > > module' does not have an effect, right? > > It's true that it would have no effect on the set of available > bindings, and that's an excellent point. Perhaps Liliana could > clarify what she had in mind, or better yet, propose a patch. I would argue that something like computed-origin-method *does* deserve to be an exported binding, but ought not to be grouped together into (guix packages). The latter only provides record types, not methods (which are typically implemented elsewhere), and I'd like to keep it that way. I've attached a patch to illustrate my point, but please don't apply it as is. I have not put in the necessary git blame research to find out who would need to be copyrighted here. Regards, Liliana From ea138fdb145224a04a2bad27e214df7e283ccee7 Mon Sep 17 00:00:00 2001 From: Liliana Marie Prikler Date: Tue, 28 Sep 2021 17:54:23 +0200 Subject: [PATCH] guix: Add computed-origins. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds the ‘computed-origin-method’ used by linux-libre or icecat under the new name ‘compute-origin’ as public Guix API. * guix/computed-origins: New file. --- Makefile.am | 1 + guix/computed-origins.scm | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 guix/computed-origins.scm diff --git a/Makefile.am b/Makefile.am index b66789fa0b..e8f0c63e2b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -98,6 +98,7 @@ MODULES = \ guix/bzr-download.scm \ guix/git-download.scm \ guix/hg-download.scm \ + guix/computed-origins.scm \ guix/swh.scm \ guix/monads.scm \ guix/monad-repl.scm \ diff --git a/guix/computed-origins.scm b/guix/computed-origins.scm new file mode 100644 index 0000000000..f7c83df0bf --- /dev/null +++ b/guix/computed-origins.scm @@ -0,0 +1,37 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 1312 Max Müller +;;; +;;; 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 computed-origins) + #:use-module (guix monads) + #:use-module (guix store) + #:use-module (guix packages) + #:use-module (guix gexp) + #:export (compute-origin)) + +(define* (compute-origin gexp-promise hash-algo hash + #:optional (name "source") + #:key (system (%current-system)) + (guile (default-guile))) + "Return a derivation that executes the G-expression that results +from forcing GEXP-PROMISE." + (mlet %store-monad ((guile (package->derivation guile system))) + (gexp->derivation (or name "computed-origin") + (force gexp-promise) + #:graft? #f ;nothing to graft + #:system system + #:guile-for-build guile))) -- 2.33.0