[PATCH 1/5] gexp: Add 'eval-gexp'.

  • Done
  • quality assurance status badge
Details
3 participants
  • ???
  • Leo Prikler
  • Ludovic Courtès
Owner
unassigned
Submitted by
???
Severity
normal
Merged with
?
(address . guix-patches@gnu.org)(name . ???)(address . iyzsong@member.fsf.org)
20180101103336.8613-2-iyzsong@member.fsf.org
* guix/gexp.scm (eval-gexp): New procedure.
---
guix/gexp.scm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

Toggle diff (36 lines)
diff --git a/guix/gexp.scm b/guix/gexp.scm
index f005c4d29..9709c5ecb 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -76,6 +76,7 @@
gexp->derivation
gexp->file
gexp->script
+ eval-gexp
text-file*
mixed-text-file
file-union
@@ -1167,6 +1168,21 @@ and '%load-compiled-path' to honor EXP's imported modules."
#:local-build? #t
#:substitutable? #f)))))
+(define* (eval-gexp exp #:optional (name "computed-value"))
+ "Return as a monadic value the EXP (a gexp) evaluate to. This is
+implemented by building a store file NAME that contains the textual
+representation of EXP's value, and then @code{read} from it."
+ (mlet* %store-monad
+ ((drv (gexp->derivation
+ name
+ (gexp (with-output-to-file (ungexp output)
+ (lambda ()
+ (write (eval (quote (ungexp exp)) (current-module))))))
+ #:local-build? #t
+ #:substitutable? #f))
+ (_ (built-derivations (list drv))))
+ (return (call-with-input-file (derivation->output-path drv) read))))
+
(define* (text-file* name #:rest text)
"Return as a monadic value a derivation that builds a text file containing
all of TEXT. TEXT may list, in addition to strings, objects of any type that
--
2.13.3
L
L
Ludovic Courtès wrote on 7 Mar 2018 15:04
control message for bug #29926
(address . control@debbugs.gnu.org)
87muzkrnhj.fsf@gnu.org
merge 29926 29926
L
L
Ludovic Courtès wrote on 7 Mar 2018 15:04
control message for bug #29925
(address . control@debbugs.gnu.org)
87lgf4rngy.fsf@gnu.org
merge 29925 29926
L
L
Ludovic Courtès wrote on 7 Mar 2018 15:04
control message for bug #29929
(address . control@debbugs.gnu.org)
87k1uorngl.fsf@gnu.org
merge 29929 29926
L
L
Ludovic Courtès wrote on 7 Mar 2018 15:04
control message for bug #29930
(address . control@debbugs.gnu.org)
87ina8rnga.fsf@gnu.org
merge 29930 29926
L
L
Leo Prikler wrote on 11 May 2021 15:34
Re: [PATCH 0/5] Optimize profile hooks
(name . ???)(address . iyzsong@member.fsf.org)
65a2d7596fb69e0d139b4e2b7a63b354a8f6bf48.camel@student.tugraz.at
merge 29928 29926
merge 29928 29927
thanks

This series (29928 29926 29927 29925 29929 29930) has by now slept on
the mailing list for more than three years.
Should we still try to merge it? If so, could you send an updated
version, that is not spread across six threads?

Thanks,
Leo
?