guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: store: Add `binary-file'.


From: Jan Nieuwenhuizen
Subject: 01/02: store: Add `binary-file'.
Date: Thu, 12 Jul 2018 00:29:23 -0400 (EDT)

janneke pushed a commit to branch master
in repository guix.

commit f3a422511f793fb6c6cfeec2bb8735965a03294a
Author: Jan Nieuwenhuizen <address@hidden>
Date:   Tue Jul 10 19:00:48 2018 +0200

    store: Add `binary-file'.
    
    * guix/store.scm (binary-file): New function.
    * doc/guix.texi (The Store Monad): Describe binary-file.
---
 doc/guix.texi  |  8 +++++++-
 guix/store.scm | 15 ++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 8026bea..6900717 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -27,7 +27,7 @@ Copyright @copyright{} 2016, 2017, 2018 Chris address@hidden
 Copyright @copyright{} 2016, 2017, 2018 Efraim address@hidden
 Copyright @copyright{} 2016 John address@hidden
 Copyright @copyright{} 2016, 2017 Nils address@hidden
-Copyright @copyright{} 2016, 2017 Jan address@hidden
+Copyright @copyright{} 2016, 2017, 2018 Jan address@hidden
 Copyright @copyright{} 2016 Julien address@hidden
 Copyright @copyright{} 2016 Alex ter address@hidden
 Copyright @copyright{} 2017, 2018 Clément address@hidden
@@ -4916,6 +4916,12 @@ containing @var{text}, a string.  @var{references} is a 
list of store items that
 resulting text file refers to; it defaults to the empty list.
 @end deffn
 
address@hidden {Monadic Procedure} binary-file @var{name} @var{data} 
address@hidden
+Return as a monadic value the absolute file name in the store of the file
+containing @var{data}, a bytevector.  @var{references} is a list of store
+items that the resulting binary file refers to; it defaults to the empty list.
address@hidden deffn
+
 @deffn {Monadic Procedure} interned-file @var{file} address@hidden @
          [#:recursive? #t] [#:select? (const #t)]
 Return the name of @var{file} once interned in the store.  Use
diff --git a/guix/store.scm b/guix/store.scm
index bac42f2..cc5c24a 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 
<address@hidden>
+;;; Copyright © 2018 Jan Nieuwenhuizen <address@hidden>
 ;;;
 ;;; 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]