unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 48243@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#48243] [PATCH] weather: '--display-missing' shows the system type of missing items.
Date: Wed,  5 May 2021 21:58:19 +0200	[thread overview]
Message-ID: <20210505195819.10924-1-ludo@gnu.org> (raw)

* guix/scripts/weather.scm (store-item-system): New procedure.
(report-server-coverage): Use it to print the system type of each
missing item.
---
 guix/scripts/weather.scm | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

Hi!

The result of this change is an extra column, when using
‘--display-missing’, that shows the system type of missing items:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env  guix weather --display-missing guix libreoffice inkscape linux-libre -s armhf-linux -s powerpc64le-linux -s x86_64-linux -s aarch64-linux

[...]

Substitutes are missing for the following items:
  /gnu/store/n317afb5f14h7hkxz7ycscd6mhda9plm-libreoffice-6.4.7.2                aarch64-linux
  /gnu/store/xwx5qsalgp3v7vyn6hpvsdy2j59b1973-inkscape-1.0.2                     aarch64-linux
  /gnu/store/8zvik3qkh24jrp1dxqmqg17cw002xs90-linux-libre-5.11.18                aarch64-linux
  /gnu/store/463m6ikbvi071jq5m8cj4gpgcgd0lw6a-guix-1.2.0-21.4dff6ec              powerpc64le-linux
  /gnu/store/lblmg73hbrf051zmzicdp8pfzc47knnx-libreoffice-6.4.7.2                powerpc64le-linux
  /gnu/store/rbf85wfw1v59035l8jz1rcxf72ajbhsp-inkscape-1.0.2                     powerpc64le-linux
  /gnu/store/mxjlc83k40xgjq5qilvp65v82794p1jd-guix-1.2.0-21.4dff6ec              armhf-linux
  /gnu/store/d2ap2kdv1rm39awc4lz5psrsq7l3mklc-libreoffice-6.4.7.2                armhf-linux
  /gnu/store/mvdwc2zyg5brkxfp7cazba8bxn9fp4wk-inkscape-1.0.2                     armhf-linux
  /gnu/store/d5ximwvsizr4my1ib4i4mnwk0hdzmn00-linux-libre-5.11.18                armhf-linux
--8<---------------cut here---------------end--------------->8---

I find the extra info to be very useful, in particular when looking
at the weather of ‘etc/release-manifest.scm’, which targets all the
supported architectures.

Thoughts?

Ludo’.

diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 5164fe0494..6d925d416c 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
 ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
@@ -171,6 +171,16 @@ about the derivations queued, as is the case with Hydra."
       #f                                          ;no derivation information
       (lset-intersection string=? queued items)))
 
+(define (store-item-system store item)
+  "Return the system (a string such as \"aarch64-linux\")) ITEM targets,
+or #f if it could not be determined."
+  (match (valid-derivers store item)
+    ((drv . _)
+     (and=> (false-if-exception (read-derivation-from-file drv))
+            derivation-system))
+    (()
+     #f)))
+
 (define* (report-server-coverage server items
                                  #:key display-missing?)
   "Report the subset of ITEMS available as substitutes on SERVER.
@@ -270,7 +280,22 @@ are queued~%")
       (when (and display-missing? (not (null? missing)))
         (newline)
         (format #t (G_ "Substitutes are missing for the following items:~%"))
-        (format #t "~{  ~a~%~}" missing))
+
+        ;; Display two columns: store items, and their system type.
+        (format #t "~:{  ~a ~a~%~}"
+                (zip (map (let ((width (max (- (current-terminal-columns)
+                                               20)
+                                            0)))
+                            (lambda (item)
+                              (if (> (string-length item) width)
+                                  item
+                                  (string-pad-right item width))))
+                          missing)
+                     (with-store store
+                       (map (lambda (item)
+                              (or (store-item-system store item)
+                                  (G_ "unknown system")))
+                            missing)))))
 
       ;; Return the coverage ratio.
       (let ((total (length items)))
-- 
2.31.1





             reply	other threads:[~2021-05-05 19:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 19:58 Ludovic Courtès [this message]
2021-05-08 13:09 ` bug#48243: [PATCH] weather: '--display-missing' shows the system type of missing items Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210505195819.10924-1-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=48243@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).