
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: '../<branch-name>/boards.cfg
Add a check to the builderthread.Mkdir function to verify that the path it tries to create does not match the current working directory.
Signed-off-by: Lothar Waßmann LW@KARO-electronics.de --- tools/buildman/builderthread.py | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index acaf500..3549029 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -7,6 +7,7 @@ import errno import glob import os import shutil +import sys import threading
import command @@ -27,6 +28,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