diff mbox series

[bug#47929,4/5] scripts: weather: Add packages dashboard support.

Message ID 20210421122108.2344-4-othacehe@gnu.org
State New
Headers show
Series Add manifest support to channel-with-substitutes-available | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Mathieu Othacehe April 21, 2021, 12:21 p.m. UTC
* guix/scripts/weather.scm (display-dashboard-url): New procedure.
(guix-weather): Call it.
---
 guix/scripts/weather.scm | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 5164fe0494..be0b2e3509 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -499,6 +499,17 @@  SERVER.  Display information for packages with at least THRESHOLD dependents."
              #f
              systems))))
 
+(define (display-dashboard-url server packages)
+  "Display a link to the dashboard for PACKAGES on the given CI SERVER."
+  (let* ((id (dashboard-register server packages))
+         (url (and id (dashboard-url server id))))
+    (when url
+      (format #t "~%")
+      (format #t (G_ "The packages dashboard is available ~a.~%")
+              (if (supports-hyperlinks?)
+                  (hyperlink url (G_ "here"))
+                  (format #f "here: ~a" url))))))
+
 
 ;;;
 ;;; Entry point.
@@ -554,15 +565,18 @@  SERVER.  Display information for packages with at least THRESHOLD dependents."
                      (report-server-coverage server items
                                              #:display-missing?
                                              (assoc-ref opts 'display-missing?)))
-                   (match (assoc-ref opts 'coverage)
-                     (#f #f)
-                     (threshold
-                      ;; PACKAGES may include non-package objects coming from a
-                      ;; manifest.  Filter them out.
-                      (report-package-coverage server
-                                               (filter package? packages)
-                                               systems
-                                               #:threshold threshold)))
+
+                   ;; PACKAGES may include non-package objects coming from a
+                   ;; manifest.  Filter them out.
+                   (let ((packages (filter package? packages)))
+                     (match (assoc-ref opts 'coverage)
+                       (#f #f)
+                       (threshold
+                        (report-package-coverage server
+                                                 packages
+                                                 systems
+                                                 #:threshold threshold)))
+                     (display-dashboard-url server packages))
 
                    (= 1 coverage))
                  urls))))))