Start computing channel instance derivations for multiple systems
These aren't stored yet, but this is a start.
This commit is contained in:
parent
beab4babac
commit
13b0ebe561
1 changed files with 118 additions and 60 deletions
|
|
@ -714,14 +714,14 @@ WHERE job_id = $1"
|
||||||
(build-derivations store (list derivation))))
|
(build-derivations store (list derivation))))
|
||||||
(derivation->output-path derivation)))
|
(derivation->output-path derivation)))
|
||||||
|
|
||||||
(define (channel->derivation-file-name store channel)
|
(define (channel->derivation-file-names-by-system store channel)
|
||||||
(define use-container? (defined?
|
(define use-container? (defined?
|
||||||
'open-inferior/container
|
'open-inferior/container
|
||||||
(resolve-module '(guix inferior))))
|
(resolve-module '(guix inferior))))
|
||||||
|
|
||||||
(define inferior-code
|
(define (inferior-code channel-instance systems)
|
||||||
`(lambda (store)
|
`(lambda (store)
|
||||||
(let ((instances
|
(let* ((instances
|
||||||
(list
|
(list
|
||||||
(channel-instance
|
(channel-instance
|
||||||
(channel (name ',(channel-name channel))
|
(channel (name ',(channel-name channel))
|
||||||
|
|
@ -730,12 +730,70 @@ WHERE job_id = $1"
|
||||||
(commit ,(channel-commit channel)))
|
(commit ,(channel-commit channel)))
|
||||||
,(channel-instance-commit channel-instance)
|
,(channel-instance-commit channel-instance)
|
||||||
,(channel-instance-checkout channel-instance)))))
|
,(channel-instance-checkout channel-instance)))))
|
||||||
|
(map
|
||||||
|
(lambda (system)
|
||||||
|
(log-time
|
||||||
|
(simple-format
|
||||||
|
#f "computing the derivation-file-name for ~A"
|
||||||
|
system)
|
||||||
|
(lambda ()
|
||||||
|
(with-store store
|
||||||
|
((set-current-system system) store)
|
||||||
|
(let ((manifest
|
||||||
|
(catch #t
|
||||||
|
(lambda ()
|
||||||
|
((channel-instances->manifest instances) store))
|
||||||
|
(lambda (key . args)
|
||||||
|
(simple-format
|
||||||
|
(current-error-port)
|
||||||
|
"error: while computing manifest entry derivation for ~A\n"
|
||||||
|
system)
|
||||||
|
(simple-format
|
||||||
|
(current-error-port)
|
||||||
|
"error ~A: ~A\n" key args)
|
||||||
|
#f))))
|
||||||
|
`(,system
|
||||||
|
.
|
||||||
|
((manifest-entry-item
|
||||||
|
. ,(and manifest
|
||||||
|
(derivation-file-name
|
||||||
|
(manifest-entry-item
|
||||||
|
(first
|
||||||
|
(manifest-entries manifest))))))
|
||||||
|
(profile
|
||||||
|
. ,(catch #t
|
||||||
|
(lambda ()
|
||||||
|
(and manifest
|
||||||
|
(derivation-file-name
|
||||||
(run-with-store store
|
(run-with-store store
|
||||||
(mlet* %store-monad ((manifest (channel-instances->manifest
|
(profile-derivation
|
||||||
instances))
|
manifest
|
||||||
(derv (profile-derivation manifest)))
|
#:hooks %channel-profile-hooks)))))
|
||||||
(mbegin %store-monad
|
(lambda (key . args)
|
||||||
(return (derivation-file-name derv))))))))
|
(simple-format
|
||||||
|
(current-error-port)
|
||||||
|
"error: while computing profile derivation for ~A\n"
|
||||||
|
system)
|
||||||
|
(simple-format
|
||||||
|
(current-error-port)
|
||||||
|
"error ~A: ~A\n" key args)
|
||||||
|
#f))))))))))
|
||||||
|
(list ,@systems)))))
|
||||||
|
|
||||||
|
(let ((inferior
|
||||||
|
(if use-container?
|
||||||
|
(open-inferior/container
|
||||||
|
store
|
||||||
|
(guix-store-path store)
|
||||||
|
#:extra-shared-directories
|
||||||
|
'("/gnu/store")
|
||||||
|
#:extra-environment-variables
|
||||||
|
(list (string-append
|
||||||
|
"SSL_CERT_DIR=" (nss-certs-store-path store))))
|
||||||
|
(begin
|
||||||
|
(simple-format #t "debug: using open-inferior\n")
|
||||||
|
(open-inferior (guix-store-path store)
|
||||||
|
#:error-port (real-error-port))))))
|
||||||
|
|
||||||
(define (start-inferior-and-return-derivation-file-names)
|
(define (start-inferior-and-return-derivation-file-names)
|
||||||
;; /etc is only missing if open-inferior/container has been used
|
;; /etc is only missing if open-inferior/container has been used
|
||||||
|
|
@ -756,38 +814,30 @@ WHERE job_id = $1"
|
||||||
(first
|
(first
|
||||||
(latest-channel-instances store
|
(latest-channel-instances store
|
||||||
(list channel)))))
|
(list channel)))))
|
||||||
(inferior-eval '(use-modules (guix channels)
|
(inferior-eval '(use-modules (srfi srfi-1)
|
||||||
|
(guix channels)
|
||||||
|
(guix grafts)
|
||||||
(guix profiles))
|
(guix profiles))
|
||||||
inferior)
|
inferior)
|
||||||
|
(inferior-eval '(when (defined? '%graft?) (%graft? #f))
|
||||||
|
inferior)
|
||||||
(inferior-eval '(define channel-instance
|
(inferior-eval '(define channel-instance
|
||||||
(@@ (guix channels) channel-instance))
|
(@@ (guix channels) channel-instance))
|
||||||
inferior)
|
inferior)
|
||||||
|
|
||||||
(let ((result
|
(let* ((systems
|
||||||
|
(inferior-eval '(@ (guix packages) %supported-systems)
|
||||||
|
inferior))
|
||||||
|
(result
|
||||||
(inferior-eval-with-store
|
(inferior-eval-with-store
|
||||||
inferior
|
inferior
|
||||||
store
|
store
|
||||||
inferior-code)))
|
(inferior-code channel-instance systems))))
|
||||||
|
|
||||||
(close-inferior inferior)
|
(close-inferior inferior)
|
||||||
|
|
||||||
result)))
|
result)))
|
||||||
|
|
||||||
(let ((inferior
|
|
||||||
(if use-container?
|
|
||||||
(open-inferior/container
|
|
||||||
store
|
|
||||||
(guix-store-path store)
|
|
||||||
#:extra-shared-directories
|
|
||||||
'("/gnu/store")
|
|
||||||
#:extra-environment-variables
|
|
||||||
(list (string-append
|
|
||||||
"SSL_CERT_DIR=" (nss-certs-store-path store))))
|
|
||||||
(begin
|
|
||||||
(simple-format #t "debug: using open-inferior\n")
|
|
||||||
(open-inferior (guix-store-path store)
|
|
||||||
#:error-port (real-error-port))))))
|
|
||||||
|
|
||||||
(catch
|
(catch
|
||||||
#t
|
#t
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
@ -797,14 +847,14 @@ WHERE job_id = $1"
|
||||||
(display (backtrace) (current-error-port))
|
(display (backtrace) (current-error-port))
|
||||||
(display "\n" (current-error-port))
|
(display "\n" (current-error-port))
|
||||||
(simple-format (current-error-port)
|
(simple-format (current-error-port)
|
||||||
"error: channel->derivation-file-name: ~A: ~A\n"
|
"error: channel->derivation-file-names-by-system: ~A: ~A\n"
|
||||||
key parameters))))
|
key parameters))))
|
||||||
(lambda args
|
(lambda args
|
||||||
(close-inferior inferior)
|
(close-inferior inferior)
|
||||||
#f))))
|
#f))))
|
||||||
|
|
||||||
(define (channel->manifest-store-item conn store channel)
|
(define (channel->manifest-store-item conn store channel)
|
||||||
(let* ((manifest-store-item-derivation-file-name
|
(let* ((derivation-file-names-by-system
|
||||||
(log-time
|
(log-time
|
||||||
"computing the channel derivation"
|
"computing the channel derivation"
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
@ -814,12 +864,20 @@ WHERE job_id = $1"
|
||||||
conn
|
conn
|
||||||
'channel->manifest-store-item
|
'channel->manifest-store-item
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(channel->derivation-file-name store channel))))))
|
(channel->derivation-file-names-by-system store channel))))))
|
||||||
(derivation
|
(derivation
|
||||||
(read-derivation-from-file manifest-store-item-derivation-file-name)))
|
(read-derivation-from-file (assoc-ref
|
||||||
|
(assoc-ref derivation-file-names-by-system
|
||||||
|
(%current-system))
|
||||||
|
'profile))))
|
||||||
|
(for-each
|
||||||
|
(match-lambda
|
||||||
|
((system . derivation-file-name)
|
||||||
(simple-format (current-error-port)
|
(simple-format (current-error-port)
|
||||||
"debug: channel dervation: ~A\n"
|
"debug: ~A: channel dervation: ~A\n"
|
||||||
manifest-store-item-derivation-file-name)
|
system
|
||||||
|
derivation-file-name)))
|
||||||
|
derivation-file-names-by-system)
|
||||||
(log-time
|
(log-time
|
||||||
"building the channel derivation"
|
"building the channel derivation"
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue