From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcweL-0000w9-2C for guix-patches@gnu.org; Tue, 10 Jul 2018 13:42:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcweJ-000735-87 for guix-patches@gnu.org; Tue, 10 Jul 2018 13:42:04 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:46414) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fcweJ-00072v-3a for guix-patches@gnu.org; Tue, 10 Jul 2018 13:42:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fcweI-0002wm-TB for guix-patches@gnu.org; Tue, 10 Jul 2018 13:42:02 -0400 Subject: [bug#32117] [PATCH 1/2] store: Add `binary-file'. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcwds-0000fJ-LS for guix-patches@gnu.org; Tue, 10 Jul 2018 13:41:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcwdr-0006nh-BW for guix-patches@gnu.org; Tue, 10 Jul 2018 13:41:36 -0400 From: Jan Nieuwenhuizen Date: Tue, 10 Jul 2018 19:41:27 +0200 Message-Id: <20180710174128.6360-2-janneke@gnu.org> In-Reply-To: <20180710174128.6360-1-janneke@gnu.org> References: <20180710174128.6360-1-janneke@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 32117@debbugs.gnu.org * guix/store.scm (binary-file): New function. * doc/guix.texi (G-Expressions): Describe binary-file*. --- doc/guix.texi | 7 ++++++- guix/store.scm | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index a8e53a530..04d7a79ac 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -27,7 +27,7 @@ Copyright @copyright{} 2016, 2017, 2018 Chris Marusich@* Copyright @copyright{} 2016, 2017, 2018 Efraim Flashner@* Copyright @copyright{} 2016 John Darrington@* Copyright @copyright{} 2016, 2017 Nils Gillmann@* -Copyright @copyright{} 2016, 2017 Jan Nieuwenhuizen@* +Copyright @copyright{} 2016, 2017, 2018 Jan Nieuwenhuizen@* Copyright @copyright{} 2016 Julien Lepiller@* Copyright @copyright{} 2016 Alex ter Weele@* Copyright @copyright{} 2017, 2018 Clément Lassieur@* @@ -5463,6 +5463,11 @@ as in: This is the declarative counterpart of @code{text-file*}. @end deffn +@deffn {Monadic Procedure} binary-file* @var{name} @var{data} @dots{} +Return as a monadic value a derivation that builds a text file +containing @var{data}. @var{data} is a bytevector. +@end deffn + @deffn {Scheme Procedure} file-union @var{name} @var{files} Return a @code{} that builds a directory containing all of @var{files}. Each item in @var{files} must be a two-element list where the first element is the diff --git a/guix/store.scm b/guix/store.scm index bac42f273..cc5c24a77 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2018 Jan Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -77,6 +78,7 @@ add-data-to-store add-text-to-store add-to-store + binary-file build-things build query-failed-paths @@ -1362,7 +1364,18 @@ taking the store as its first argument." ;; Store monad operators. ;; -(define* (text-file name text +(define* (binary-file name + data ;bytevector + #:optional (references '())) + "Return as a monadic value the absolute file name in the store of the file +containing DATA, a bytevector. REFERENCES is a list of store items that the +resulting text file refers to; it defaults to the empty list." + (lambda (store) + (values (add-data-to-store store name data references) + store))) + +(define* (text-file name + text ;string #:optional (references '())) "Return as a monadic value the absolute file name in the store of the file containing TEXT, a string. REFERENCES is a list of store items that the -- 2.18.0