;; Guile sets it, but remove it to avoid conflicts when
;; building Guile-using packages.
(unsetenv "LD_LIBRARY_PATH")))
- (builder (add-data-to-store store
+ (builder (add-text-to-store store
(string-append name "-guile-builder")
;; Explicitly use UTF-8 for determinism,
;; and also because UTF-8 output is faster.
(with-fluids ((%default-port-encoding
"UTF-8"))
- (call-with-values
- open-bytevector-output-port
- (lambda (port get-bv)
+ (call-with-output-string
+ (lambda (port)
(write prologue port)
(write
`(exit
((_ ...)
(remove module-form? exp))
(_ `(,exp))))
- port)
- (get-bv))))
+ port))))
;; The references don't really matter
;; since the builder is always used in
#:modules '((guix module that
does not exist)))))
+(test-equal "build-expression->derivation and builder encoding"
+ '("UTF-8" #t)
+ (let* ((exp '(λ (α) (+ α 1)))
+ (drv (build-expression->derivation %store "foo" exp)))
+ (match (derivation-builder-arguments drv)
+ ((... builder)
+ (call-with-input-file builder
+ (lambda (port)
+ (list (port-encoding port)
+ (->bool
+ (string-contains (get-string-all port)
+ "(λ (α) (+ α 1))")))))))))
+
(test-assert "build-expression->derivation and derivation-prerequisites"
(let ((drv (build-expression->derivation %store "fail" #f)))
(any (match-lambda