aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-02-15 15:48:45 +0000
committerChristopher Baines <mail@cbaines.net>2023-02-15 15:48:45 +0000
commitf68822cad2f8cd5cbef06aad4e4570bb8afcf725 (patch)
tree1dd4be110a7f4e157c7368a140e92717b502c8d0 /guix-data-service/web
parent1266d3d3366cb502f93d697105ea5c94558c5a6a (diff)
downloaddata-service-f68822cad2f8cd5cbef06aad4e4570bb8afcf725.tar
data-service-f68822cad2f8cd5cbef06aad4e4570bb8afcf725.tar.gz
Include some useful numbers on the package derivations comparison
As it's frequently useful to know how many packages/builds some change has affected.
Diffstat (limited to 'guix-data-service/web')
-rw-r--r--guix-data-service/web/compare/html.scm29
1 files changed, 29 insertions, 0 deletions
diff --git a/guix-data-service/web/compare/html.scm b/guix-data-service/web/compare/html.scm
index 17272e3..58fb514 100644
--- a/guix-data-service/web/compare/html.scm
+++ b/guix-data-service/web/compare/html.scm
@@ -18,10 +18,12 @@
(define-module (guix-data-service web compare html)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
+ #:use-module (srfi srfi-43)
#:use-module (ice-9 match)
#:use-module (ice-9 vlist)
#:use-module (texinfo)
#:use-module (texinfo html)
+ #:use-module (guix-data-service utils)
#:use-module (guix-data-service web query-parameters)
#:use-module (guix-data-service web util)
#:use-module (guix-data-service web html-utils)
@@ -842,6 +844,33 @@ enough builds to determine a change")))
(div
(@ (class "col-sm-12"))
(h1 ,page-header)
+ ,@(if (not (null? derivation-changes))
+ (match (vector-fold
+ (lambda (_ result change)
+ (match result
+ ((names . new-drvs-count)
+ (let ((count
+ (or
+ (and=> (assq-ref change 'target)
+ vector-length)
+ 0)))
+ (cons
+ (if (= 0 count)
+ names
+ (cons (assq-ref change 'name)
+ names))
+ (+ new-drvs-count count))))))
+ (cons '() 0)
+ derivation-changes)
+ ((names . new-drvs-count)
+ (let ((distinct-packages
+ (length
+ (delete-duplicates/sort! names string<?))))
+ `((p
+ ,(simple-format #f "Showing ~A new derivations across ~A packages"
+ new-drvs-count
+ distinct-packages))))))
+ '())
,(if
(null? derivation-changes)
'(p "No derivation changes")