store: The 'references' parameter of 'add-text-to-store' is now optional.

* guix/store.scm (add-text-to-store): Make 'references' optional.
* tests/store.scm ("dead-paths", "references"): Use 'add-text-to-store'
  with no optional argument.
* doc/guix.texi (The Store): Adjust accordingly.
This commit is contained in:
Ludovic Courtès 2013-09-10 22:36:41 +02:00
parent 590a4904d2
commit cfbf916045
3 changed files with 4 additions and 5 deletions

View File

@ -1061,7 +1061,7 @@ argument.
Return @code{#t} when @var{path} is a valid store path. Return @code{#t} when @var{path} is a valid store path.
@end deffn @end deffn
@deffn {Scheme Procedure} add-text-to-store @var{server} @var{name} @var{text} @var{references} @deffn {Scheme Procedure} add-text-to-store @var{server} @var{name} @var{text} [@var{references}]
Add @var{text} under file @var{name} in the store, and return its store Add @var{text} under file @var{name} in the store, and return its store
path. @var{references} is the list of store paths referred to by the path. @var{references} is the list of store paths referred to by the
resulting store path. resulting store path.

View File

@ -452,7 +452,7 @@ encoding conversion errors."
(string-list references)) (string-list references))
#f #f
store-path))) store-path)))
(lambda (server name text references) (lambda* (server name text #:optional (references '()))
"Add TEXT under file NAME in the store, and return its store path. "Add TEXT under file NAME in the store, and return its store path.
REFERENCES is the list of store paths referred to by the resulting store REFERENCES is the list of store paths referred to by the resulting store
path." path."

View File

@ -68,8 +68,7 @@
(test-skip (if %store 0 10)) (test-skip (if %store 0 10))
(test-assert "dead-paths" (test-assert "dead-paths"
(let ((p (add-text-to-store %store "random-text" (let ((p (add-text-to-store %store "random-text" (random-text))))
(random-text) '())))
(member p (dead-paths %store)))) (member p (dead-paths %store))))
;; FIXME: Find a test for `live-paths'. ;; FIXME: Find a test for `live-paths'.
@ -99,7 +98,7 @@
(test-assert "references" (test-assert "references"
(let* ((t1 (add-text-to-store %store "random1" (let* ((t1 (add-text-to-store %store "random1"
(random-text) '())) (random-text)))
(t2 (add-text-to-store %store "random2" (t2 (add-text-to-store %store "random2"
(random-text) (list t1)))) (random-text) (list t1))))
(and (equal? (list t1) (references %store t2)) (and (equal? (list t1) (references %store t2))