diff options
-rw-r--r-- | guix-qa-frontpage/reproducible-builds.scm | 73 |
1 files changed, 42 insertions, 31 deletions
diff --git a/guix-qa-frontpage/reproducible-builds.scm b/guix-qa-frontpage/reproducible-builds.scm index 2b4c5d5..4211627 100644 --- a/guix-qa-frontpage/reproducible-builds.scm +++ b/guix-qa-frontpage/reproducible-builds.scm @@ -16,38 +16,49 @@ "/package-derivation-outputs.json?" "system=x86_64-linux&target=none&field=nars" "&limit_results=&all_results=on"))) - (result - (vector-fold - (lambda (_ result output) - (let ((consistency - (assoc-ref output "output_consistency"))) - (if (string=? consistency "unknown") - result - (let ((package (assoc-ref output "package"))) - (cons - `((package . ,(assoc-ref package "name")) - (version . ,(assoc-ref package "version")) - (architecture . "x86_64-linux") - (status . ,(cond - ((string=? consistency "matching") - "reproducible") - ((string=? consistency "not-matching") - "unreproducible") - (else (error "unknown consistency"))))) - result))))) - '() - (assoc-ref data "store_paths")))) + (output-consistency-by-package + (make-hash-table))) - (call-with-output-file "reproducible.json.gz" - (lambda (port) - (call-with-zlib-output-port - port - (lambda (port) - (set-port-encoding! port "UTF-8") - (scm->json (list->vector result) - port - #:pretty #t)) - #:format 'gzip))))) + (vector-for-each + (lambda (_ output) + (let ((consistency + (assoc-ref output "output_consistency"))) + (unless (string=? consistency "unknown") + (let* ((package (assoc-ref output "package")) + (key (cons (assoc-ref package "name") + (assoc-ref package "version")))) + (hash-set! output-consistency-by-package + key + (cons consistency + (or (hash-ref output-consistency-by-package + key) + '()))))))) + (assoc-ref data "store_paths")) + + (let ((result + (hash-fold + (lambda (key val result) + (cons + `((package . ,(car key)) + (version . ,(cdr key)) + (architecture . "x86_64-linux") + (status . ,(if (member "not-matching" val) + "unreproducible" + "reproducible"))) + result)) + '() + output-consistency-by-package))) + + (call-with-output-file "reproducible.json.gz" + (lambda (port) + (call-with-zlib-output-port + port + (lambda (port) + (set-port-encoding! port "UTF-8") + (scm->json (list->vector result) + port + #:pretty #t)) + #:format 'gzip)))))) (call-with-new-thread (lambda () |