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