Refactor how channel derivations are handled
Yet again... This makes the channel-derivations for each system accessible within the load-new-guix-revision procedure, in preparation for storing them in the database.
This commit is contained in:
parent
60d53f898f
commit
e0ee3d224b
1 changed files with 152 additions and 142 deletions
|
|
@ -714,7 +714,7 @@ 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-names-by-system store channel)
|
(define (channel->derivation-file-names-by-system channel)
|
||||||
(define use-container? (defined?
|
(define use-container? (defined?
|
||||||
'open-inferior/container
|
'open-inferior/container
|
||||||
(resolve-module '(guix inferior))))
|
(resolve-module '(guix inferior))))
|
||||||
|
|
@ -732,12 +732,11 @@ WHERE job_id = $1"
|
||||||
,(channel-instance-checkout channel-instance)))))
|
,(channel-instance-checkout channel-instance)))))
|
||||||
(map
|
(map
|
||||||
(lambda (system)
|
(lambda (system)
|
||||||
(log-time
|
|
||||||
(simple-format
|
(simple-format
|
||||||
#f "computing the derivation-file-name for ~A"
|
(current-error-port)
|
||||||
|
"guix-data-service: computing the derivation-file-name for ~A\n"
|
||||||
system)
|
system)
|
||||||
(lambda ()
|
|
||||||
(with-store store
|
|
||||||
((set-current-system system) store)
|
((set-current-system system) store)
|
||||||
(let ((manifest
|
(let ((manifest
|
||||||
(catch #t
|
(catch #t
|
||||||
|
|
@ -777,9 +776,12 @@ WHERE job_id = $1"
|
||||||
(simple-format
|
(simple-format
|
||||||
(current-error-port)
|
(current-error-port)
|
||||||
"error ~A: ~A\n" key args)
|
"error ~A: ~A\n" key args)
|
||||||
#f))))))))))
|
#f)))))))
|
||||||
(list ,@systems)))))
|
(list ,@systems)))))
|
||||||
|
|
||||||
|
(with-store store
|
||||||
|
(set-build-options store #:fallback? #t)
|
||||||
|
|
||||||
(let ((inferior
|
(let ((inferior
|
||||||
(if use-container?
|
(if use-container?
|
||||||
(open-inferior/container
|
(open-inferior/container
|
||||||
|
|
@ -851,9 +853,9 @@ WHERE job_id = $1"
|
||||||
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->derivations-by-system conn channel)
|
||||||
(let* ((derivation-file-names-by-system
|
(let* ((derivation-file-names-by-system
|
||||||
(log-time
|
(log-time
|
||||||
"computing the channel derivation"
|
"computing the channel derivation"
|
||||||
|
|
@ -864,12 +866,7 @@ WHERE job_id = $1"
|
||||||
conn
|
conn
|
||||||
'channel->manifest-store-item
|
'channel->manifest-store-item
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(channel->derivation-file-names-by-system store channel))))))
|
(channel->derivation-file-names-by-system channel)))))))
|
||||||
(derivation
|
|
||||||
(read-derivation-from-file (assoc-ref
|
|
||||||
(assoc-ref derivation-file-names-by-system
|
|
||||||
(%current-system))
|
|
||||||
'profile))))
|
|
||||||
(for-each
|
(for-each
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((system . derivation-file-name)
|
((system . derivation-file-name)
|
||||||
|
|
@ -878,26 +875,35 @@ WHERE job_id = $1"
|
||||||
system
|
system
|
||||||
derivation-file-name)))
|
derivation-file-name)))
|
||||||
derivation-file-names-by-system)
|
derivation-file-names-by-system)
|
||||||
|
|
||||||
|
derivation-file-names-by-system))
|
||||||
|
|
||||||
|
(define (channel-derivations-by-system->guix-store-item
|
||||||
|
channel-derivations-by-system)
|
||||||
|
|
||||||
|
(define (store-item->guix-store-item filename)
|
||||||
|
(dirname
|
||||||
|
(readlink
|
||||||
|
(string-append filename "/bin"))))
|
||||||
|
|
||||||
|
(let ((derivation-file-name-for-current-system
|
||||||
|
(assoc-ref
|
||||||
|
(assoc-ref channel-derivations-by-system
|
||||||
|
(%current-system))
|
||||||
|
'profile)))
|
||||||
|
(if derivation-file-name-for-current-system
|
||||||
|
(let ((derivation-for-current-system
|
||||||
|
(read-derivation-from-file derivation-file-name-for-current-system)))
|
||||||
|
(with-store store
|
||||||
|
(set-build-options store #:fallback? #t)
|
||||||
|
|
||||||
(log-time
|
(log-time
|
||||||
"building the channel derivation"
|
"building the channel derivation"
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(build-derivations store (list derivation))))
|
(build-derivations store (list derivation-for-current-system)))))
|
||||||
(derivation->output-path derivation)))
|
|
||||||
|
|
||||||
(define (channel->guix-store-item conn channel)
|
(store-item->guix-store-item
|
||||||
(catch
|
(derivation->output-path derivation-for-current-system)))
|
||||||
#t
|
|
||||||
(lambda ()
|
|
||||||
(with-store store
|
|
||||||
(set-build-options store #:fallback? #t)
|
|
||||||
(dirname
|
|
||||||
(readlink
|
|
||||||
(string-append (channel->manifest-store-item conn
|
|
||||||
store
|
|
||||||
channel)
|
|
||||||
"/bin")))))
|
|
||||||
(lambda args
|
|
||||||
(simple-format #t "guix-data-service: load-new-guix-revision: error: ~A\n" args)
|
|
||||||
#f)))
|
#f)))
|
||||||
|
|
||||||
(define (glibc-locales-for-guix-store-path store store-path)
|
(define (glibc-locales-for-guix-store-path store store-path)
|
||||||
|
|
@ -1186,8 +1192,12 @@ ORDER BY packages.name, packages.version"
|
||||||
conn
|
conn
|
||||||
git-repository-id))
|
git-repository-id))
|
||||||
(commit commit)))
|
(commit commit)))
|
||||||
|
(channel-derivations-by-system
|
||||||
|
(channel->derivations-by-system conn
|
||||||
|
channel-for-commit))
|
||||||
(store-item
|
(store-item
|
||||||
(channel->guix-store-item conn channel-for-commit)))
|
(channel-derivations-by-system->guix-store-item
|
||||||
|
channel-derivations-by-system)))
|
||||||
(if store-item
|
(if store-item
|
||||||
(let ((guix-revision-id
|
(let ((guix-revision-id
|
||||||
(insert-guix-revision conn git-repository-id
|
(insert-guix-revision conn git-repository-id
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue