[U-Boot] [PATCH v9 10/14] buildman: Remove the directory prefix from each error line

Simon Glass sjg at chromium.org
Mon Aug 25 17:58:31 CEST 2014


The full path is long and also includes buildman private directories.
Clean this up, so that only a relative U-Boot path is shown.

This will change warnings like these:

/home/sjg/c/src/third_party/u-boot/buildman5/.bm-work/00/arch/sandbox/cpu/cpu.c: In function 'timer_get_us':
/home/sjg/c/src/third_party/u-boot/buildman5/.bm-work/00/arch/sandbox/cpu/cpu.c:40:9: warning: unused variable 'i' [-Wunused-variable]

/home/sjg/c/src/third_party/u-boot/files/arch/sandbox/cpu/cpu.c: In function 'timer_get_us':
/home/sjg/c/src/third_party/u-boot/files/arch/sandbox/cpu/cpu.c:40:9: warning: unused variable 'i' [-Wunused-variable]

to:

arch/sandbox/cpu/cpu.c: In function 'timer_get_us':
arch/sandbox/cpu/cpu.c:40:9: warning: unused variable 'i' [-Wunused-variable]

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v9:
- Add new patch to remove the directory prefix from each error line

Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None

 tools/buildman/builderthread.py | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 8214662..7fb24bc 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -103,6 +103,23 @@ class BuilderThread(threading.Thread):
         return self.builder.do_make(commit, brd, stage, cwd, *args,
                 **kwargs)
 
+    def _FilterOutDir(self, text, dirname):
+        """Filter out a directory name from each line of a block of text
+
+        Args:
+            text: Text to process (can be multiple lines separated by \n)
+            dirname: Directory name to remove from the start of each text
+                line
+        Returns:
+            Filtered text.
+        """
+        out = []
+        for line in text.split('\n'):
+            if line.startswith(dirname):
+                line = line[len(dirname):]
+            out.append(line)
+        return '\n'.join(out)
+
     def RunCommit(self, commit_upto, brd, work_dir, do_config, force_build,
                   force_build_failures):
         """Build a particular commit.
@@ -177,6 +194,7 @@ class BuilderThread(threading.Thread):
                 Mkdir(out_dir)
                 args = []
                 cwd = work_dir
+                src_dir = os.path.realpath(work_dir)
                 if not self.builder.in_tree:
                     if commit_upto is None:
                         # In this case we are building in the original source
@@ -189,6 +207,7 @@ class BuilderThread(threading.Thread):
                         work_dir = os.path.realpath(work_dir)
                         args.append('O=%s/build' % work_dir)
                         cwd = None
+                        src_dir = os.getcwd()
                     else:
                         args.append('O=build')
                 args.append('-s')
@@ -209,7 +228,8 @@ class BuilderThread(threading.Thread):
                 if result.return_code == 0:
                     result = self.Make(commit, brd, 'build', cwd, *args,
                             env=env)
-                    result.stdout = config_out + result.stdout
+                    result.stderr = self._FilterOutDir(result.stderr,
+                                            src_dir + '/')
             else:
                 result.return_code = 1
                 result.stderr = 'No tool chain for %s\n' % brd.arch
-- 
2.1.0.rc2.206.gedb03e5



More information about the U-Boot mailing list