mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-31 14:56:54 +01:00
channels: Build channel modules in an inferior.
This ensures that channel modules are compiled with the right Guile, that they get to see the right modules, and so on. IOW, it avoids bugs such as those addressed by commits3c0e16391e
andcb341c1219
. * guix/channels.scm (standard-module-derivation): Add 'core' parameter. Rewrite in terms of 'gexp->derivation-in-inferior'. (build-from-source): Add #:core parameter and pass it to 'standard-module-derivation'. (build-channel-instance): Add 'core' parameter and pass it on. (channel-instance-derivations)[dependencies]: Remove. Adjust 'build-channel-instance' call.
This commit is contained in:
parent
1fafc383b1
commit
acefa7408b
1 changed files with 37 additions and 46 deletions
|
@ -218,45 +218,48 @@ (define %pull-version
|
||||||
;; place a set of compiled Guile modules in ~/.config/guix/latest.
|
;; place a set of compiled Guile modules in ~/.config/guix/latest.
|
||||||
1)
|
1)
|
||||||
|
|
||||||
(define (standard-module-derivation name source dependencies)
|
(define (standard-module-derivation name source core dependencies)
|
||||||
"Return a derivation that builds the Scheme modules in SOURCE and that
|
"Return a derivation that builds with CORE, a Guix instance, the Scheme
|
||||||
depend on DEPENDENCIES, a list of lowerable objects. The assumption is that
|
modules in SOURCE and that depend on DEPENDENCIES, a list of lowerable
|
||||||
SOURCE contains package modules to be added to '%package-module-path'."
|
objects. The assumption is that SOURCE contains package modules to be added
|
||||||
(define modules
|
to '%package-module-path'."
|
||||||
(scheme-modules* source))
|
|
||||||
|
|
||||||
;; FIXME: We should load, say SOURCE/.guix-channel.scm, which would allow
|
;; FIXME: We should load, say SOURCE/.guix-channel.scm, which would allow
|
||||||
;; channel publishers to specify things such as the sub-directory where .scm
|
;; channel publishers to specify things such as the sub-directory where .scm
|
||||||
;; files live, files to exclude from the channel, preferred substitute URLs,
|
;; files live, files to exclude from the channel, preferred substitute URLs,
|
||||||
;; etc.
|
;; etc.
|
||||||
(mlet* %store-monad ((compiled
|
|
||||||
(compiled-modules modules
|
|
||||||
#:name name
|
|
||||||
#:module-path (list source)
|
|
||||||
#:extensions dependencies)))
|
|
||||||
|
|
||||||
(gexp->derivation name
|
(define build
|
||||||
(with-extensions dependencies
|
;; This is code that we'll run in CORE, a Guix instance, with its own
|
||||||
(with-imported-modules '((guix build utils))
|
;; modules and so on. That way, we make sure these modules are built for
|
||||||
#~(begin
|
;; the right Guile version, with the right dependencies, and that they get
|
||||||
(use-modules (guix build utils))
|
;; to see the right (gnu packages …) modules.
|
||||||
|
(with-extensions dependencies
|
||||||
|
#~(begin
|
||||||
|
(use-modules (guix build compile)
|
||||||
|
(guix build utils)
|
||||||
|
(srfi srfi-26))
|
||||||
|
|
||||||
(let ((go (string-append #$output "/lib/guile/"
|
(define go
|
||||||
(effective-version)
|
(string-append #$output "/lib/guile/" (effective-version)
|
||||||
"/site-ccache"))
|
"/site-ccache"))
|
||||||
(scm (string-append #$output
|
(define scm
|
||||||
"/share/guile/site/"
|
(string-append #$output "/share/guile/site/"
|
||||||
(effective-version))))
|
(effective-version)))
|
||||||
(mkdir-p (dirname go))
|
|
||||||
(symlink #$compiled go)
|
(compile-files #$source go
|
||||||
(mkdir-p (dirname scm))
|
(find-files #$source "\\.scm$"))
|
||||||
(symlink #$source scm))))))))
|
(mkdir-p (dirname scm))
|
||||||
|
(symlink #$source scm)
|
||||||
|
scm)))
|
||||||
|
|
||||||
|
(gexp->derivation-in-inferior name build core))
|
||||||
|
|
||||||
(define* (build-from-source name source
|
(define* (build-from-source name source
|
||||||
#:key verbose? commit
|
#:key core verbose? commit
|
||||||
(dependencies '()))
|
(dependencies '()))
|
||||||
"Return a derivation to build Guix from SOURCE, using the self-build script
|
"Return a derivation to build Guix from SOURCE, using the self-build script
|
||||||
contained therein. Use COMMIT as the version string."
|
contained therein; use COMMIT as the version string. When CORE is true, build
|
||||||
|
package modules under SOURCE using CORE, an instance of Guix."
|
||||||
;; Running the self-build script makes it easier to update the build
|
;; Running the self-build script makes it easier to update the build
|
||||||
;; procedure: the self-build script of the Guix-to-be-installed contains the
|
;; procedure: the self-build script of the Guix-to-be-installed contains the
|
||||||
;; right dependencies, build procedure, etc., which the Guix-in-use may not
|
;; right dependencies, build procedure, etc., which the Guix-in-use may not
|
||||||
|
@ -278,9 +281,10 @@ (define script
|
||||||
#:pull-version %pull-version))
|
#:pull-version %pull-version))
|
||||||
|
|
||||||
;; 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 dependencies)))
|
(standard-module-derivation name source core dependencies)))
|
||||||
|
|
||||||
(define* (build-channel-instance instance #:optional (dependencies '()))
|
(define* (build-channel-instance instance
|
||||||
|
#:optional core (dependencies '()))
|
||||||
"Return, as a monadic value, the derivation for INSTANCE, a channel
|
"Return, as a monadic value, the derivation for INSTANCE, a channel
|
||||||
instance. DEPENDENCIES is a list of extensions providing Guile modules that
|
instance. DEPENDENCIES is a list of extensions providing Guile modules that
|
||||||
INSTANCE depends on."
|
INSTANCE depends on."
|
||||||
|
@ -288,6 +292,7 @@ (define* (build-channel-instance instance #:optional (dependencies '()))
|
||||||
(channel-name (channel-instance-channel instance)))
|
(channel-name (channel-instance-channel instance)))
|
||||||
(channel-instance-checkout instance)
|
(channel-instance-checkout instance)
|
||||||
#:commit (channel-instance-commit instance)
|
#:commit (channel-instance-commit instance)
|
||||||
|
#:core core
|
||||||
#:dependencies dependencies))
|
#:dependencies dependencies))
|
||||||
|
|
||||||
(define (resolve-dependencies instances)
|
(define (resolve-dependencies instances)
|
||||||
|
@ -328,17 +333,6 @@ (define core-instance
|
||||||
(guix-channel? (channel-instance-channel instance)))
|
(guix-channel? (channel-instance-channel instance)))
|
||||||
instances))
|
instances))
|
||||||
|
|
||||||
(define dependencies
|
|
||||||
;; Dependencies of CORE-INSTANCE.
|
|
||||||
;; FIXME: It would be best not to hard-wire this information here and
|
|
||||||
;; instead query it to CORE-INSTANCE.
|
|
||||||
(list (module-ref (resolve-interface '(gnu packages gnupg))
|
|
||||||
'guile-gcrypt)
|
|
||||||
(module-ref (resolve-interface '(gnu packages guile))
|
|
||||||
'guile-git)
|
|
||||||
(module-ref (resolve-interface '(gnu packages guile))
|
|
||||||
'guile-bytestructures)))
|
|
||||||
|
|
||||||
(define edges
|
(define edges
|
||||||
(resolve-dependencies instances))
|
(resolve-dependencies instances))
|
||||||
|
|
||||||
|
@ -348,10 +342,7 @@ (define (instance->derivation instance)
|
||||||
(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
|
(build-channel-instance instance core deps)))
|
||||||
(cons core
|
|
||||||
(append deps
|
|
||||||
dependencies)))))
|
|
||||||
instance))
|
instance))
|
||||||
|
|
||||||
(mapm %store-monad instance->derivation instances))
|
(mapm %store-monad instance->derivation instances))
|
||||||
|
|
Loading…
Reference in a new issue