From 409fc029c407291ac8c8d7fefa051a73912dc657 Mon Sep 17 00:00:00 2001 From: Lothar Waßmann Date: Sun, 8 Apr 2018 05:14:11 -0600 Subject: tools: buildman: Don't use the working dir as build dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the U-Boot base directory happens to have the same name as the branch that buildman is directed to use via the '-b' option and no output directory is specified with '-o', buildman happily starts removing the whole U-Boot sources eventually only stopped with the error message: OSError: [Errno 20] Not a directory: '..//boards.cfg Add a check to avoid this and also deal with the case where '-o' points to the source directory, or any subdirectory of it. Finally, tidy up the confusing logic for removing the old tree when using -b. This is only done when building a branch. Signed-off-by: Lothar Waßmann Signed-off-by: Simon Glass Tested-by: Lothar Waßmann --- tools/buildman/builderthread.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/buildman/builderthread.py') diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index fa9dec043a..0efe80d945 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -6,6 +6,7 @@ import errno import glob import os import shutil +import sys import threading import command @@ -26,6 +27,9 @@ def Mkdir(dirname, parents = False): os.mkdir(dirname) except OSError as err: if err.errno == errno.EEXIST: + if os.path.realpath('.') == os.path.realpath(dirname): + print "Cannot create the current working directory '%s'!" % dirname + sys.exit(1) pass else: raise -- cgit v1.2.3