[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/07: union: Parametrize the symlink procedure .
From: |
Ludovic Courtès |
Subject: |
01/07: union: Parametrize the symlink procedure . |
Date: |
Tue, 21 Nov 2017 17:13:51 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 59523429d61083f410d54ac8f8516c66459c1003
Author: Ludovic Courtès <address@hidden>
Date: Thu Oct 19 16:07:34 2017 +0200
union: Parametrize the symlink procedure .
* guix/gexp.scm (directory-union): Add #:hard-links and honor it.
* guix/build/union.scm (union-build): Add #:symlink parameter.
---
guix/build/union.scm | 11 ++++++-----
guix/gexp.scm | 19 ++++++++++++++++---
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/guix/build/union.scm b/guix/build/union.scm
index 18167fa..256123c 100644
--- a/guix/build/union.scm
+++ b/guix/build/union.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2016 Ludovic Courtès <address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2016, 2017 Ludovic Courtès <address@hidden>
;;; Copyright © 2014 Mark H Weaver <address@hidden>
;;; Copyright © 2017 Huang Ying <address@hidden>
;;;
@@ -78,11 +78,12 @@ identical, #f otherwise."
(define* (union-build output inputs
#:key (log-port (current-error-port))
- (create-all-directories? #f))
+ (create-all-directories? #f)
+ (symlink symlink))
"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."
+INPUTS, using SYMLINK to create symlinks. 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)
diff --git a/guix/gexp.scm b/guix/gexp.scm
index b952560..e8ac3dc 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -1204,13 +1204,24 @@ This yields an 'etc' directory containing these two
files."
(ungexp target))))))
files))))))
-(define (directory-union name things)
+(define* (directory-union name things
+ #:key (copy? #f))
"Return a directory that is the union of THINGS, where THINGS is a list of
file-like objects denoting directories. For example:
(directory-union \"guile+emacs\" (list guile emacs))
-yields a directory that is the union of the 'guile' and 'emacs' packages."
+yields a directory that is the union of the 'guile' and 'emacs' packages.
+
+When COPY? is true, copy files instead of creating symlinks."
+ (define symlink
+ (if copy?
+ (gexp (lambda (old new)
+ (if (file-is-directory? old)
+ (symlink old new)
+ (copy-file old new))))
+ (gexp symlink)))
+
(match things
((one)
;; Only one thing; return it.
@@ -1221,7 +1232,9 @@ yields a directory that is the union of the 'guile' and
'emacs' packages."
(gexp (begin
(use-modules (guix build union))
(union-build (ungexp output)
- '(ungexp things)))))))))
+ '(ungexp things)
+
+ #:symlink (ungexp symlink)))))))))
;;;
- branch master updated (5c1f38b -> 11a54b3), Ludovic Courtès, 2017/11/21
- 01/07: union: Parametrize the symlink procedure .,
Ludovic Courtès <=
- 02/07: gexp: 'directory-union' has a #:quiet? parameter., Ludovic Courtès, 2017/11/21
- 04/07: git: Do not add '.git' to the store., Ludovic Courtès, 2017/11/21
- 03/07: pull: Trim import list., Ludovic Courtès, 2017/11/21
- 06/07: hydra: 'evaluate' passes an alist to the entry point., Ludovic Courtès, 2017/11/21
- 07/07: hydra: Add jobs for the modular Guix., Ludovic Courtès, 2017/11/21
- 05/07: Add (guix self) and use it when pulling., Ludovic Courtès, 2017/11/21