[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/06: grafts: Preserve empty directories when grafting.
From: |
Ludovic Courtès |
Subject: |
05/06: grafts: Preserve empty directories when grafting. |
Date: |
Fri, 20 May 2016 23:35:46 +0000 (UTC) |
civodul pushed a commit to branch master
in repository guix.
commit cf8b312d1872aec1f38a179eeb981d79bf7faa03
Author: Ludovic Courtès <address@hidden>
Date: Fri May 20 22:11:56 2016 +0200
grafts: Preserve empty directories when grafting.
* guix/build/graft.scm (rewrite-directory)[rewrite-leaf]: Add case for
'directory.
Pass #:directories? #t to 'find-files'.
---
guix/build/graft.scm | 5 ++++-
tests/grafts.scm | 24 ++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/guix/build/graft.scm b/guix/build/graft.scm
index b216e6c..e9fce03 100644
--- a/guix/build/graft.scm
+++ b/guix/build/graft.scm
@@ -115,6 +115,8 @@ file name pairs."
(replace-store-references input output mapping
store)
(chmod output (stat:perms stat))))))))
+ ((directory)
+ (mkdir-p dest))
(else
(error "unsupported file type" stat)))))
@@ -124,6 +126,7 @@ file name pairs."
(umask #o022)
(n-par-for-each (parallel-job-count)
- rewrite-leaf (find-files directory)))
+ rewrite-leaf (find-files directory (const #t)
+ #:directories? #t)))
;;; graft.scm ends here
diff --git a/tests/grafts.scm b/tests/grafts.scm
index afed704c..f8c9ece 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."))
- branch master updated (3c9a718 -> ece6864), Ludovic Courtès, 2016/05/20
- 01/06: graph: Use absolute file name canonicalization., Ludovic Courtès, 2016/05/20
- 04/06: substitute: Gracefully handle invalid store file names., Ludovic Courtès, 2016/05/20
- 03/06: graph: Allow store file names for 'derivation' and 'references' graphs., Ludovic Courtès, 2016/05/20
- 05/06: grafts: Preserve empty directories when grafting.,
Ludovic Courtès <=
- 06/06: grafts: Rename files whose name matches a graft., Ludovic Courtès, 2016/05/20
- 02/06: derivations: 'derivation' sorts items in the resulting object., Ludovic Courtès, 2016/05/20