From 9231ef12f2a595b8f1e677dbe50cc499555302b6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 21 Apr 2017 22:43:28 +0200 Subject: derivations: Restore UTF-8 encoding of build scripts. Reported by Mark H Weaver at . * guix/derivations.scm (build-expression->derivation): Use a string output port for the expression. This reverts part of 2dce88d5bbe7a65e101c0734d1c6db44ecc8c299. * tests/derivations.scm ("build-expression->derivation and builder encoding"): New test. --- tests/derivations.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/derivations.scm') diff --git a/tests/derivations.scm b/tests/derivations.scm index 75c8d1dfb1..626e4d20e2 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -701,6 +701,19 @@ (define %coreutils #: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 -- cgit v1.2.3 From 8a8e2d2ed5932a13a73583d32b152133d28aedf5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 22 Apr 2017 14:05:38 +0200 Subject: derivations: Adjust builder encoding test. This is a followup to 9231ef12f2a595b8f1e677dbe50cc499555302b6. * tests/derivations.scm ("build-expression->derivation and builder encoding"): Set '%default-port-encoding' to "UTF-8". --- tests/derivations.scm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/derivations.scm') diff --git a/tests/derivations.scm b/tests/derivations.scm index 626e4d20e2..cabbf7b951 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -707,12 +707,13 @@ (define %coreutils (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))"))))))))) + (with-fluids ((%default-port-encoding "UTF-8")) + (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))) -- cgit v1.2.3