[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#795314: ben: use a different colour for packages that are both good and bad



Source: ben
Version: 0.7
Severity: wishlist
Tags: patch

Silly though it might sound, it is possible for ben to consider
a package to be both good and bad. For instance, in the current
libsigc++-2.0 transition, glibmm2.4 is in both states.

I think this might be because old binaries are being kept around
for those source packages in order to satisfy untransitioned packages'
dependencies?

Colouring those packages differently might make it easier to see where
action has and hasn't been taken, in extensively entangled transitions
(naming no C++ ABIs in particular).

The attached seems to produce a vaguely reasonable monitor page, but
please test and review thoroughly, I have no idea how either ben or
ocaml works...

    S
>From 241cd53ff6bdbe3992d57f3a8878e98b853743c7 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Wed, 12 Aug 2015 21:04:11 +0100
Subject: [PATCH] Add a new Partial category for packages that are both good
 and bad

This can happen if:

* one binary package from a source is good and another is bad
* the good and bad expressions are not mutually exclusive
* the package is good but has undergone a SONAME transition,
  and old (bad) binaries are being kept around to satisfy
  other packages' dependencies
---
 frontends/ben_monitor.ml | 18 ++++++++++++++++--
 lib/benl_base.ml         |  4 +++-
 media/styles.css         |  5 +++++
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/frontends/ben_monitor.ml b/frontends/ben_monitor.ml
index 3742f62..af52d76 100644
--- a/frontends/ben_monitor.ml
+++ b/frontends/ben_monitor.ml
@@ -73,6 +73,7 @@ let format_arch x =
     | Unknown -> (fun x -> "."^x^".")
     | Up_to_date -> (fun x -> "("^x^")")
     | Outdated -> (fun x -> "["^x^"]")
+    | Partial -> (fun x -> "¿"^x^"?")
   in
   let f =
     if !use_colors then
@@ -80,6 +81,7 @@ let format_arch x =
         | Unknown -> f
         | Up_to_date -> (fun x -> "\027[32m"^(f x)^"\027[0m")
         | Outdated -> (fun x -> "\027[1m\027[31m"^(f x)^"\027[0m")
+        | Partial -> (fun x -> "\027[33m"^(f x)^"\027[0m")
     else f
   in f
 
@@ -141,7 +143,10 @@ let relevant_arch arch_ref arch_pkg =
 
 let compute_state config pkg =
   if Query.eval_binary pkg !!(is_bad config) then
-    Outdated
+    if Query.eval_binary pkg !!(is_good config) then
+      Partial
+    else
+      Outdated
   else if Query.eval_binary pkg !!(is_good config) then
     Up_to_date
   else
@@ -149,6 +154,10 @@ let compute_state config pkg =
 
 let combine_states state1 state2 =
   match state1, state2 with
+    | Partial, _
+    | _, Partial -> Partial
+    | Outdated, Up_to_date
+    | Up_to_date, Outdated -> Partial
     | Outdated, _
     | _, Outdated -> Outdated
     | Up_to_date, _
@@ -285,7 +294,10 @@ let overrall_state l =
   if List.for_all (fun (_,(_,status)) -> status = Unknown) release_archs then
     Unknown
   else if List.for_all (fun (_,(_,status)) -> status <> Outdated) release_archs then
-    Up_to_date
+    if List.for_all (fun (_,(_,status)) -> status <> Partial) release_archs then
+      Up_to_date
+    else
+      Partial
   else
     Outdated
 
@@ -309,6 +321,8 @@ let generate_stats monitor_data =
           match overrall_state with
           | Outdated when (not !Benl_data.use_projectb || is_in_testing) ->
               return (all+1) (bad+1)
+          | Partial when (not !Benl_data.use_projectb || is_in_testing) ->
+              return (all+1) (bad+1)
           | Up_to_date ->
               return (all+1) bad
           | _ ->
diff --git a/lib/benl_base.ml b/lib/benl_base.ml
index 28a0e94..fbd25d2 100644
--- a/lib/benl_base.ml
+++ b/lib/benl_base.ml
@@ -68,17 +68,19 @@ let debian_ports_architectures =
     "m68k"; "powerpcspe"; "ppc64";
     "sh4"; "sparc64"; "x32" ]
 
-type status = Unknown | Up_to_date | Outdated
+type status = Unknown | Up_to_date | Outdated | Partial
 
 let string_of_status = function
   | Unknown -> " "
   | Up_to_date -> "✔"
   | Outdated -> "✘"
+  | Partial -> "⁈"
 
 let class_of_status = function
   | Unknown -> "unknown"
   | Up_to_date -> "good"
   | Outdated -> "bad"
+  | Partial -> "partial"
 
 module Version : sig
 
diff --git a/media/styles.css b/media/styles.css
index 112ce21..f19d45e 100644
--- a/media/styles.css
+++ b/media/styles.css
@@ -53,6 +53,11 @@ div.footer {
   text-align: center;
 }
 
+.partial {
+  background: Orange;
+  text-align: center;
+}
+
 .unknown {
   background: Cornsilk;
   text-align: center;
-- 
2.5.0


Reply to: