buildman: Create parent directories as necessary
authorThierry Reding <treding@nvidia.com>
Tue, 19 Aug 2014 08:22:39 +0000 (10:22 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 9 Sep 2014 22:38:32 +0000 (16:38 -0600)
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>
tools/buildman/builder.py
tools/buildman/builderthread.py

index 1b6517b48849baa9e8aeda73470dff4f7aae2221..8155c1681eab8191ded875154a2f21c9af83d394 100644 (file)
@@ -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()
index 261919f127fd6a6b22733ab76e7ee41d91d857a0..a9cf68a8016c4ea9c066ea9527986d56f0465266 100644 (file)
@@ -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