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,7 +2239,13 @@ 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
(unless derivation-file-name-for-current-system
(raise-exception
(make-exception-with-message
(simple-format #f "Failed to generate store item for ~A\n"
commit))))
(let ((derivation-for-current-system (let ((derivation-for-current-system
(read-derivation-from-file derivation-file-name-for-current-system))) (read-derivation-from-file derivation-file-name-for-current-system)))
(with-time-logging "building the channel derivation" (with-time-logging "building the channel derivation"
@ -2249,8 +2255,7 @@ WHERE builder != 'builtin:download'
(values (values
(derivation->output-path derivation-for-current-system) (derivation->output-path derivation-for-current-system)
derivation-file-name-for-current-system)) derivation-file-name-for-current-system))))
(values #f #f))))
(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,8 +3032,7 @@ 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 (extract-information-from conn
guix-revision-id-promise guix-revision-id-promise
commit guix-source store-item commit guix-source store-item
@ -3044,6 +3048,7 @@ WHERE builder != 'builtin:download'
#:parallelism parallelism #:parallelism parallelism
#:inferior-memory-limit #:inferior-memory-limit
inferior-memory-limit) inferior-memory-limit)
(let ((guix-revision-id (let ((guix-revision-id
(fibers-force guix-revision-id-promise))) (fibers-force guix-revision-id-promise)))
(destroy-parallelism-limiter (destroy-parallelism-limiter
@ -3051,7 +3056,6 @@ WHERE builder != 'builtin:download'
(destroy-thread-pool (destroy-thread-pool
utility-thread-pool) utility-thread-pool)
(and
(if (defined? 'channel-news-for-commit (if (defined? 'channel-news-for-commit
(resolve-module '(guix channels))) (resolve-module '(guix channels)))
(with-time-logging "inserting channel news entries" (with-time-logging "inserting channel news entries"
@ -3059,31 +3063,28 @@ WHERE builder != 'builtin:download'
conn conn
guix-revision-id guix-revision-id
(channel-news-for-commit channel-for-commit commit))) (channel-news-for-commit channel-for-commit commit)))
(begin
(simple-format (simple-format
#t "debug: importing channel news not supported\n") #t "debug: importing channel news not supported\n"))
#t))
(with-time-logging "updating builds.derivation_output_details_set_id" (with-time-logging "updating builds.derivation_output_details_set_id"
(update-builds-derivation-output-details-set-id (update-builds-derivation-output-details-set-id
conn conn
guix-revision-id)) guix-revision-id))
(update-package-derivations-table (update-package-derivations-table
conn conn
git-repository-id git-repository-id
guix-revision-id guix-revision-id
commit) commit)
(let ((stats (gc-stats))) (let ((stats (gc-stats)))
(format (current-error-port) (format (current-error-port)
"gc-stats: time taken: ~3fs, times: ~d~%" "gc-stats: time taken: ~3fs, times: ~d~%"
(/ (assq-ref stats 'gc-time-taken) (/ (assq-ref stats 'gc-time-taken)
internal-time-units-per-second) internal-time-units-per-second)
(assq-ref stats 'gc-times)) (assq-ref stats 'gc-times))))))
#t))))
(begin *unspecified*)
(simple-format #t "Failed to generate store item for ~A\n"
commit)
#f)))))
(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