All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 05/11] buildman: Improve the toolchain progress/error output
Date: Wed, 27 Jul 2016 20:33:02 -0600	[thread overview]
Message-ID: <1469673188-15834-6-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1469673188-15834-1-git-send-email-sjg@chromium.org>

Use colour to make it easier to see what is going on. Also print a message
before downloading a new toolchain. Mention --fetch-arch in the message that
is shown when there are no available toolchains, since this is the quickest
way to resolve the problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

Changes in v2: None

 tools/buildman/control.py   |  9 ++++++---
 tools/buildman/toolchain.py | 24 +++++++++++++++---------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index aeb128a..46053d8 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -107,6 +107,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
         return 0
 
     gitutil.Setup()
+    col = terminal.Color()
 
     options.git_dir = os.path.join(options.git, '.git')
 
@@ -122,14 +123,17 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
     if options.fetch_arch:
         if options.fetch_arch == 'list':
             sorted_list = toolchains.ListArchs()
-            print 'Available architectures: %s\n' % ' '.join(sorted_list)
+            print col.Color(col.BLUE, 'Available architectures: %s\n' %
+                            ' '.join(sorted_list))
             return 0
         else:
             fetch_arch = options.fetch_arch
             if fetch_arch == 'all':
                 fetch_arch = ','.join(toolchains.ListArchs())
-                print 'Downloading toolchains: %s\n' % fetch_arch
+                print col.Color(col.CYAN, '\nDownloading toolchains: %s' %
+                                fetch_arch)
             for arch in fetch_arch.split(','):
+                print
                 ret = toolchains.FetchAndInstall(arch)
                 if ret:
                     return ret
@@ -138,7 +142,6 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
     # Work out how many commits to build. We want to build everything on the
     # branch. We also build the upstream commit as a control so we can see
     # problems introduced by the first commit on the branch.
-    col = terminal.Color()
     count = options.count
     has_range = options.branch and '..' in options.branch
     if count == -1:
diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py
index 1e1ce42..38876c2 100644
--- a/tools/buildman/toolchain.py
+++ b/tools/buildman/toolchain.py
@@ -13,6 +13,7 @@ import urllib2
 
 import bsettings
 import command
+import terminal
 
 (PRIORITY_FULL_PREFIX, PRIORITY_PREFIX_GCC, PRIORITY_PREFIX_GCC_PATH,
     PRIORITY_CALC) = range(4)
@@ -179,9 +180,11 @@ class Toolchains:
         """
         toolchains = bsettings.GetItems('toolchain')
         if show_warning and not toolchains:
-            print ('Warning: No tool chains - please add a [toolchain] section'
-                 ' to your buildman config file %s. See README for details' %
-                 bsettings.config_fname)
+            print ("Warning: No tool chains. Please run 'buildman "
+                   "--fetch-arch all' to download all available toolchains, or "
+                   "add a [toolchain] section to your buildman config file "
+                   "%s. See README for details" %
+                   bsettings.config_fname)
 
         paths = []
         for name, value in toolchains:
@@ -294,7 +297,9 @@ class Toolchains:
 
     def List(self):
         """List out the selected toolchains for each architecture"""
-        print 'List of available toolchains (%d):' % len(self.toolchains)
+        col = terminal.Color()
+        print col.Color(col.BLUE, 'List of available toolchains (%d):' %
+                        len(self.toolchains))
         if len(self.toolchains):
             for key, value in sorted(self.toolchains.iteritems()):
                 print '%-10s: %s' % (key, value.gcc)
@@ -509,6 +514,8 @@ class Toolchains:
             Architecture to fetch, or 'list' to list
         """
         # Fist get the URL for this architecture
+        col = terminal.Color()
+        print col.Color(col.BLUE, "Downloading toolchain for arch '%s'" % arch)
         url = self.LocateArchUrl(arch)
         if not url:
             print ("Cannot find toolchain for arch '%s' - use 'list' to list" %
@@ -523,7 +530,7 @@ class Toolchains:
         tmpdir, tarfile = self.Download(url)
         if not tarfile:
             return 1
-        print 'Unpacking to: %s' % dest,
+        print col.Color(col.GREEN, 'Unpacking to: %s' % dest),
         sys.stdout.flush()
         path = self.Unpack(tarfile, dest)
         os.remove(tarfile)
@@ -531,16 +538,15 @@ class Toolchains:
         print
 
         # Check that the toolchain works
-        print 'Testing'
+        print col.Color(col.GREEN, 'Testing')
         dirpath = os.path.join(dest, path)
         compiler_fname_list = self.ScanPath(dirpath, True)
         if not compiler_fname_list:
             print 'Could not locate C compiler - fetch failed.'
             return 1
         if len(compiler_fname_list) != 1:
-            print ('Internal error, ambiguous toolchains: %s' %
-                   (', '.join(compiler_fname)))
-            return 1
+            print col.Color(col.RED, 'Warning, ambiguous toolchains: %s' %
+                            ', '.join(compiler_fname_list))
         toolchain = Toolchain(compiler_fname_list[0], True, True)
 
         # Make sure that it will be found by buildman
-- 
2.8.0.rc3.226.g39d4020

  parent reply	other threads:[~2016-07-28  2:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28  2:32 [U-Boot] [PATCH v2 00/11] buildman: Make the tool friendlier for first-time users Simon Glass
2016-07-28  2:32 ` [U-Boot] [PATCH v2 01/11] buildman: Tidy up the README a little Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  2:32 ` [U-Boot] [PATCH v2 02/11] buildman: Automatically create a config file if needed Simon Glass
2016-07-28  3:28   ` Tom Rini
2016-08-01 18:22     ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 03/11] buildman: Fix the 'help' test to use the correct path Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 04/11] buildman: Allow the toolchain error to be suppressed Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  2:33 ` Simon Glass [this message]
2016-08-01 18:22   ` [U-Boot] [PATCH v2 05/11] buildman: Improve the toolchain progress/error output Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 06/11] buildman: Fix a typo in TestSettingsHasPath() Simon Glass
2016-07-28  3:28   ` Tom Rini
2016-08-01 18:22     ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 07/11] buildman: Drop the toolchain error when downloading toolchains Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 08/11] buildman: Avoid overwriting existing toolchain entries Simon Glass
2016-07-28  3:28   ` Tom Rini
2016-08-01 18:22     ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 09/11] buildman: Add a quick-start note Simon Glass
2016-07-28  3:28   ` Tom Rini
2016-08-01 18:22     ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 10/11] Drop the MAKEALL tool Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  2:33 ` [U-Boot] [PATCH v2 11/11] Drop references to MAKEALL in the documentation Simon Glass
2016-08-01 18:22   ` Simon Glass
2016-07-28  3:28 ` [U-Boot] [PATCH v2 00/11] buildman: Make the tool friendlier for first-time users Tom Rini
2016-07-28  3:32   ` Simon Glass

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

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

  git send-email \
    --in-reply-to=1469673188-15834-6-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.