store: Add `binary-file'.
* guix/store.scm (binary-file): New function. * doc/guix.texi (The Store Monad): Describe binary-file.
This commit is contained in:
parent
66413378e8
commit
f3a422511f
2 changed files with 21 additions and 2 deletions
|
@ -27,7 +27,7 @@ Copyright @copyright{} 2016, 2017, 2018 Chris Marusich@*
|
||||||
Copyright @copyright{} 2016, 2017, 2018 Efraim Flashner@*
|
Copyright @copyright{} 2016, 2017, 2018 Efraim Flashner@*
|
||||||
Copyright @copyright{} 2016 John Darrington@*
|
Copyright @copyright{} 2016 John Darrington@*
|
||||||
Copyright @copyright{} 2016, 2017 Nils Gillmann@*
|
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 Julien Lepiller@*
|
||||||
Copyright @copyright{} 2016 Alex ter Weele@*
|
Copyright @copyright{} 2016 Alex ter Weele@*
|
||||||
Copyright @copyright{} 2017, 2018 Clément Lassieur@*
|
Copyright @copyright{} 2017, 2018 Clément Lassieur@*
|
||||||
|
@ -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.
|
resulting text file refers to; it defaults to the empty list.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@deffn {Monadic Procedure} binary-file @var{name} @var{data} [@var{references}]
|
||||||
|
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.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
@deffn {Monadic Procedure} interned-file @var{file} [@var{name}] @
|
@deffn {Monadic Procedure} interned-file @var{file} [@var{name}] @
|
||||||
[#:recursive? #t] [#:select? (const #t)]
|
[#:recursive? #t] [#:select? (const #t)]
|
||||||
Return the name of @var{file} once interned in the store. Use
|
Return the name of @var{file} once interned in the store. Use
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
;;; 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.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -77,6 +78,7 @@
|
||||||
add-data-to-store
|
add-data-to-store
|
||||||
add-text-to-store
|
add-text-to-store
|
||||||
add-to-store
|
add-to-store
|
||||||
|
binary-file
|
||||||
build-things
|
build-things
|
||||||
build
|
build
|
||||||
query-failed-paths
|
query-failed-paths
|
||||||
|
@ -1362,7 +1364,18 @@ taking the store as its first argument."
|
||||||
;; Store monad operators.
|
;; 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 '()))
|
#:optional (references '()))
|
||||||
"Return as a monadic value the absolute file name in the store of the file
|
"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
|
containing TEXT, a string. REFERENCES is a list of store items that the
|
||||||
|
|
Reference in a new issue