mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-05-26 19:11:46 +02:00
gexp: Add 'local-file'.
* guix/gexp.scm (<local-file>): New record type.
(local-file): New procedure.
(local-file-compiler): New compiler.
(gexp->sexp) <struct? thing>: Handle the case where 'lower' returns a
file name.
(text-file*): Update docstring.local-file doc
* tests/gexp.scm ("one local file", "gexp->derivation, local-file"): New
tests.
* doc/guix.texi (G-Expressions): Mention local files early. Document
'local-file'. Update 'text-file*' documentation.
This commit is contained in:
@@ -97,6 +97,18 @@
|
||||
%store (package-source coreutils))))
|
||||
(gexp->sexp* exp)))))
|
||||
|
||||
(test-assert "one local file"
|
||||
(let* ((file (search-path %load-path "guix.scm"))
|
||||
(local (local-file file))
|
||||
(exp (gexp (display (ungexp local))))
|
||||
(intd (add-to-store %store (basename file) #t
|
||||
"sha256" file)))
|
||||
(and (gexp? exp)
|
||||
(match (gexp-inputs exp)
|
||||
(((x "out"))
|
||||
(eq? x local)))
|
||||
(equal? `(display ,intd) (gexp->sexp* exp)))))
|
||||
|
||||
(test-assert "same input twice"
|
||||
(let ((exp (gexp (begin
|
||||
(display (ungexp coreutils))
|
||||
@@ -336,6 +348,20 @@
|
||||
(mlet %store-monad ((drv mdrv))
|
||||
(return (string=? system (derivation-system drv))))))
|
||||
|
||||
(test-assertm "gexp->derivation, local-file"
|
||||
(mlet* %store-monad ((file -> (search-path %load-path "guix.scm"))
|
||||
(intd (interned-file file))
|
||||
(local -> (local-file file))
|
||||
(exp -> (gexp (begin
|
||||
(stat (ungexp local))
|
||||
(symlink (ungexp local)
|
||||
(ungexp output)))))
|
||||
(drv (gexp->derivation "local-file" exp)))
|
||||
(mbegin %store-monad
|
||||
(built-derivations (list drv))
|
||||
(return (string=? (readlink (derivation->output-path drv))
|
||||
intd)))))
|
||||
|
||||
(test-assertm "gexp->derivation, cross-compilation"
|
||||
(mlet* %store-monad ((target -> "mips64el-linux")
|
||||
(exp -> (gexp (list (ungexp coreutils)
|
||||
|
||||
Reference in New Issue
Block a user