1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-02-07 13:40:48 +00:00

Target: Generate a new tmp directory when creating shutils

Previously the same temporary directory was used which caused issues
with concurrent runs interfering with each other.
This commit is contained in:
Marc Bonnici 2018-01-18 13:18:27 +00:00 committed by setrofim
parent cc0210af37
commit 2954a73c1c

View File

@ -656,7 +656,8 @@ class Target(object):
def _setup_shutils(self): def _setup_shutils(self):
shutils_ifile = os.path.join(PACKAGE_BIN_DIRECTORY, 'scripts', 'shutils.in') shutils_ifile = os.path.join(PACKAGE_BIN_DIRECTORY, 'scripts', 'shutils.in')
shutils_ofile = os.path.join(tempfile.gettempdir(), 'shutils') tmp_dir = tempfile.mkdtemp()
shutils_ofile = os.path.join(tmp_dir, 'shutils')
shell_path = '/bin/sh' shell_path = '/bin/sh'
if self.os == 'android': if self.os == 'android':
shell_path = '/system/bin/sh' shell_path = '/system/bin/sh'
@ -669,6 +670,7 @@ class Target(object):
ofile.write(line) ofile.write(line)
self._shutils = self.install(shutils_ofile) self._shutils = self.install(shutils_ofile)
os.remove(shutils_ofile) os.remove(shutils_ofile)
os.rmdir(tmp_dir)
def _execute_util(self, command, timeout=None, check_exit_code=True, as_root=False): def _execute_util(self, command, timeout=None, check_exit_code=True, as_root=False):
command = '{} {}'.format(self.shutils, command) command = '{} {}'.format(self.shutils, command)