diff options
author | Christopher Baines <mail@cbaines.net> | 2022-09-17 15:11:25 +0200 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-09-17 15:11:25 +0200 |
commit | 4dcec76d50a892d4025b1095f53323ba65dc4d3b (patch) | |
tree | 15c9ed825e0cc75218efdf166d862a195150af82 /guix-qa-frontpage/view | |
parent | 14a594a114ea7bb7a53f7a3d1333486348e8b0c0 (diff) | |
download | qa-frontpage-4dcec76d50a892d4025b1095f53323ba65dc4d3b.tar qa-frontpage-4dcec76d50a892d4025b1095f53323ba65dc4d3b.tar.gz |
Remove duplication in the branch module
Diffstat (limited to 'guix-qa-frontpage/view')
-rw-r--r-- | guix-qa-frontpage/view/branch.scm | 100 |
1 files changed, 5 insertions, 95 deletions
diff --git a/guix-qa-frontpage/view/branch.scm b/guix-qa-frontpage/view/branch.scm index d472d03..9606564 100644 --- a/guix-qa-frontpage/view/branch.scm +++ b/guix-qa-frontpage/view/branch.scm @@ -2,36 +2,11 @@ #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:use-module (guix-qa-frontpage manage-builds) + #:use-module (guix-qa-frontpage derivation-changes) #:use-module (guix-qa-frontpage view util) #:export (branch-view)) (define (branch-view branch derivation-changes) - (define (builds-by-system-excluding-cross-builds side) - (fold (lambda (package result) - (fold - (lambda (change result) - (if (string=? (assoc-ref change "target") - "") - (let ((system (assoc-ref change "system"))) - `((,system - . ,(append! - (map - (lambda (build) - `(,@build - ("package" - . (("name" . ,(assoc-ref package "name")) - ("version" . ,(assoc-ref package "version")))))) - (vector->list (assoc-ref change "builds"))) - (or (assoc-ref result system) - '()))) - ,@(alist-delete system result))) - result)) - result - (vector->list - (assoc-ref package side)))) - '() - derivation-changes)) - (define* (package-derivations-comparison-link system #:key build-change) (let ((revisions @@ -47,73 +22,6 @@ (simple-format #f "&build_change=~A" build-change) "")))) - (define (categorise-builds all-systems builds-by-system) - (define (package-eq? a b) - (and - (string=? - (assoc-ref a "name") - (assoc-ref b "name")) - (string=? - (assoc-ref a "version") - (assoc-ref b "version")))) - - (define (group-builds-by-package builds) - (let ((result (make-hash-table))) - (for-each - (lambda (build) - (let ((package (assoc-ref build "package"))) - (hash-set! result - package - (cons build - (or (hash-ref result package) - '()))))) - builds) - - (hash-map->list cons result))) - - (define systems - (map car builds-by-system)) - - (map - (match-lambda - ((system . builds) - (let ((builds-by-package - (group-builds-by-package builds))) - (cons - system - (fold - (match-lambda* - (((package . builds) result) - (let* ((build-statuses - (map (lambda (build) - (assoc-ref build "status")) - builds)) - (category - (cond - ((member "succeeded" build-statuses) - 'succeeding) - ((and (not (member "suceeded" build-statuses)) - (member "failed" build-statuses)) - 'failing) - (else - 'unknown)))) - - `((,category . ,(cons - (cons package builds) - (assq-ref result category))) - ,@(alist-delete category result))))) - '((succeeding . ()) - (failing . ()) - (unknown . ())) - builds-by-package))))) - - (append builds-by-system - (map (lambda (system) - (cons system '())) - (filter (lambda (system) - (not (member system systems))) - all-systems))))) - (layout #:title (simple-format #f "Branch ~A" branch) #:body @@ -149,9 +57,11 @@ (tbody ,@(if derivation-changes (let* ((base-builds - (builds-by-system-excluding-cross-builds "base")) + (builds-by-system-excluding-cross-builds + derivation-changes "base")) (target-builds - (builds-by-system-excluding-cross-builds "target")) + (builds-by-system-excluding-cross-builds + derivation-changes "target")) (all-systems (delete-duplicates |