From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#27284: [PATCH 5/8] gexp: Add 'directory-union'. Date: Fri, 20 Oct 2017 18:05:54 +0200 Message-ID: <20171020160557.27096-6-ludo@gnu.org> References: <87poamv2i7.fsf@gnu.org> <20171020160557.27096-1-ludo@gnu.org> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5ZpC-0003eN-5p for bug-guix@gnu.org; Fri, 20 Oct 2017 12:07:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5Zp9-0007aA-1U for bug-guix@gnu.org; Fri, 20 Oct 2017 12:07:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:43919) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5Zp8-0007a4-Tw for bug-guix@gnu.org; Fri, 20 Oct 2017 12:07:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20171020160557.27096-1-ludo@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 27284@debbugs.gnu.org * gnu/services.scm (directory-union): Move to... * guix/gexp.scm (directory-union): ... here. New procedure. * doc/guix.texi (G-Expressions): Document it. --- doc/guix.texi | 11 +++++++++++ gnu/services.scm | 17 +---------------- guix/gexp.scm | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1de3494da..55a252014 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5007,6 +5007,17 @@ denoting the target file. Here's an example: This yields an @code{etc} directory containing these two files. @end deffn +@deffn {Scheme Procedure} directory-union @var{name} @var{things} +Return a directory that is the union of @var{things}, where @var{things} is a list of +file-like objects denoting directories. For example: + +@example +(directory-union "guile+emacs" (list guile emacs)) +@end example + +yields a directory that is the union of the @code{guile} and @code{emacs} packages. +@end deffn + @deffn {Scheme Procedure} file-append @var{obj} @var{suffix} @dots{} Return a file-like object that expands to the concatenation of @var{obj} and @var{suffix}, where @var{obj} is a lowerable object and each diff --git a/gnu/services.scm b/gnu/services.scm index bc866eafe..50be28a38 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -95,9 +95,7 @@ %boot-service %activation-service - etc-service - - directory-union)) + etc-service)) ;;; Comment: ;;; @@ -387,19 +385,6 @@ boot." (list (service-extension boot-service-type cleanup-gexp))))) -(define (directory-union name things) - "Return a directory that is the union of THINGS." - (match things - ((one) - ;; Only one thing; return it. - one) - (_ - (computed-file name - (with-imported-modules '((guix build union)) - #~(begin - (use-modules (guix build union)) - (union-build #$output '#$things))))))) - (define* (activation-service->script service) "Return as a monadic value the activation script for SERVICE, a service of ACTIVATION-SCRIPT-TYPE." diff --git a/guix/gexp.scm b/guix/gexp.scm index 9835599bb..b9525603e 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -79,6 +79,7 @@ text-file* mixed-text-file file-union + directory-union imported-files imported-modules compiled-modules @@ -1203,6 +1204,25 @@ This yields an 'etc' directory containing these two files." (ungexp target)))))) files)))))) +(define (directory-union name things) + "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." + (match things + ((one) + ;; Only one thing; return it. + one) + (_ + (computed-file name + (with-imported-modules '((guix build union)) + (gexp (begin + (use-modules (guix build union)) + (union-build (ungexp output) + '(ungexp things))))))))) + ;;; ;;; Syntactic sugar. -- 2.14.2