diff options
author | Christopher Baines <mail@cbaines.net> | 2020-05-03 21:20:53 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-05-03 21:20:53 +0100 |
commit | 3cc14ae03a4f3782cd61756cda772ba5cb4aee4b (patch) | |
tree | 16c37758370018fadcf61f1c9e0879864355b99e /guix-data-service | |
parent | e4cb3a815a62349685c6ec695f6d7b75eb468d19 (diff) | |
download | data-service-3cc14ae03a4f3782cd61756cda772ba5cb4aee4b.tar data-service-3cc14ae03a4f3782cd61756cda772ba5cb4aee4b.tar.gz |
Add a couple of options to select-derivation-outputs-in-revision
To filter outputs by whether particular substitute servers have a substitute.
Diffstat (limited to 'guix-data-service')
-rw-r--r-- | guix-data-service/model/derivation.scm | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm index 693e513..a19b336 100644 --- a/guix-data-service/model/derivation.scm +++ b/guix-data-service/model/derivation.scm @@ -454,6 +454,8 @@ ORDER BY derivations.file_name #:key search-query output-consistency + nars-from-build-servers + no-nars-from-build-servers system target limit-results @@ -517,6 +519,40 @@ WHERE guix_revisions.commit = $1 query count)) criteria (iota (length criteria) 2)))) + (if (list? nars-from-build-servers) + (string-append + " +AND ARRAY[" (string-join (map number->string nars-from-build-servers) + ", ") +"]::integer[] <@ COALESCE(( -- contained by + SELECT ARRAY_AGG(narinfo_fetch_records.build_server_id) + FROM nars + INNER JOIN narinfo_signatures + ON nars.id = narinfo_signatures.nar_id + INNER JOIN narinfo_signature_data + ON narinfo_signature_data.id = narinfo_signatures.narinfo_signature_data_id + INNER JOIN narinfo_fetch_records + ON narinfo_signature_data.id = narinfo_fetch_records.narinfo_signature_data_id + WHERE nars.store_path = derivation_output_details.path +), ARRAY[]::integer[])") + "") + (if (list? no-nars-from-build-servers) + (string-append + " +AND NOT ARRAY[" (string-join (map number->string no-nars-from-build-servers) + ", ") +"]::integer[] && COALESCE(( + SELECT ARRAY_AGG(narinfo_fetch_records.build_server_id) + FROM nars + INNER JOIN narinfo_signatures + ON nars.id = narinfo_signatures.nar_id + INNER JOIN narinfo_signature_data + ON narinfo_signature_data.id = narinfo_signatures.narinfo_signature_data_id + INNER JOIN narinfo_fetch_records + ON narinfo_signature_data.id = narinfo_fetch_records.narinfo_signature_data_id + WHERE nars.store_path = derivation_output_details.path +), ARRAY[]::integer[])") + "") (cond ((string=? output-consistency "any") "") |