From a93e91ff484005e05491621664ab71f888ad2ba2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 21 Feb 2014 17:37:55 +0100 Subject: nar: 'write-file' can write to non-file ports. * guix/nar.scm (write-contents): Use 'sendfile' only when P is a file port. * tests/nar.scm ("write-file supports non-file output ports"): New test. --- tests/nar.scm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/nar.scm') diff --git a/tests/nar.scm b/tests/nar.scm index 9f21f990c8..7ae8cf0aa7 100644 --- a/tests/nar.scm +++ b/tests/nar.scm @@ -183,6 +183,13 @@ (test-begin "nar") +(test-assert "write-file supports non-file output ports" + (let ((input (string-append (dirname (search-path %load-path "guix.scm")) + "/guix")) + (output (%make-void-port "w"))) + (write-file input output) + #t)) + (test-assert "write-file + restore-file" (let* ((input (string-append (dirname (search-path %load-path "guix.scm")) "/guix")) -- cgit v1.2.3 From 96c7448f370227c9777a6acdac4ac65f1884fb43 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 21 Feb 2014 20:17:29 +0100 Subject: nar: Produce archives with files sorted in C collation order. * guix/nar.scm (write-file) : Pass 'string '("." "..")) - (scandir f)))) + (let* ((select? (negate (cut member <> '("." "..")))) + + ;; 'scandir' defaults to 'string-locale