summaryrefslogtreecommitdiff
path: root/guix/build/union.scm
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2017-03-27 21:19:38 -0400
committerLeo Famulari <leo@famulari.name>2017-03-27 21:19:38 -0400
commitc17383f400d3b942c22ec46b556cad8ca3a2fce1 (patch)
treef430fdc7b6e41a652b4a0dbdd08050f586e4b24d /guix/build/union.scm
parentb1a8fd2d2cf6bf1b20ba8d26ca6f9a7caef60cbc (diff)
parent7aeb4ffa5828206f89ec62226863c27f7c1c028d (diff)
downloadguix-patches-c17383f400d3b942c22ec46b556cad8ca3a2fce1.tar
guix-patches-c17383f400d3b942c22ec46b556cad8ca3a2fce1.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/build/union.scm')
-rw-r--r--guix/build/union.scm17
1 files changed, 12 insertions, 5 deletions
diff --git a/guix/build/union.scm b/guix/build/union.scm
index 6640b56523..a2ea72e1f5 100644
--- a/guix/build/union.scm
+++ b/guix/build/union.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -73,9 +74,12 @@ identical, #f otherwise."
(loop)))))))))))))
(define* (union-build output inputs
- #:key (log-port (current-error-port)))
- "Build in the OUTPUT directory a symlink tree that is the union of all
-the INPUTS."
+ #:key (log-port (current-error-port))
+ (create-all-directories? #f))
+ "Build in the OUTPUT directory a symlink tree that is the union of all the
+INPUTS. As a special case, if CREATE-ALL-DIRECTORIES?, creates the
+subdirectories in the output directory to make sure the caller can modify them
+later."
(define (symlink* input output)
(format log-port "`~a' ~~> `~a'~%" input output)
@@ -104,8 +108,11 @@ the INPUTS."
(define (union output inputs)
(match inputs
((input)
- ;; There's only one input, so just make a link.
- (symlink* input output))
+ ;; There's only one input, so just make a link unless
+ ;; create-all-directories?.
+ (if (and create-all-directories? (file-is-directory? input))
+ (union-of-directories output inputs)
+ (symlink* input output)))
(_
(call-with-values (lambda () (partition file-is-directory? inputs))
(match-lambda*