diff options
author | Christopher Baines <mail@cbaines.net> | 2023-06-09 11:48:27 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-06-09 16:11:06 +0100 |
commit | 5c9ec28cb5d248bb3e3bbe6e68d67de910e03b5b (patch) | |
tree | e8c89921a13e7c73348cf639a3b07fba0485d876 /guix-data-service/model | |
parent | 7524d23b44b7aa3db42b9d5344eefa6440467189 (diff) | |
download | data-service-5c9ec28cb5d248bb3e3bbe6e68d67de910e03b5b.tar data-service-5c9ec28cb5d248bb3e3bbe6e68d67de910e03b5b.tar.gz |
Query for outputs when build events arrive
This will keep the substitute information more up to date.
Diffstat (limited to 'guix-data-service/model')
-rw-r--r-- | guix-data-service/model/build.scm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/guix-data-service/model/build.scm b/guix-data-service/model/build.scm index 4f347f5..ea4ce65 100644 --- a/guix-data-service/model/build.scm +++ b/guix-data-service/model/build.scm @@ -26,6 +26,7 @@ #:use-module (guix-data-service model derivation) #:use-module (guix-data-service model system) #:export (select-build-stats + select-build-outputs select-builds-with-context select-builds-with-context-by-derivation-file-name select-builds-with-context-by-derivation-output @@ -121,6 +122,40 @@ ORDER BY status")) ((sql . value) value)) (filter pair? criteria)))))) +(define (select-build-outputs conn build-id) + (match (exec-query + conn + " +SELECT derivation_file_name, derivation_output_details_set_id +FROM builds +WHERE builds.id = $1" + (list (number->string build-id))) + (((derivation-file-name output-details-set-id)) + + (if output-details-set-id + (exec-query + conn + " +SELECT derivation_output_details.path +FROM derivation_output_details +INNER JOIN derivation_output_details_sets + ON ARRAY[derivation_output_details.id] && + derivation_output_details_sets.derivation_output_details_ids +WHERE derivation_output_details_sets.id = $1" + (list output-details-set-id)) + (exec-query + conn + " +SELECT derivation_output_details.path +FROM derivations +INNER JOIN derivation_outputs + ON derivations.id = derivation_outputs.derivation_id +INNER JOIN derivation_output_details + ON derivation_outputs.derivation_output_details_id + = derivation_output_details.id +WHERE derivations.file_name = $1" + (list derivation-file-name)))))) + (define* (select-builds-with-context conn build-statuses build-server-ids #:key revision-commit system target |