From: Thierry Reding <treding@nvidia.com>
Date: Tue, 19 Aug 2014 08:22:39 +0000 (+0200)
Subject: buildman: Create parent directories as necessary
X-Git-Tag: v2025.01-rc5-pxa1908~14702^2~1
X-Git-Url: http://git.dujemihanovic.xyz/img/static/%7B%7B%20%24.Site.BaseURL%20%7D%7Dposts/%7B%7B%20%28.OutputFormats.Get?a=commitdiff_plain;h=f3d015cb4a84e4a7bb37e9963e4e8e97b48b7d68;p=u-boot.git

buildman: Create parent directories as necessary

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@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@ti.com>
---

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 1b6517b488..8155c1681e 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1141,7 +1141,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 261919f127..a9cf68a801 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