From a3d0e72e481a899a8c78877c60d753742784d957 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 10 Jul 2025 18:06:30 +0100 Subject: [PATCH] Fix issue with handling failure to build system channel instance That resulted in empty revisions. Raise an exception rather than returning #f. --- .../jobs/load-new-guix-revision.scm | 131 +++++++++--------- 1 file changed, 66 insertions(+), 65 deletions(-) diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index f218d20..e92dba7 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -2239,18 +2239,23 @@ WHERE builder != 'builtin:download' (assoc-ref channel-derivations-by-system (%current-system)) '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 - (derivation->output-path derivation-for-current-system) - derivation-file-name-for-current-system)) - (values #f #f)))) + (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 + (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) @@ -2859,7 +2864,7 @@ WHERE builder != 'builtin:download' (destroy-resource-pool inf-and-store-pool) (destroy-resource-pool postgresql-connection-pool) - #t) + *unspecified*) (prevent-inlining-for-tests extract-information-from) @@ -3027,63 +3032,59 @@ WHERE builder != 'builtin:download' guix-derivation (channel-derivations-by-system->guix-store-item 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 - (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 - guix-revision-id - (channel-news-for-commit channel-for-commit commit))) - (begin - (simple-format - #t "debug: importing channel news not supported\n") - #t)) + (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) - (with-time-logging "updating builds.derivation_output_details_set_id" - (update-builds-derivation-output-details-set-id - conn - guix-revision-id)) - (update-package-derivations-table + (let ((guix-revision-id + (fibers-force guix-revision-id-promise))) + (destroy-parallelism-limiter + read-derivations/parallelism-limiter) + (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 - 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)) - #t)))) - (begin - (simple-format #t "Failed to generate store item for ~A\n" - commit) - #f))))) + (channel-news-for-commit channel-for-commit commit))) + (simple-format + #t "debug: importing channel news not supported\n")) + + (with-time-logging "updating builds.derivation_output_details_set_id" + (update-builds-derivation-output-details-set-id + conn + guix-revision-id)) + + (update-package-derivations-table + conn + 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 query