derivations: Use more keyword parameters for 'build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Turn 'system' and 'inputs' into keyword parameters. Adjust callers accordingly. * gnu/system/linux.scm, gnu/system/vm.scm, guix/build-system/cmake.scm, guix/build-system/gnu.scm, guix/build-system/perl.scm, guix/build-system/python.scm, guix/build-system/trivial.scm, guix/download.scm, guix/packages.scm, guix/profiles.scm, guix/scripts/pull.scm, tests/derivations.scm, tests/guix-build.sh, tests/monads.scm, tests/store.scm, tests/union.scm: Adjust users of 'build-expression->derivation' and 'derivation-expression' accordingly. * doc/guix.texi (Derivations): Adjust 'build-expression->derivation' documentation accordingly. (The Store Monad): Likewise for 'derivation-expression'.
This commit is contained in:
parent
7b63fa8d15
commit
dd1a5a152c
|
@ -1246,7 +1246,12 @@ As can be guessed, this primitive is cumbersome to use directly. An
|
||||||
improved variant is @code{build-expression->derivation}, which allows
|
improved variant is @code{build-expression->derivation}, which allows
|
||||||
the caller to directly pass a Guile expression as the build script:
|
the caller to directly pass a Guile expression as the build script:
|
||||||
|
|
||||||
@deffn {Scheme Procedure} build-expression->derivation @var{store} @var{name} @var{system} @var{exp} @var{inputs} [#:outputs '("out")] [#:hash #f] [#:hash-algo #f] [#:env-vars '()] [#:modules '()] [#:references-graphs #f] [#:guile-for-build #f]
|
@deffn {Scheme Procedure} build-expression->derivation @var{store} @
|
||||||
|
@var{name} @var{exp} @
|
||||||
|
[#:system (%current-system)] [#:inputs '()] @
|
||||||
|
[#:outputs '("out")] [#:hash #f] [#:hash-algo #f] @
|
||||||
|
[#:env-vars '()] [#:modules '()] @
|
||||||
|
[#:references-graphs #f] [#:guile-for-build #f]
|
||||||
Return a derivation that executes Scheme expression @var{exp} as a
|
Return a derivation that executes Scheme expression @var{exp} as a
|
||||||
builder for derivation @var{name}. @var{inputs} must be a list of
|
builder for derivation @var{name}. @var{inputs} must be a list of
|
||||||
@code{(name drv-path sub-drv)} tuples; when @var{sub-drv} is omitted,
|
@code{(name drv-path sub-drv)} tuples; when @var{sub-drv} is omitted,
|
||||||
|
@ -1281,8 +1286,7 @@ containing one file:
|
||||||
(call-with-output-file (string-append out "/test")
|
(call-with-output-file (string-append out "/test")
|
||||||
(lambda (p)
|
(lambda (p)
|
||||||
(display '(hello guix) p))))))
|
(display '(hello guix) p))))))
|
||||||
(build-expression->derivation store "goo" (%current-system)
|
(build-expression->derivation store "goo" builder))
|
||||||
builder '()))
|
|
||||||
|
|
||||||
@result{} #<derivation /nix/store/@dots{}-goo.drv => @dots{}>
|
@result{} #<derivation /nix/store/@dots{}-goo.drv => @dots{}>
|
||||||
@end lisp
|
@end lisp
|
||||||
|
@ -1425,8 +1429,9 @@ directory of @var{package}. When @var{file} is omitted, return the name
|
||||||
of the @var{output} directory of @var{package}.
|
of the @var{output} directory of @var{package}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Monadic Procedure} derivation-expression @var{name} @var{system} @
|
@deffn {Monadic Procedure} derivation-expression @var{name} @var{exp} @
|
||||||
@var{exp} @var{inputs} [#:outputs '("out")] [#:hash #f] @
|
[#:system (%current-system)] [#:inputs '()] @
|
||||||
|
[#:outputs '("out")] [#:hash #f] @
|
||||||
[#:hash-algo #f] [#:env-vars '()] [#:modules '()] @
|
[#:hash-algo #f] [#:env-vars '()] [#:modules '()] @
|
||||||
[#:references-graphs #f] [#:guile-for-build #f]
|
[#:references-graphs #f] [#:guile-for-build #f]
|
||||||
Monadic version of @code{build-expression->derivation}
|
Monadic version of @code{build-expression->derivation}
|
||||||
|
|
|
@ -108,7 +108,8 @@
|
||||||
%build-inputs)
|
%build-inputs)
|
||||||
#t)))
|
#t)))
|
||||||
|
|
||||||
(derivation-expression "pam.d" (%current-system) builder (zip names files))))
|
(derivation-expression "pam.d" builder
|
||||||
|
#:inputs (zip names files))))
|
||||||
|
|
||||||
(define %pam-other-services
|
(define %pam-other-services
|
||||||
;; The "other" PAM configuration, which denies everything (see
|
;; The "other" PAM configuration, which denies everything (see
|
||||||
|
|
|
@ -196,7 +196,9 @@ made available under the /xchg CIFS share."
|
||||||
("coreutils" ,coreutils)
|
("coreutils" ,coreutils)
|
||||||
("builder" ,user-builder)
|
("builder" ,user-builder)
|
||||||
,@inputs))))
|
,@inputs))))
|
||||||
(derivation-expression name system builder inputs
|
(derivation-expression name builder
|
||||||
|
#:system system
|
||||||
|
#:inputs inputs
|
||||||
#:env-vars env-vars
|
#:env-vars env-vars
|
||||||
#:modules (delete-duplicates
|
#:modules (delete-duplicates
|
||||||
`((guix build utils)
|
`((guix build utils)
|
||||||
|
@ -450,8 +452,9 @@ input tuples."
|
||||||
(x
|
(x
|
||||||
(return x)))
|
(return x)))
|
||||||
inputs))))
|
inputs))))
|
||||||
(derivation-expression name system builder
|
(derivation-expression name builder
|
||||||
inputs
|
#:system system
|
||||||
|
#:inputs inputs
|
||||||
#:modules '((guix build union))
|
#:modules '((guix build union))
|
||||||
#:guile-for-build guile)))
|
#:guile-for-build guile)))
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,9 @@ provides a 'CMakeLists.txt' file as its build system."
|
||||||
(package-derivation store guile system)))))
|
(package-derivation store guile system)))))
|
||||||
|
|
||||||
(let ((cmake (package-derivation store cmake system)))
|
(let ((cmake (package-derivation store cmake system)))
|
||||||
(build-expression->derivation store name system
|
(build-expression->derivation store name builder
|
||||||
builder
|
#:system system
|
||||||
|
#:inputs
|
||||||
`(,@(if source
|
`(,@(if source
|
||||||
`(("source" ,source))
|
`(("source" ,source))
|
||||||
'())
|
'())
|
||||||
|
|
|
@ -323,8 +323,9 @@ which could lead to gratuitous input divergence."
|
||||||
(guile (module-ref distro 'guile-final)))
|
(guile (module-ref distro 'guile-final)))
|
||||||
(package-derivation store guile system)))))
|
(package-derivation store guile system)))))
|
||||||
|
|
||||||
(build-expression->derivation store name system
|
(build-expression->derivation store name builder
|
||||||
builder
|
#:system system
|
||||||
|
#:inputs
|
||||||
`(,@(if source
|
`(,@(if source
|
||||||
`(("source" ,source))
|
`(("source" ,source))
|
||||||
'())
|
'())
|
||||||
|
@ -493,8 +494,9 @@ platform."
|
||||||
(guile (module-ref distro 'guile-final)))
|
(guile (module-ref distro 'guile-final)))
|
||||||
(package-derivation store guile system)))))
|
(package-derivation store guile system)))))
|
||||||
|
|
||||||
(build-expression->derivation store name system
|
(build-expression->derivation store name builder
|
||||||
builder
|
#:system system
|
||||||
|
#:inputs
|
||||||
`(,@(if source
|
`(,@(if source
|
||||||
`(("source" ,source))
|
`(("source" ,source))
|
||||||
'())
|
'())
|
||||||
|
|
|
@ -93,8 +93,9 @@ provides a `Makefile.PL' file as its build system."
|
||||||
(package-derivation store guile system)))))
|
(package-derivation store guile system)))))
|
||||||
|
|
||||||
(let ((perl (package-derivation store perl system)))
|
(let ((perl (package-derivation store perl system)))
|
||||||
(build-expression->derivation store name system
|
(build-expression->derivation store name builder
|
||||||
builder
|
#:system system
|
||||||
|
#:inputs
|
||||||
`(,@(if source
|
`(,@(if source
|
||||||
`(("source" ,source))
|
`(("source" ,source))
|
||||||
'())
|
'())
|
||||||
|
|
|
@ -146,8 +146,8 @@ provides a 'setup.py' file as its build system."
|
||||||
(package-derivation store guile system)))))
|
(package-derivation store guile system)))))
|
||||||
|
|
||||||
(let ((python (package-derivation store python system)))
|
(let ((python (package-derivation store python system)))
|
||||||
(build-expression->derivation store name system
|
(build-expression->derivation store name builder
|
||||||
builder
|
#:inputs
|
||||||
`(,@(if source
|
`(,@(if source
|
||||||
`(("source" ,source))
|
`(("source" ,source))
|
||||||
'())
|
'())
|
||||||
|
@ -158,6 +158,7 @@ provides a 'setup.py' file as its build system."
|
||||||
;; 'gnu-build-system'.
|
;; 'gnu-build-system'.
|
||||||
,@(standard-inputs system))
|
,@(standard-inputs system))
|
||||||
|
|
||||||
|
#:system system
|
||||||
#:modules imported-modules
|
#:modules imported-modules
|
||||||
#:outputs outputs
|
#:outputs outputs
|
||||||
#:guile-for-build guile-for-build)))
|
#:guile-for-build guile-for-build)))
|
||||||
|
|
|
@ -42,10 +42,11 @@
|
||||||
search-paths)
|
search-paths)
|
||||||
"Run build expression BUILDER, an expression, for SYSTEM. SOURCE is
|
"Run build expression BUILDER, an expression, for SYSTEM. SOURCE is
|
||||||
ignored."
|
ignored."
|
||||||
(build-expression->derivation store name system builder
|
(build-expression->derivation store name builder
|
||||||
(if source
|
#:inputs (if source
|
||||||
`(("source" ,source) ,@inputs)
|
`(("source" ,source) ,@inputs)
|
||||||
inputs)
|
inputs)
|
||||||
|
#:system system
|
||||||
#:outputs outputs
|
#:outputs outputs
|
||||||
#:modules modules
|
#:modules modules
|
||||||
#:guile-for-build
|
#:guile-for-build
|
||||||
|
@ -56,7 +57,9 @@ ignored."
|
||||||
outputs guile system builder (modules '())
|
outputs guile system builder (modules '())
|
||||||
search-paths native-search-paths)
|
search-paths native-search-paths)
|
||||||
"Like `trivial-build', but in a cross-compilation context."
|
"Like `trivial-build', but in a cross-compilation context."
|
||||||
(build-expression->derivation store name system builder
|
(build-expression->derivation store name builder
|
||||||
|
#:system system
|
||||||
|
#:inputs
|
||||||
(let ((inputs (append native-inputs inputs)))
|
(let ((inputs (append native-inputs inputs)))
|
||||||
(if source
|
(if source
|
||||||
`(("source" ,source) ,@inputs)
|
`(("source" ,source) ,@inputs)
|
||||||
|
|
|
@ -824,8 +824,9 @@ system, imported, and appears under FINAL-PATH in the resulting store path."
|
||||||
(mkdir ,tail))))))
|
(mkdir ,tail))))))
|
||||||
`((symlink ,store-path ,final-path)))))
|
`((symlink ,store-path ,final-path)))))
|
||||||
files))))
|
files))))
|
||||||
(build-expression->derivation store name system
|
(build-expression->derivation store name builder
|
||||||
builder files
|
#:system system
|
||||||
|
#:inputs files
|
||||||
#:guile-for-build guile)))
|
#:guile-for-build guile)))
|
||||||
|
|
||||||
(define* (imported-modules store modules
|
(define* (imported-modules store modules
|
||||||
|
@ -889,12 +890,16 @@ they can refer to each other."
|
||||||
#:opts %auto-compilation-options)))))
|
#:opts %auto-compilation-options)))))
|
||||||
files)))
|
files)))
|
||||||
|
|
||||||
(build-expression->derivation store name system builder
|
(build-expression->derivation store name builder
|
||||||
`(("modules" ,module-drv))
|
#:inputs `(("modules" ,module-drv))
|
||||||
|
#:system system
|
||||||
#:guile-for-build guile)))
|
#:guile-for-build guile)))
|
||||||
|
|
||||||
(define* (build-expression->derivation store name system exp inputs
|
(define* (build-expression->derivation store name exp
|
||||||
#:key (outputs '("out"))
|
#:key
|
||||||
|
(system (%current-system))
|
||||||
|
(inputs '())
|
||||||
|
(outputs '("out"))
|
||||||
hash hash-algo
|
hash hash-algo
|
||||||
(env-vars '())
|
(env-vars '())
|
||||||
(modules '())
|
(modules '())
|
||||||
|
|
|
@ -228,9 +228,9 @@ must be a list of symbol/URL-list pairs."
|
||||||
;; set it here.
|
;; set it here.
|
||||||
`(("GUILE_LOAD_PATH" . ,dir)))
|
`(("GUILE_LOAD_PATH" . ,dir)))
|
||||||
'())))
|
'())))
|
||||||
(build-expression->derivation store (or name file-name) system
|
(build-expression->derivation store (or name file-name) builder
|
||||||
builder
|
#:system system
|
||||||
(if gnutls-drv
|
#:inputs (if gnutls-drv
|
||||||
`(("gnutls" ,gnutls-drv))
|
`(("gnutls" ,gnutls-drv))
|
||||||
'())
|
'())
|
||||||
#:hash-algo hash-algo
|
#:hash-algo hash-algo
|
||||||
|
|
|
@ -386,10 +386,11 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
|
||||||
system)))))
|
system)))))
|
||||||
(or inputs (%standard-patch-inputs)))))
|
(or inputs (%standard-patch-inputs)))))
|
||||||
|
|
||||||
(build-expression->derivation store name system builder
|
(build-expression->derivation store name builder
|
||||||
`(("source" ,source)
|
#:inputs `(("source" ,source)
|
||||||
,@inputs
|
,@inputs
|
||||||
,@patch-inputs)
|
,@patch-inputs)
|
||||||
|
#:system system
|
||||||
#:modules imported-modules
|
#:modules imported-modules
|
||||||
#:guile-for-build guile-for-build)))
|
#:guile-for-build guile-for-build)))
|
||||||
|
|
||||||
|
|
|
@ -246,9 +246,8 @@ the given MANIFEST."
|
||||||
(lambda (p)
|
(lambda (p)
|
||||||
(pretty-print ',(manifest->sexp manifest) p))))))
|
(pretty-print ',(manifest->sexp manifest) p))))))
|
||||||
|
|
||||||
(build-expression->derivation store "profile"
|
(build-expression->derivation store "profile" builder
|
||||||
(%current-system)
|
#:inputs
|
||||||
builder
|
|
||||||
(append-map (match-lambda
|
(append-map (match-lambda
|
||||||
(($ <manifest-entry> name version
|
(($ <manifest-entry> name version
|
||||||
output path deps (inputs ..1))
|
output path deps (inputs ..1))
|
||||||
|
|
|
@ -141,8 +141,8 @@ files."
|
||||||
(delete-file (string-append out "/guix/config.scm"))
|
(delete-file (string-append out "/guix/config.scm"))
|
||||||
(delete-file (string-append out "/guix/config.go")))))
|
(delete-file (string-append out "/guix/config.go")))))
|
||||||
|
|
||||||
(build-expression->derivation store "guix-latest" (%current-system)
|
(build-expression->derivation store "guix-latest" builder
|
||||||
builder
|
#:inputs
|
||||||
`(("tar" ,(package-derivation store tar))
|
`(("tar" ,(package-derivation store tar))
|
||||||
("gzip" ,(package-derivation store gzip))
|
("gzip" ,(package-derivation store gzip))
|
||||||
("gcrypt" ,(package-derivation store
|
("gcrypt" ,(package-derivation store
|
||||||
|
|
|
@ -395,8 +395,7 @@
|
||||||
(test-skip (if (%guile-for-build) 0 8))
|
(test-skip (if (%guile-for-build) 0 8))
|
||||||
|
|
||||||
(test-assert "build-expression->derivation and derivation-prerequisites"
|
(test-assert "build-expression->derivation and derivation-prerequisites"
|
||||||
(let ((drv (build-expression->derivation %store "fail" (%current-system)
|
(let ((drv (build-expression->derivation %store "fail" #f)))
|
||||||
#f '())))
|
|
||||||
(any (match-lambda
|
(any (match-lambda
|
||||||
(($ <derivation-input> path)
|
(($ <derivation-input> path)
|
||||||
(string=? path (derivation-file-name (%guile-for-build)))))
|
(string=? path (derivation-file-name (%guile-for-build)))))
|
||||||
|
@ -408,8 +407,7 @@
|
||||||
(call-with-output-file (string-append %output "/test")
|
(call-with-output-file (string-append %output "/test")
|
||||||
(lambda (p)
|
(lambda (p)
|
||||||
(display '(hello guix) p)))))
|
(display '(hello guix) p)))))
|
||||||
(drv (build-expression->derivation %store "goo" (%current-system)
|
(drv (build-expression->derivation %store "goo" builder))
|
||||||
builder '()))
|
|
||||||
(succeeded? (build-derivations %store (list drv))))
|
(succeeded? (build-derivations %store (list drv))))
|
||||||
(and succeeded?
|
(and succeeded?
|
||||||
(let ((p (derivation->output-path drv)))
|
(let ((p (derivation->output-path drv)))
|
||||||
|
@ -421,9 +419,7 @@
|
||||||
(set-build-options s #:max-silent-time 1)
|
(set-build-options s #:max-silent-time 1)
|
||||||
s))
|
s))
|
||||||
(builder '(begin (sleep 100) (mkdir %output) #t))
|
(builder '(begin (sleep 100) (mkdir %output) #t))
|
||||||
(drv (build-expression->derivation store "silent"
|
(drv (build-expression->derivation store "silent" builder))
|
||||||
(%current-system)
|
|
||||||
builder '()))
|
|
||||||
(out-path (derivation->output-path drv)))
|
(out-path (derivation->output-path drv)))
|
||||||
(guard (c ((nix-protocol-error? c)
|
(guard (c ((nix-protocol-error? c)
|
||||||
(and (string-contains (nix-protocol-error-message c)
|
(and (string-contains (nix-protocol-error-message c)
|
||||||
|
@ -433,22 +429,19 @@
|
||||||
#f)))
|
#f)))
|
||||||
|
|
||||||
(test-assert "build-expression->derivation and derivation-prerequisites-to-build"
|
(test-assert "build-expression->derivation and derivation-prerequisites-to-build"
|
||||||
(let ((drv (build-expression->derivation %store "fail" (%current-system)
|
(let ((drv (build-expression->derivation %store "fail" #f)))
|
||||||
#f '())))
|
|
||||||
;; The only direct dependency is (%guile-for-build) and it's already
|
;; The only direct dependency is (%guile-for-build) and it's already
|
||||||
;; built.
|
;; built.
|
||||||
(null? (derivation-prerequisites-to-build %store drv))))
|
(null? (derivation-prerequisites-to-build %store drv))))
|
||||||
|
|
||||||
(test-assert "derivation-prerequisites-to-build when outputs already present"
|
(test-assert "derivation-prerequisites-to-build when outputs already present"
|
||||||
(let* ((builder '(begin (mkdir %output) #t))
|
(let* ((builder '(begin (mkdir %output) #t))
|
||||||
(input-drv (build-expression->derivation %store "input"
|
(input-drv (build-expression->derivation %store "input" builder))
|
||||||
(%current-system)
|
|
||||||
builder '()))
|
|
||||||
(input-path (derivation-output-path
|
(input-path (derivation-output-path
|
||||||
(assoc-ref (derivation-outputs input-drv)
|
(assoc-ref (derivation-outputs input-drv)
|
||||||
"out")))
|
"out")))
|
||||||
(drv (build-expression->derivation %store "something"
|
(drv (build-expression->derivation %store "something" builder
|
||||||
(%current-system) builder
|
#:inputs
|
||||||
`(("i" ,input-drv))))
|
`(("i" ,input-drv))))
|
||||||
(output (derivation->output-path drv)))
|
(output (derivation->output-path drv)))
|
||||||
;; Make sure these things are not already built.
|
;; Make sure these things are not already built.
|
||||||
|
@ -474,8 +467,7 @@
|
||||||
(test-assert "derivation-prerequisites-to-build and substitutes"
|
(test-assert "derivation-prerequisites-to-build and substitutes"
|
||||||
(let* ((store (open-connection))
|
(let* ((store (open-connection))
|
||||||
(drv (build-expression->derivation store "prereq-subst"
|
(drv (build-expression->derivation store "prereq-subst"
|
||||||
(%current-system)
|
(random 1000)))
|
||||||
(random 1000) '()))
|
|
||||||
(output (derivation->output-path drv))
|
(output (derivation->output-path drv))
|
||||||
(dir (and=> (getenv "GUIX_BINARY_SUBSTITUTE_URL")
|
(dir (and=> (getenv "GUIX_BINARY_SUBSTITUTE_URL")
|
||||||
(compose uri-path string->uri))))
|
(compose uri-path string->uri))))
|
||||||
|
@ -515,8 +507,7 @@ Deriver: ~a~%"
|
||||||
(let* ((builder '(begin
|
(let* ((builder '(begin
|
||||||
(mkdir %output)
|
(mkdir %output)
|
||||||
#f)) ; fail!
|
#f)) ; fail!
|
||||||
(drv (build-expression->derivation %store "fail" (%current-system)
|
(drv (build-expression->derivation %store "fail" builder))
|
||||||
builder '()))
|
|
||||||
(out-path (derivation->output-path drv)))
|
(out-path (derivation->output-path drv)))
|
||||||
(guard (c ((nix-protocol-error? c)
|
(guard (c ((nix-protocol-error? c)
|
||||||
;; Note that the output path may exist at this point, but it
|
;; Note that the output path may exist at this point, but it
|
||||||
|
@ -535,9 +526,7 @@ Deriver: ~a~%"
|
||||||
(call-with-output-file (assoc-ref %outputs "second")
|
(call-with-output-file (assoc-ref %outputs "second")
|
||||||
(lambda (p)
|
(lambda (p)
|
||||||
(display '(world) p)))))
|
(display '(world) p)))))
|
||||||
(drv (build-expression->derivation %store "double"
|
(drv (build-expression->derivation %store "double" builder
|
||||||
(%current-system)
|
|
||||||
builder '()
|
|
||||||
#:outputs '("out"
|
#:outputs '("out"
|
||||||
"second")))
|
"second")))
|
||||||
(succeeded? (build-derivations %store (list drv))))
|
(succeeded? (build-derivations %store (list drv))))
|
||||||
|
@ -556,8 +545,8 @@ Deriver: ~a~%"
|
||||||
(dup2 (port->fdes p) 1)
|
(dup2 (port->fdes p) 1)
|
||||||
(execl (string-append cu "/bin/uname")
|
(execl (string-append cu "/bin/uname")
|
||||||
"uname" "-a")))))
|
"uname" "-a")))))
|
||||||
(drv (build-expression->derivation %store "uname" (%current-system)
|
(drv (build-expression->derivation %store "uname" builder
|
||||||
builder
|
#:inputs
|
||||||
`(("cu" ,%coreutils))))
|
`(("cu" ,%coreutils))))
|
||||||
(succeeded? (build-derivations %store (list drv))))
|
(succeeded? (build-derivations %store (list drv))))
|
||||||
(and succeeded?
|
(and succeeded?
|
||||||
|
@ -588,8 +577,7 @@ Deriver: ~a~%"
|
||||||
(mkdir-p (string-append out "/guile/guix/nix"))
|
(mkdir-p (string-append out "/guile/guix/nix"))
|
||||||
#t)))
|
#t)))
|
||||||
(drv (build-expression->derivation %store "test-with-modules"
|
(drv (build-expression->derivation %store "test-with-modules"
|
||||||
(%current-system)
|
builder
|
||||||
builder '()
|
|
||||||
#:modules
|
#:modules
|
||||||
'((guix build utils)))))
|
'((guix build utils)))))
|
||||||
(and (build-derivations %store (list drv))
|
(and (build-derivations %store (list drv))
|
||||||
|
@ -605,14 +593,10 @@ Deriver: ~a~%"
|
||||||
(lambda (p)
|
(lambda (p)
|
||||||
(write "hello" p))))
|
(write "hello" p))))
|
||||||
(hash (sha256 (string->utf8 "hello")))
|
(hash (sha256 (string->utf8 "hello")))
|
||||||
(input1 (build-expression->derivation %store "fixed"
|
(input1 (build-expression->derivation %store "fixed" builder1
|
||||||
(%current-system)
|
|
||||||
builder1 '()
|
|
||||||
#:hash hash
|
#:hash hash
|
||||||
#:hash-algo 'sha256))
|
#:hash-algo 'sha256))
|
||||||
(input2 (build-expression->derivation %store "fixed"
|
(input2 (build-expression->derivation %store "fixed" builder2
|
||||||
(%current-system)
|
|
||||||
builder2 '()
|
|
||||||
#:hash hash
|
#:hash hash
|
||||||
#:hash-algo 'sha256))
|
#:hash-algo 'sha256))
|
||||||
(succeeded? (build-derivations %store (list input1 input2))))
|
(succeeded? (build-derivations %store (list input1 input2))))
|
||||||
|
@ -630,27 +614,21 @@ Deriver: ~a~%"
|
||||||
(lambda (p)
|
(lambda (p)
|
||||||
(write "hello" p))))
|
(write "hello" p))))
|
||||||
(hash (sha256 (string->utf8 "hello")))
|
(hash (sha256 (string->utf8 "hello")))
|
||||||
(input1 (build-expression->derivation %store "fixed"
|
(input1 (build-expression->derivation %store "fixed" builder1
|
||||||
(%current-system)
|
|
||||||
builder1 '()
|
|
||||||
#:hash hash
|
#:hash hash
|
||||||
#:hash-algo 'sha256))
|
#:hash-algo 'sha256))
|
||||||
(input2 (build-expression->derivation %store "fixed"
|
(input2 (build-expression->derivation %store "fixed" builder2
|
||||||
(%current-system)
|
|
||||||
builder2 '()
|
|
||||||
#:hash hash
|
#:hash hash
|
||||||
#:hash-algo 'sha256))
|
#:hash-algo 'sha256))
|
||||||
(builder3 '(let ((input (assoc-ref %build-inputs "input")))
|
(builder3 '(let ((input (assoc-ref %build-inputs "input")))
|
||||||
(call-with-output-file %output
|
(call-with-output-file %output
|
||||||
(lambda (out)
|
(lambda (out)
|
||||||
(format #f "My input is ~a.~%" input)))))
|
(format #f "My input is ~a.~%" input)))))
|
||||||
(final1 (build-expression->derivation %store "final"
|
(final1 (build-expression->derivation %store "final" builder3
|
||||||
(%current-system)
|
#:inputs
|
||||||
builder3
|
|
||||||
`(("input" ,input1))))
|
`(("input" ,input1))))
|
||||||
(final2 (build-expression->derivation %store "final"
|
(final2 (build-expression->derivation %store "final" builder3
|
||||||
(%current-system)
|
#:inputs
|
||||||
builder3
|
|
||||||
`(("input" ,input2)))))
|
`(("input" ,input2)))))
|
||||||
(and (string=? (derivation->output-path final1)
|
(and (string=? (derivation->output-path final1)
|
||||||
(derivation->output-path final2))
|
(derivation->output-path final2))
|
||||||
|
@ -664,8 +642,7 @@ Deriver: ~a~%"
|
||||||
(list %bash %mkdir)))
|
(list %bash %mkdir)))
|
||||||
(builder '(copy-file "input" %output))
|
(builder '(copy-file "input" %output))
|
||||||
(drv (build-expression->derivation %store "references-graphs"
|
(drv (build-expression->derivation %store "references-graphs"
|
||||||
(%current-system)
|
builder
|
||||||
builder '()
|
|
||||||
#:references-graphs
|
#:references-graphs
|
||||||
`(("input" . ,input))))
|
`(("input" . ,input))))
|
||||||
(out (derivation->output-path drv)))
|
(out (derivation->output-path drv)))
|
||||||
|
@ -697,22 +674,17 @@ Deriver: ~a~%"
|
||||||
(let* ((joke (package-derivation %store guile-1.8))
|
(let* ((joke (package-derivation %store guile-1.8))
|
||||||
(good (package-derivation %store %bootstrap-guile))
|
(good (package-derivation %store %bootstrap-guile))
|
||||||
(drv1 (build-expression->derivation %store "original-drv1"
|
(drv1 (build-expression->derivation %store "original-drv1"
|
||||||
(%current-system)
|
|
||||||
#f ; systematically fail
|
#f ; systematically fail
|
||||||
'()
|
|
||||||
#:guile-for-build joke))
|
#:guile-for-build joke))
|
||||||
(drv2 (build-expression->derivation %store "original-drv2"
|
(drv2 (build-expression->derivation %store "original-drv2"
|
||||||
(%current-system)
|
|
||||||
'(call-with-output-file %output
|
'(call-with-output-file %output
|
||||||
(lambda (p)
|
(lambda (p)
|
||||||
(display "hello" p)))
|
(display "hello" p)))))
|
||||||
'()))
|
|
||||||
(drv3 (build-expression->derivation %store "drv-to-remap"
|
(drv3 (build-expression->derivation %store "drv-to-remap"
|
||||||
(%current-system)
|
|
||||||
'(let ((in (assoc-ref
|
'(let ((in (assoc-ref
|
||||||
%build-inputs "in")))
|
%build-inputs "in")))
|
||||||
(copy-file in %output))
|
(copy-file in %output))
|
||||||
`(("in" ,drv1))
|
#:inputs `(("in" ,drv1))
|
||||||
#:guile-for-build joke))
|
#:guile-for-build joke))
|
||||||
(drv4 (map-derivation %store drv3 `((,drv1 . ,drv2)
|
(drv4 (map-derivation %store drv3 `((,drv1 . ,drv2)
|
||||||
(,joke . ,good))))
|
(,joke . ,good))))
|
||||||
|
|
|
@ -77,6 +77,5 @@ then false; else true; fi
|
||||||
guix build -e "(begin
|
guix build -e "(begin
|
||||||
(use-modules (guix monads) (guix utils))
|
(use-modules (guix monads) (guix utils))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(derivation-expression \"test\" (%current-system)
|
(derivation-expression \"test\" '(mkdir %output))))" \
|
||||||
'(mkdir %output) '())))" \
|
|
||||||
--dry-run
|
--dry-run
|
||||||
|
|
|
@ -116,8 +116,9 @@
|
||||||
(mkdir out)
|
(mkdir out)
|
||||||
(symlink ,guile
|
(symlink ,guile
|
||||||
(string-append out "/guile-rocks"))))
|
(string-append out "/guile-rocks"))))
|
||||||
(drv (derivation-expression "rocks" (%current-system)
|
(drv (derivation-expression "rocks" exp
|
||||||
exp `(("g" ,gdrv))))
|
#:inputs
|
||||||
|
`(("g" ,gdrv))))
|
||||||
(out -> (derivation->output-path drv))
|
(out -> (derivation->output-path drv))
|
||||||
(built? (built-derivations (list drv))))
|
(built? (built-derivations (list drv))))
|
||||||
(return (and built?
|
(return (and built?
|
||||||
|
|
|
@ -236,12 +236,11 @@ Deriver: ~a~%"
|
||||||
(let* ((s (open-connection))
|
(let* ((s (open-connection))
|
||||||
(c (random-text)) ; contents of the output
|
(c (random-text)) ; contents of the output
|
||||||
(d (build-expression->derivation
|
(d (build-expression->derivation
|
||||||
s "substitute-me" (%current-system)
|
s "substitute-me"
|
||||||
`(call-with-output-file %output
|
`(call-with-output-file %output
|
||||||
(lambda (p)
|
(lambda (p)
|
||||||
(exit 1) ; would actually fail
|
(exit 1) ; would actually fail
|
||||||
(display ,c p)))
|
(display ,c p)))
|
||||||
'()
|
|
||||||
#:guile-for-build
|
#:guile-for-build
|
||||||
(package-derivation s %bootstrap-guile (%current-system))))
|
(package-derivation s %bootstrap-guile (%current-system))))
|
||||||
(o (derivation->output-path d))
|
(o (derivation->output-path d))
|
||||||
|
@ -288,11 +287,10 @@ Deriver: ~a~%"
|
||||||
(let* ((s (open-connection))
|
(let* ((s (open-connection))
|
||||||
(t (random-text)) ; contents of the output
|
(t (random-text)) ; contents of the output
|
||||||
(d (build-expression->derivation
|
(d (build-expression->derivation
|
||||||
s "substitute-me-not" (%current-system)
|
s "substitute-me-not"
|
||||||
`(call-with-output-file %output
|
`(call-with-output-file %output
|
||||||
(lambda (p)
|
(lambda (p)
|
||||||
(display ,t p)))
|
(display ,t p)))
|
||||||
'()
|
|
||||||
#:guile-for-build
|
#:guile-for-build
|
||||||
(package-derivation s %bootstrap-guile (%current-system))))
|
(package-derivation s %bootstrap-guile (%current-system))))
|
||||||
(o (derivation->output-path d))
|
(o (derivation->output-path d))
|
||||||
|
|
|
@ -104,8 +104,8 @@
|
||||||
(map cdr %build-inputs))))
|
(map cdr %build-inputs))))
|
||||||
(drv
|
(drv
|
||||||
(build-expression->derivation %store "union-test"
|
(build-expression->derivation %store "union-test"
|
||||||
(%current-system)
|
builder
|
||||||
builder inputs
|
#:inputs inputs
|
||||||
#:modules '((guix build union)))))
|
#:modules '((guix build union)))))
|
||||||
(and (build-derivations %store (list (pk 'drv drv)))
|
(and (build-derivations %store (list (pk 'drv drv)))
|
||||||
(with-directory-excursion (derivation->output-path drv)
|
(with-directory-excursion (derivation->output-path drv)
|
||||||
|
|
Loading…
Reference in New Issue