(zilch magic): add post-build hook

..This is really starting to look like a build scheduler, huh?

Change-Id: I6a6a696433e0a13f8de759061d47e737d48f4342
This commit is contained in:
puck 2025-06-18 17:07:16 +00:00
parent 9b61f4df0a
commit 31bdc68f8c

View file

@ -25,6 +25,7 @@
store-path-devirtualise
store-path-register-fallback
store-path-register-post-build
ca-thread-count drv-resolve-ca
@ -464,6 +465,11 @@
(mutex-lock! pending-count-mutex)
(unless (eq? pending-count 'error)
(set! pending-count (- pending-count 1)))
; Notify the derivation that it is built.
(let* ((meta (derivation-meta ca-drv))
(post-build (and meta (assoc 'post-build meta))))
(when post-build ((cdr post-build) (pending-item-resolved-paths item))))
(mutex-unlock! pending-count-mutex)
(mutex-lock! pending-mutex)
(set-pending-item-awaiting-count! item 'built)
@ -593,6 +599,11 @@
(set-derivation-meta! (store-path-drv path) (cons (cons 'fallback wrap-fallback) (or (derivation-meta (store-path-drv path)) '())))
path)
; Note: this post-build hook is called with a mutex taken.
(define (store-path-register-post-build path callback)
(set-derivation-meta! (store-path-drv path) (cons (cons 'post-build callback) (or (derivation-meta (store-path-drv path)) '())))
path)
(register-build-step '((zilch core magic) build) #t
(lambda items
(printf "received build info: ~S\n" items)