build system: use FileUtils.mkdir_p instead of a mutex for creating directories

No need for a full-blown mutex as `mkdir_p` already handles the
directory existing correctly via catching the corresponding
exception.

See #2194.
This commit is contained in:
Moritz Bunkus 2018-01-13 21:30:34 +01:00
parent 6b43072ed1
commit eebe77f6a3

View File

@ -5,7 +5,6 @@ require "fileutils"
$git_mutex = Mutex.new
$message_mutex = Mutex.new
$dir_mutex = Mutex.new
$action_width = 12
def puts(message)
@ -103,10 +102,8 @@ def runq_git(msg, cmdline, options = {})
end
def ensure_dir dir
$dir_mutex.synchronize {
File.unlink(dir) if FileTest.exist?(dir) && !FileTest.directory?(dir)
Dir.mkdir(dir) if !FileTest.exist?(dir)
}
File.unlink(dir) if FileTest.exist?(dir) && !FileTest.directory?(dir)
FileUtils.mkdir_p(dir)
end
def create_dependency_dirs