all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Mark H Weaver <mhw@netris.org>, zimoun <zimon.toutoune@gmail.com>
Cc: 50620@debbugs.gnu.org
Subject: [bug#50620] [PATCH 1/2] guix: packages: Document 'computed-origin-method'.
Date: Tue, 28 Sep 2021 18:01:51 +0200	[thread overview]
Message-ID: <e2a5b36cb941ad715c7a33a2f400af760d19f1d4.camel@gmail.com> (raw)
In-Reply-To: <87pmstghx0.fsf@netris.org>

[-- Attachment #1: Type: text/plain, Size: 2303 bytes --]

Hi everyone,

Am Dienstag, den 28.09.2021, 05:36 -0400 schrieb Mark H Weaver:
> Hi Simon,
> 
> zimoun <zimon.toutoune@gmail.com> writes:
> > On Fri, 17 Sept 2021 at 01:40, Mark H Weaver <mhw@netris.org>
> > wrote:
> > > Liliana Marie Prikler <liliana.prikler@gmail.com> 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

[-- Attachment #2: 0001-guix-Add-computed-origins.patch --]
[-- Type: text/x-patch, Size: 2835 bytes --]

From ea138fdb145224a04a2bad27e214df7e283ccee7 Mon Sep 17 00:00:00 2001
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
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 <max@müller.gmbh>
+;;;
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(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


  reply	other threads:[~2021-09-28 16:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 11:45 [bug#50620] [PATCH 0/2] Unify 'computed-origin-method' (linux, icecat) zimoun
2021-09-16 11:47 ` [bug#50620] [PATCH 1/2] guix: packages: Document 'computed-origin-method' zimoun
2021-09-16 11:47   ` [bug#50620] [PATCH 2/2] gnu: guix: Update to xxxx zimoun
2021-09-16 15:53   ` [bug#50620] [PATCH 1/2] guix: packages: Document 'computed-origin-method' Liliana Marie Prikler
2021-09-16 23:38   ` Mark H Weaver
2021-09-17  8:41     ` zimoun
2021-09-28  9:36       ` Mark H Weaver
2021-09-28 16:01         ` Liliana Marie Prikler [this message]
2021-09-28 16:37           ` zimoun
2021-09-28 17:24             ` Liliana Marie Prikler
2021-09-29  8:32               ` zimoun
2021-09-29 10:10                 ` Liliana Marie Prikler
2021-09-29 13:17                   ` zimoun
2021-09-29 14:36                     ` Liliana Marie Prikler
2021-09-29 17:48                       ` zimoun
2021-09-29 19:10                         ` Liliana Marie Prikler
2021-09-29 20:15                           ` zimoun
2021-09-29 22:13                             ` Liliana Marie Prikler
2021-09-29 23:31                               ` zimoun
2021-09-29 21:40                         ` Mark H Weaver
2021-09-29 22:45                           ` zimoun
2021-09-30  7:11                             ` Liliana Marie Prikler
2021-09-29 13:16         ` [bug#50620] [PATCH 0/2] Unify 'computed-origin-method' (linux, icecat) Ludovic Courtès
2021-09-29 15:34           ` Liliana Marie Prikler
2021-09-29 21:47             ` Ludovic Courtès
2021-09-29 23:44               ` Liliana Marie Prikler
2021-09-30  8:28                 ` Ludovic Courtès
2021-09-30 14:17                   ` Liliana Marie Prikler
2021-09-30 20:09                     ` Ludovic Courtès
2021-09-30 21:49                       ` Liliana Marie Prikler
2021-09-29 20:42           ` Mark H Weaver
2021-09-29 21:34             ` Ludovic Courtès
2021-09-30 22:17   ` bug#50620: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2a5b36cb941ad715c7a33a2f400af760d19f1d4.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=50620@debbugs.gnu.org \
    --cc=mhw@netris.org \
    --cc=zimon.toutoune@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.