diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-10-19 16:07:34 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-11-21 23:09:16 +0100 |
commit | 59523429d61083f410d54ac8f8516c66459c1003 (patch) | |
tree | 2f31aa062396b3b01dd46961cf5a1d124f136664 /guix/gexp.scm | |
parent | 5c1f38bf8bac83ae1c2f7864d70dc0e0f8ace311 (diff) | |
download | gnu-guix-59523429d61083f410d54ac8f8516c66459c1003.tar gnu-guix-59523429d61083f410d54ac8f8516c66459c1003.tar.gz |
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.
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r-- | guix/gexp.scm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm index b9525603ee..e8ac3dcdc8 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))))))))) ;;; |