Fix issue with handling failure to build system channel instance

That resulted in empty revisions. Raise an exception rather than returning #f.
This commit is contained in:
Christopher Baines 2025-07-10 18:06:30 +01:00
parent 683b375d56
commit a3d0e72e48

View file

@ -2239,18 +2239,23 @@ WHERE builder != 'builtin:download'
(assoc-ref channel-derivations-by-system (assoc-ref channel-derivations-by-system
(%current-system)) (%current-system))
'manifest-entry-item))) 'manifest-entry-item)))
(if derivation-file-name-for-current-system
(let ((derivation-for-current-system
(read-derivation-from-file derivation-file-name-for-current-system)))
(with-time-logging "building the channel derivation"
(with-store-connection
(lambda (store)
(build-derivations store (list derivation-for-current-system)))))
(values (unless derivation-file-name-for-current-system
(derivation->output-path derivation-for-current-system) (raise-exception
derivation-file-name-for-current-system)) (make-exception-with-message
(values #f #f)))) (simple-format #f "Failed to generate store item for ~A\n"
commit))))
(let ((derivation-for-current-system
(read-derivation-from-file derivation-file-name-for-current-system)))
(with-time-logging "building the channel derivation"
(with-store-connection
(lambda (store)
(build-derivations store (list derivation-for-current-system)))))
(values
(derivation->output-path derivation-for-current-system)
derivation-file-name-for-current-system))))
(prevent-inlining-for-tests channel-derivations-by-system->guix-store-item) (prevent-inlining-for-tests channel-derivations-by-system->guix-store-item)
@ -2859,7 +2864,7 @@ WHERE builder != 'builtin:download'
(destroy-resource-pool inf-and-store-pool) (destroy-resource-pool inf-and-store-pool)
(destroy-resource-pool postgresql-connection-pool) (destroy-resource-pool postgresql-connection-pool)
#t) *unspecified*)
(prevent-inlining-for-tests extract-information-from) (prevent-inlining-for-tests extract-information-from)
@ -3027,63 +3032,59 @@ WHERE builder != 'builtin:download'
guix-derivation guix-derivation
(channel-derivations-by-system->guix-store-item (channel-derivations-by-system->guix-store-item
channel-derivations-by-system))) channel-derivations-by-system)))
(if store-item
(and
(extract-information-from conn
guix-revision-id-promise
commit guix-source store-item
guix-derivation
call-with-utility-thread
read-derivations/serialised
#:skip-system-tests?
skip-system-tests?
#:extra-inferior-environment-variables
extra-inferior-environment-variables
#:ignore-systems ignore-systems
#:ignore-targets ignore-targets
#:parallelism parallelism
#:inferior-memory-limit
inferior-memory-limit)
(let ((guix-revision-id
(fibers-force guix-revision-id-promise)))
(destroy-parallelism-limiter
read-derivations/parallelism-limiter)
(destroy-thread-pool
utility-thread-pool)
(and (extract-information-from conn
(if (defined? 'channel-news-for-commit guix-revision-id-promise
(resolve-module '(guix channels))) commit guix-source store-item
(with-time-logging "inserting channel news entries" guix-derivation
(insert-channel-news-entries-for-guix-revision call-with-utility-thread
conn read-derivations/serialised
guix-revision-id #:skip-system-tests?
(channel-news-for-commit channel-for-commit commit))) skip-system-tests?
(begin #:extra-inferior-environment-variables
(simple-format extra-inferior-environment-variables
#t "debug: importing channel news not supported\n") #:ignore-systems ignore-systems
#t)) #:ignore-targets ignore-targets
#:parallelism parallelism
#:inferior-memory-limit
inferior-memory-limit)
(with-time-logging "updating builds.derivation_output_details_set_id" (let ((guix-revision-id
(update-builds-derivation-output-details-set-id (fibers-force guix-revision-id-promise)))
conn (destroy-parallelism-limiter
guix-revision-id)) read-derivations/parallelism-limiter)
(update-package-derivations-table (destroy-thread-pool
utility-thread-pool)
(if (defined? 'channel-news-for-commit
(resolve-module '(guix channels)))
(with-time-logging "inserting channel news entries"
(insert-channel-news-entries-for-guix-revision
conn conn
git-repository-id
guix-revision-id guix-revision-id
commit) (channel-news-for-commit channel-for-commit commit)))
(let ((stats (gc-stats))) (simple-format
(format (current-error-port) #t "debug: importing channel news not supported\n"))
"gc-stats: time taken: ~3fs, times: ~d~%"
(/ (assq-ref stats 'gc-time-taken) (with-time-logging "updating builds.derivation_output_details_set_id"
internal-time-units-per-second) (update-builds-derivation-output-details-set-id
(assq-ref stats 'gc-times)) conn
#t)))) guix-revision-id))
(begin
(simple-format #t "Failed to generate store item for ~A\n" (update-package-derivations-table
commit) conn
#f))))) git-repository-id
guix-revision-id
commit)
(let ((stats (gc-stats)))
(format (current-error-port)
"gc-stats: time taken: ~3fs, times: ~d~%"
(/ (assq-ref stats 'gc-time-taken)
internal-time-units-per-second)
(assq-ref stats 'gc-times))))))
*unspecified*)
(define (enqueue-load-new-guix-revision-job conn git-repository-id commit source) (define (enqueue-load-new-guix-revision-job conn git-repository-id commit source)
(define query (define query