[buildroot-test,2/4] utils/daily-mail: allow to print a header for results section
diff mbox series

Message ID 20190708081406.28215-3-victor.huesca@bootlin.com
State Changes Requested
Headers show
Series
  • add support for outdated packages
Related show

Commit Message

Victor Huesca July 8, 2019, 8:14 a.m. UTC
This table quite clear without header but as I had a template for the outdated
table I also added the possibility to include one for results too.

Note that this commit only add the option to print the header but does not
enable it, so the existing behavior is preserved.

Signed-off-by: Victor Huesca <victor.huesca@bootlin.com>
---
 utils/daily-mail | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni Aug. 1, 2019, 12:58 p.m. UTC | #1
Hello,

On Mon,  8 Jul 2019 10:14:04 +0200
Victor Huesca <victor.huesca@bootlin.com> wrote:

> This table quite clear without header but as I had a template for the outdated
> table I also added the possibility to include one for results too.
> 
> Note that this commit only add the option to print the header but does not
> enable it, so the existing behavior is preserved.
> 
> Signed-off-by: Victor Huesca <victor.huesca@bootlin.com>
> ---
>  utils/daily-mail | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/daily-mail b/utils/daily-mail
> index 4ab7710..b4d0a56 100755
> --- a/utils/daily-mail
> +++ b/utils/daily-mail
> @@ -158,8 +158,25 @@ def add_outdated_pkg_notification(notifications, outdated_pkg):
>              notif = get_notification_for_dev(notifications, get_orphan_developer())
>              notif.package_version_notification.append(pkg)
>  
> -def show_results(results, show_status, show_orphan=False):
> +
> +def show_results(results, show_status, show_orphan=False, show_header=False):

As I replied in my review of PATCH 1/4, please make this unconditional.
And this patch should come *before* the outdated package feature.

Thomas

Patch
diff mbox series

diff --git a/utils/daily-mail b/utils/daily-mail
index 4ab7710..b4d0a56 100755
--- a/utils/daily-mail
+++ b/utils/daily-mail
@@ -158,8 +158,25 @@  def add_outdated_pkg_notification(notifications, outdated_pkg):
             notif = get_notification_for_dev(notifications, get_orphan_developer())
             notif.package_version_notification.append(pkg)
 
-def show_results(results, show_status, show_orphan=False):
+
+def show_results(results, show_status, show_orphan=False, show_header=False):
     contents = ""
+    if show_header:
+        if show_status:
+            contents += '{:^12} | {:^30} | {:^3} | {:^79}'.format('arch', 'reason', 'OK?', 'url')
+        else:
+            contents += '{:^12} | {:^30} | {:^79}'.format('arch', 'reason', 'url')
+        if show_orphan:
+            contents += ' | {:^5}'.format('orph?')
+
+        if show_status:
+            contents += '\n{0:-^12}-+-{0:-^30}-+-{0:-^3}-+-{0:-^79}-'.format('')
+        else:
+            contents += '\n{0:-^12}-+-{0:-^30}-+-{0:-^79}-'.format('')
+        if show_orphan:
+            contents += '+-{:-^5}-'.format('')
+        contents += '\n'
+
     for r in results:
         arch = r['arch']
         reason = r['reason']