summary refs log tree commit diff
path: root/tests/grafts.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-20 22:11:56 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-21 01:35:14 +0200
commitcf8b312d1872aec1f38a179eeb981d79bf7faa03 (patch)
tree380190c5991b6df875e752393a65dc3b3f26ee9f /tests/grafts.scm
parent30d4bc0434aa5d438c2d433f39c80e1f4a25bcac (diff)
downloadguix-cf8b312d1872aec1f38a179eeb981d79bf7faa03.tar.gz
grafts: Preserve empty directories when grafting.
* guix/build/graft.scm (rewrite-directory)[rewrite-leaf]: Add case for
'directory.
Pass #:directories? #t to 'find-files'.
Diffstat (limited to 'tests/grafts.scm')
-rw-r--r--tests/grafts.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/grafts.scm b/tests/grafts.scm
index afed704cde..f8c9eced1d 100644
--- a/tests/grafts.scm
+++ b/tests/grafts.scm
@@ -127,6 +127,30 @@
                        (list one two dep)
                        (references %store dep)))))))
 
+(test-assert "graft-derivation, preserve empty directories"
+  (run-with-store %store
+    (mlet* %store-monad ((fake    (text-file "bash" "Fake bash."))
+                         (graft -> (graft
+                                     (origin %bash)
+                                     (replacement fake)))
+                         (drv     (gexp->derivation
+                                   "to-graft"
+                                   #~(begin
+                                       (use-modules (guix build utils))
+                                       (mkdir-p (string-append #$output
+                                                               "/a/b/c/d"))
+                                       (symlink #$%bash
+                                                (string-append #$output
+                                                               "/bash")))
+                                   #:modules '((guix build utils))))
+                         (grafted ((store-lift graft-derivation) drv
+                                   (list graft)))
+                         (_       (built-derivations (list grafted)))
+                         (out ->  (derivation->output-path grafted)))
+      (return (and (string=? (readlink (string-append out "/bash"))
+                             fake)
+                   (file-is-directory? (string-append out "/a/b/c/d")))))))
+
 (test-assert "graft-derivation, no dependencies on grafted output"
   (run-with-store %store
     (mlet* %store-monad ((fake    (text-file "bash" "Fake bash."))