[U-Boot] [PATCH v2] buildman: Create parent directories as necessary

Thierry Reding thierry.reding at gmail.com
Tue Aug 19 10:22:39 CEST 2014


From: Thierry Reding <treding at nvidia.com>

When creating build directories also create parents as necessary. This
fixes a failure when building a hierarchical branch (i.e. foo/bar).

Signed-off-by: Thierry Reding <treding at nvidia.com>
---
Changes in v2:
- only create parent directories for the top build directory to avoid
  sloppy directory creation

 tools/buildman/builder.py       | 2 +-
 tools/buildman/builderthread.py | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index d5b8454c0846..1e00a568b144 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1037,7 +1037,7 @@ class Builder:
         self._verbose = verbose
 
         self.ResetResultSummary(board_selected)
-        builderthread.Mkdir(self.base_dir)
+        builderthread.Mkdir(self.base_dir, parents = True)
         self._PrepareWorkingSpace(min(self.num_threads, len(board_selected)),
                 commits is not None)
         self._PrepareOutputSpace()
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 32297e20e8f0..0cfd7b53f8ac 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -12,14 +12,17 @@ import threading
 import command
 import gitutil
 
-def Mkdir(dirname):
+def Mkdir(dirname, parents = False):
     """Make a directory if it doesn't already exist.
 
     Args:
         dirname: Directory to create
     """
     try:
-        os.mkdir(dirname)
+        if parents:
+            os.makedirs(dirname)
+        else:
+            os.mkdir(dirname)
     except OSError as err:
         if err.errno == errno.EEXIST:
             pass
-- 
2.0.4



More information about the U-Boot mailing list