Skip to contentSkip to conversation

buildman: Create parent directories as necessary

PATCH New Thierry Reding 3 participants 4 messages Aug 19, 2014 – Sep 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 buildman: Create parent directories as necessary

From: Thierry Reding <[email protected]>

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

---
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(-)
tools/buildman/builder.py +1 -1
index d5b8454c0846..1e00a568b144 100644
@@ -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()
tools/buildman/builderthread.py +5 -2
index 32297e20e8f0..0cfd7b53f8ac 100644
@@ -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
Signature · 1 line
2.0.4
#2 lore raw

PATCH v2 1/1 buildman: Create parent directories as necessary

In reply to Thierry Reding
Quoted 7 lines · Thierry Reding

From: Thierry Reding <[email protected]>

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

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140825/549e5e23/attachment.pgp>
#3 lore raw

PATCH v2 1/1 buildman: Create parent directories as necessary

Applied to u-boot-x86/buildman, thanks!