1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-26 19:11:46 +02:00

gexp: Add 'program-file'.

* guix/gexp.scm (<program-file>): New record type.
  (program-file, program-file-compiler): New procedures.
* tests/gexp.scm ("program-file"): New test.
* doc/guix.texi (G-Expressions): Document it.
This commit is contained in:
Ludovic Courtès
2015-09-08 22:44:26 +02:00
parent 919370291f
commit 15a01c7220
3 changed files with 63 additions and 4 deletions
+17
View File
@@ -619,6 +619,23 @@
(return (and (zero? (close-pipe pipe))
(= (expt n 2) (string->number str)))))))
(test-assertm "program-file"
(let* ((n (random (expt 2 50)))
(exp (gexp (begin
(use-modules (guix build utils))
(display (ungexp n)))))
(file (program-file "program" exp
#:modules '((guix build utils))
#:guile %bootstrap-guile)))
(mlet* %store-monad ((drv (lower-object file))
(out -> (derivation->output-path drv)))
(mbegin %store-monad
(built-derivations (list drv))
(let* ((pipe (open-input-pipe out))
(str (get-string-all pipe)))
(return (and (zero? (close-pipe pipe))
(= n (string->number str)))))))))
(test-assert "text-file*"
(let ((references (store-lift references)))
(run-with-store %store