From: Jan Nieuwenhuizen <janneke@gnu.org>
To: 32117@debbugs.gnu.org
Subject: [bug#32117] [PATCH 1/2] store: Add `binary-file'.
Date: Tue, 10 Jul 2018 19:41:27 +0200 [thread overview]
Message-ID: <20180710174128.6360-2-janneke@gnu.org> (raw)
In-Reply-To: <20180710174128.6360-1-janneke@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{<computed-file>} 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 <ludo@gnu.org>
+;;; Copyright © 2018 Jan Nieuwenhuizen <janneke@gnu.org>
;;;
;;; 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
next prev parent reply other threads:[~2018-07-10 17:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-10 17:41 [bug#32116] Allow bytevector as content of plain-file for binary data Jan Nieuwenhuizen
2018-07-10 17:41 ` Jan Nieuwenhuizen [this message]
2018-07-11 22:09 ` [bug#32116] [bug#32117] [PATCH 1/2] store: Add `binary-file' Ludovic Courtès
2018-07-12 4:30 ` bug#32116: " Jan Nieuwenhuizen
2018-07-11 22:09 ` Ludovic Courtès
2018-07-10 17:41 ` [bug#32118] [PATCH 2/2] gexp: Allow bytevector as content of `plain-file' Jan Nieuwenhuizen
2018-07-11 22:11 ` [bug#32116] " Ludovic Courtès
2018-07-12 4:31 ` Jan Nieuwenhuizen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180710174128.6360-2-janneke@gnu.org \
--to=janneke@gnu.org \
--cc=32117@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).