mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
guix: channels: Enable specifiying available builtin builders.
When computing channel instance derivations. This is useful when you want to generate compatible derivations that can be run with a daemon that potentially doesn't support builtin builders that the daemon you're using to generate the derivations has. I'm looking at this in particular because I want to use this in the data service, since it provides substitutes for derivations, and since these can be built on other machines, it's useful to control which builtin builders they depend on. Fixes: <https://issues.guix.gnu.org/67250>. * build-aux/build-self.scm (build-program): Accept #:built-in-builders and pass along to port->connection or open-connection as approriate. (build): Accept and pass on #:built-in-builders. * guix/channels.scm (build-from-source, build-channel-instance, channel-instance-derivations, channel-instances->manifest, channel-instances->derivation): Accept and pass on #:built-in-builders. Change-Id: I315c990de66c6f7dca25a859165a5568abe385ea
This commit is contained in:
parent
f002371767
commit
d82ac48b07
2 changed files with 70 additions and 26 deletions
|
@ -241,8 +241,12 @@ (define guile-gcrypt
|
||||||
|
|
||||||
(define* (build-program source version
|
(define* (build-program source version
|
||||||
#:optional (guile-version (effective-version))
|
#:optional (guile-version (effective-version))
|
||||||
#:key (pull-version 0) (channel-metadata #f))
|
#:key (pull-version 0) (channel-metadata #f)
|
||||||
"Return a program that computes the derivation to build Guix from SOURCE."
|
built-in-builders)
|
||||||
|
"Return a program that computes the derivation to build Guix from SOURCE.
|
||||||
|
If BUILT-IN-BUILDERS is provided, it should be a list of
|
||||||
|
strings and this will be used instead of the builtin builders provided by the
|
||||||
|
build daemon, from within the generated build program."
|
||||||
(define select?
|
(define select?
|
||||||
;; Select every module but (guix config) and non-Guix modules.
|
;; Select every module but (guix config) and non-Guix modules.
|
||||||
;; Also exclude (guix channels): it is autoloaded by (guix describe), but
|
;; Also exclude (guix channels): it is autoloaded by (guix describe), but
|
||||||
|
@ -331,11 +335,16 @@ (define fake-git
|
||||||
;; case, attempt to open a new connection.
|
;; case, attempt to open a new connection.
|
||||||
(let* ((proto (string->number protocol-version))
|
(let* ((proto (string->number protocol-version))
|
||||||
(store (if (integer? proto)
|
(store (if (integer? proto)
|
||||||
(port->connection (duplicate-port
|
(port->connection
|
||||||
(current-input-port)
|
(duplicate-port
|
||||||
"w+0")
|
(current-input-port)
|
||||||
#:version proto)
|
"w+0")
|
||||||
(open-connection)))
|
#:version proto
|
||||||
|
#:built-in-builders
|
||||||
|
'#$built-in-builders)
|
||||||
|
(open-connection
|
||||||
|
#:built-in-builders
|
||||||
|
'#$built-in-builders)))
|
||||||
(sock (socket AF_UNIX SOCK_STREAM 0)))
|
(sock (socket AF_UNIX SOCK_STREAM 0)))
|
||||||
;; Connect to BUILD-OUTPUT and send it the raw
|
;; Connect to BUILD-OUTPUT and send it the raw
|
||||||
;; build output.
|
;; build output.
|
||||||
|
@ -406,7 +415,7 @@ (define* (build source
|
||||||
(guile-version (if (> pull-version 0)
|
(guile-version (if (> pull-version 0)
|
||||||
"3.0"
|
"3.0"
|
||||||
(effective-version)))
|
(effective-version)))
|
||||||
|
built-in-builders
|
||||||
#:allow-other-keys
|
#:allow-other-keys
|
||||||
#:rest rest)
|
#:rest rest)
|
||||||
"Return a derivation that unpacks SOURCE into STORE and compiles Scheme
|
"Return a derivation that unpacks SOURCE into STORE and compiles Scheme
|
||||||
|
@ -415,7 +424,9 @@ (define* (build source
|
||||||
;; SOURCE.
|
;; SOURCE.
|
||||||
(mlet %store-monad ((build (build-program source version guile-version
|
(mlet %store-monad ((build (build-program source version guile-version
|
||||||
#:channel-metadata channel-metadata
|
#:channel-metadata channel-metadata
|
||||||
#:pull-version pull-version))
|
#:pull-version pull-version
|
||||||
|
#:built-in-builders
|
||||||
|
built-in-builders))
|
||||||
(system (if system (return system) (current-system)))
|
(system (if system (return system) (current-system)))
|
||||||
(home -> (getenv "HOME"))
|
(home -> (getenv "HOME"))
|
||||||
|
|
||||||
|
|
|
@ -704,11 +704,15 @@ (define (with-trivial-build-handler mvalue)
|
||||||
store))))
|
store))))
|
||||||
|
|
||||||
(define* (build-from-source instance
|
(define* (build-from-source instance
|
||||||
#:key core verbose? (dependencies '()) system)
|
#:key core verbose? (dependencies '()) system
|
||||||
|
built-in-builders)
|
||||||
"Return a derivation to build Guix from INSTANCE, using the self-build
|
"Return a derivation to build Guix from INSTANCE, using the self-build
|
||||||
script contained therein. When CORE is true, build package modules under
|
script contained therein. When CORE is true, build package modules under
|
||||||
SOURCE using CORE, an instance of Guix. By default, build for the current
|
SOURCE using CORE, an instance of Guix. By default, build for the current
|
||||||
system, or SYSTEM if specified."
|
system, or SYSTEM if specified. If BUILT-IN-BUILDERS is
|
||||||
|
provided, it should be a list of strings and this will be used instead of the
|
||||||
|
builtin builders provided by the build daemon for store connections used
|
||||||
|
during this process."
|
||||||
(define name
|
(define name
|
||||||
(symbol->string
|
(symbol->string
|
||||||
(channel-name (channel-instance-channel instance))))
|
(channel-name (channel-instance-channel instance))))
|
||||||
|
@ -750,20 +754,28 @@ (define script
|
||||||
#:verbose? verbose? #:version commit
|
#:verbose? verbose? #:version commit
|
||||||
#:system system
|
#:system system
|
||||||
#:channel-metadata (channel-instance->sexp instance)
|
#:channel-metadata (channel-instance->sexp instance)
|
||||||
#:pull-version %pull-version))))
|
#:pull-version %pull-version
|
||||||
|
#:built-in-builders
|
||||||
|
built-in-builders))))
|
||||||
|
|
||||||
;; Build a set of modules that extend Guix using the standard method.
|
;; Build a set of modules that extend Guix using the standard method.
|
||||||
(standard-module-derivation name source core dependencies)))
|
(standard-module-derivation name source core dependencies)))
|
||||||
|
|
||||||
(define* (build-channel-instance instance system
|
(define* (build-channel-instance instance system
|
||||||
#:optional core (dependencies '()))
|
#:optional core (dependencies '())
|
||||||
|
#:key built-in-builders)
|
||||||
"Return, as a monadic value, the derivation for INSTANCE, a channel
|
"Return, as a monadic value, the derivation for INSTANCE, a channel
|
||||||
instance, for SYSTEM. DEPENDENCIES is a list of extensions providing Guile
|
instance, for SYSTEM. DEPENDENCIES is a list of extensions providing Guile
|
||||||
modules that INSTANCE depends on."
|
modules that INSTANCE depends on. If BUILT-IN-BUILDERS is
|
||||||
|
provided, it should be a list of strings and this will be used instead of the
|
||||||
|
builtin builders provided by the build daemon for store connections used
|
||||||
|
during this process."
|
||||||
(build-from-source instance
|
(build-from-source instance
|
||||||
#:core core
|
#:core core
|
||||||
#:dependencies dependencies
|
#:dependencies dependencies
|
||||||
#:system system))
|
#:system system
|
||||||
|
#:built-in-builders
|
||||||
|
built-in-builders))
|
||||||
|
|
||||||
(define (resolve-dependencies instances)
|
(define (resolve-dependencies instances)
|
||||||
"Return a procedure that, given one of the elements of INSTANCES, returns
|
"Return a procedure that, given one of the elements of INSTANCES, returns
|
||||||
|
@ -793,9 +805,13 @@ (define edges
|
||||||
(lambda (instance)
|
(lambda (instance)
|
||||||
(vhash-foldq* cons '() instance edges)))
|
(vhash-foldq* cons '() instance edges)))
|
||||||
|
|
||||||
(define* (channel-instance-derivations instances #:key system)
|
(define* (channel-instance-derivations instances #:key system
|
||||||
|
built-in-builders)
|
||||||
"Return the list of derivations to build INSTANCES, in the same order as
|
"Return the list of derivations to build INSTANCES, in the same order as
|
||||||
INSTANCES. Build for the current system by default, or SYSTEM if specified."
|
INSTANCES. Build for the current system by default, or SYSTEM if specified.
|
||||||
|
If BUILT-IN-BUILDERS is provided, it should be a list of
|
||||||
|
strings and this will be used instead of the builtin builders provided by the
|
||||||
|
build daemon for store connections used during this process."
|
||||||
(define core-instance
|
(define core-instance
|
||||||
;; The 'guix' channel is treated specially: it's an implicit dependency of
|
;; The 'guix' channel is treated specially: it's an implicit dependency of
|
||||||
;; all the other channels.
|
;; all the other channels.
|
||||||
|
@ -809,11 +825,15 @@ (define edges
|
||||||
(define (instance->derivation instance)
|
(define (instance->derivation instance)
|
||||||
(mlet %store-monad ((system (if system (return system) (current-system))))
|
(mlet %store-monad ((system (if system (return system) (current-system))))
|
||||||
(mcached (if (eq? instance core-instance)
|
(mcached (if (eq? instance core-instance)
|
||||||
(build-channel-instance instance system)
|
(build-channel-instance instance system
|
||||||
|
#:built-in-builders
|
||||||
|
built-in-builders)
|
||||||
(mlet %store-monad ((core (instance->derivation core-instance))
|
(mlet %store-monad ((core (instance->derivation core-instance))
|
||||||
(deps (mapm %store-monad instance->derivation
|
(deps (mapm %store-monad instance->derivation
|
||||||
(edges instance))))
|
(edges instance))))
|
||||||
(build-channel-instance instance system core deps)))
|
(build-channel-instance instance system core deps
|
||||||
|
#:built-in-builders
|
||||||
|
built-in-builders)))
|
||||||
instance
|
instance
|
||||||
system)))
|
system)))
|
||||||
|
|
||||||
|
@ -915,10 +935,13 @@ (define (channel-instance->sexp instance)
|
||||||
intro))))))
|
intro))))))
|
||||||
'()))))
|
'()))))
|
||||||
|
|
||||||
(define* (channel-instances->manifest instances #:key system)
|
(define* (channel-instances->manifest instances #:key system
|
||||||
|
built-in-builders)
|
||||||
"Return a profile manifest with entries for all of INSTANCES, a list of
|
"Return a profile manifest with entries for all of INSTANCES, a list of
|
||||||
channel instances. By default, build for the current system, or SYSTEM if
|
channel instances. By default, build for the current system, or SYSTEM if
|
||||||
specified."
|
specified. If BUILT-IN-BUILDERS is provided, it should be a
|
||||||
|
list of strings and this will be used instead of the builtin builders provided
|
||||||
|
by the build daemon for store connections used during this process."
|
||||||
(define (instance->entry instance drv)
|
(define (instance->entry instance drv)
|
||||||
(let ((commit (channel-instance-commit instance))
|
(let ((commit (channel-instance-commit instance))
|
||||||
(channel (channel-instance-channel instance)))
|
(channel (channel-instance-channel instance)))
|
||||||
|
@ -934,8 +957,11 @@ (define (instance->entry instance drv)
|
||||||
(properties
|
(properties
|
||||||
`((source ,(channel-instance->sexp instance)))))))
|
`((source ,(channel-instance->sexp instance)))))))
|
||||||
|
|
||||||
(mlet* %store-monad ((derivations (channel-instance-derivations instances
|
(mlet* %store-monad ((derivations (channel-instance-derivations
|
||||||
#:system system))
|
instances
|
||||||
|
#:system system
|
||||||
|
#:built-in-builders
|
||||||
|
built-in-builders))
|
||||||
(entries -> (map instance->entry instances derivations)))
|
(entries -> (map instance->entry instances derivations)))
|
||||||
(return (manifest entries))))
|
(return (manifest entries))))
|
||||||
|
|
||||||
|
@ -990,10 +1016,17 @@ (define %channel-profile-hooks
|
||||||
;; The default channel profile hooks.
|
;; The default channel profile hooks.
|
||||||
(cons package-cache-file %default-profile-hooks))
|
(cons package-cache-file %default-profile-hooks))
|
||||||
|
|
||||||
(define (channel-instances->derivation instances)
|
(define* (channel-instances->derivation instances
|
||||||
|
#:key built-in-builders)
|
||||||
"Return the derivation of the profile containing INSTANCES, a list of
|
"Return the derivation of the profile containing INSTANCES, a list of
|
||||||
channel instances."
|
channel instances. If BUILT-IN-BUILDERS is provided, it
|
||||||
(mlet %store-monad ((manifest (channel-instances->manifest instances)))
|
should be a list of strings and this will be used instead of the builtin
|
||||||
|
builders provided by the build daemon for store connections used during this
|
||||||
|
process."
|
||||||
|
(mlet %store-monad ((manifest (channel-instances->manifest
|
||||||
|
instances
|
||||||
|
#:built-in-builders
|
||||||
|
built-in-builders)))
|
||||||
;; Emit a profile in format version so that, if INSTANCES denotes an old
|
;; Emit a profile in format version so that, if INSTANCES denotes an old
|
||||||
;; Guix, it can still read that profile, for instance for the purposes of
|
;; Guix, it can still read that profile, for instance for the purposes of
|
||||||
;; 'guix describe'.
|
;; 'guix describe'.
|
||||||
|
|
Loading…
Reference in a new issue