diff options
author | Christopher Baines <mail@cbaines.net> | 2019-12-14 17:10:23 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-12-14 17:10:23 +0000 |
commit | 9dddf2c606bd3bcfa4bd7881cb999099ae013dad (patch) | |
tree | 7f29b4018c474fc6c604cb198e5be89fa5f180f9 | |
parent | 4cc678dfb190702e190e77bec61214665119708f (diff) | |
download | data-service-9dddf2c606bd3bcfa4bd7881cb999099ae013dad.tar data-service-9dddf2c606bd3bcfa4bd7881cb999099ae013dad.tar.gz |
Implement the reproducibility status filter
On the derivation-outputs page.
-rw-r--r-- | guix-data-service/model/derivation.scm | 38 | ||||
-rw-r--r-- | guix-data-service/web/revision/controller.scm | 4 | ||||
-rw-r--r-- | guix-data-service/web/revision/html.scm | 1 |
3 files changed, 43 insertions, 0 deletions
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm index 143de70..c565607 100644 --- a/guix-data-service/model/derivation.scm +++ b/guix-data-service/model/derivation.scm @@ -272,6 +272,7 @@ ORDER BY derivations.file_name (define* (select-derivation-outputs-in-revision conn commit-hash #:key + reproducibility-status limit-results after-path) (define query @@ -317,6 +318,43 @@ WHERE guix_revisions.commit = $1 (if after-path " AND derivation_output_details.path > $2" "") + (cond + ((string=? reproducibility-status "any") + "") + ((string=? reproducibility-status "fixed-output") + " AND derivation_output_details.hash IS NOT NULL") + (else + (string-append + " AND derivation_output_details.hash IS NULL AND ( + SELECT +" + (cond + ((string=? reproducibility-status "unknown") + "COUNT(DISTINCT narinfo_fetch_records.build_server_id) <= 1") + ((string=? reproducibility-status "reproducible") + " + CASE + WHEN (COUNT(DISTINCT narinfo_fetch_records.build_server_id) <= 1) THEN NULL + ELSE (COUNT(DISTINCT nars.hash) = 1) + END") + ((string=? reproducibility-status "unreproducible") + " + CASE + WHEN (COUNT(DISTINCT narinfo_fetch_records.build_server_id) <= 1) THEN NULL + ELSE (COUNT(DISTINCT nars.hash) > 1) + END") + (else + (error "unknown reproducibility status"))) + " + 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 +)"))) " ORDER BY derivation_output_details.path " diff --git a/guix-data-service/web/revision/controller.scm b/guix-data-service/web/revision/controller.scm index eb789e8..823dcec 100644 --- a/guix-data-service/web/revision/controller.scm +++ b/guix-data-service/web/revision/controller.scm @@ -170,6 +170,8 @@ (parse-query-parameters request `((after_path ,identity) + (reproducibility_status ,identity + #:default "any") (limit_results ,parse-result-limit #:no-default-when (all_results) #:default 100) @@ -620,6 +622,8 @@ (select-derivation-outputs-in-revision conn commit-hash + #:reproducibility-status + (assq-ref query-parameters 'reproducibility_status) #:limit-results limit-results #:after-path (assq-ref query-parameters 'after_path))) (show-next-page? diff --git a/guix-data-service/web/revision/html.scm b/guix-data-service/web/revision/html.scm index 5e601bf..7228100 100644 --- a/guix-data-service/web/revision/html.scm +++ b/guix-data-service/web/revision/html.scm @@ -801,6 +801,7 @@ "List packages where the derivation output path matches this query.") ,(form-horizontal-control "Reproducibility status" query-parameters + #:allow-selecting-multiple-options #f #:options '(("Any" . "any") ("Unknown" . "unknown") ("Reproducible" . "reproducible") |