From mboxrd@z Thu Jan 1 00:00:00 1970 From: Huang Ying Subject: [PATCH -v3 1/2] build: union: Add create-all-directories? parameter to union-build Date: Sun, 12 Mar 2017 19:53:58 +0800 Message-ID: <20170312115359.23318-1-huang.ying.caritas@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cn24j-0008NN-TM for guix-devel@gnu.org; Sun, 12 Mar 2017 07:54:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cn24g-0005YR-Ps for guix-devel@gnu.org; Sun, 12 Mar 2017 07:54:13 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Cc: guix-patches@gnu.org * guix/build/union.scm (union-build): Add create-all-directories? keyword parameter. --- guix/build/union.scm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/guix/build/union.scm b/guix/build/union.scm index 6640b5652..b852bc66e 100644 --- a/guix/build/union.scm +++ b/guix/build/union.scm @@ -73,9 +73,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 +107,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* -- 2.12.0