1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 10:50:51 +01:00

target: do not create shutil in package directory

Do not attempt to create shutil from shutil.in inside
PACKAGE_BIN_DIRECTORY as that may not be writable. Instead, create it in
the temporary directory and remove it right after installing.
This commit is contained in:
Sergei Trofimov 2017-12-12 13:36:27 +00:00 committed by marcbonnici
parent 724c0ec8df
commit cafc0a4bc0

View File

@ -650,7 +650,7 @@ 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(PACKAGE_BIN_DIRECTORY, 'scripts', 'shutils') shutils_ofile = os.path.join(tempfile.gettempdir(), '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'
@ -661,7 +661,8 @@ class Target(object):
line = line.replace("__DEVLIB_SHELL__", shell_path) line = line.replace("__DEVLIB_SHELL__", shell_path)
line = line.replace("__DEVLIB_BUSYBOX__", self.busybox) line = line.replace("__DEVLIB_BUSYBOX__", self.busybox)
ofile.write(line) ofile.write(line)
self._shutils = self.install(os.path.join(PACKAGE_BIN_DIRECTORY, 'scripts', 'shutils')) self._shutils = self.install(shutils_ofile)
os.remove(shutils_ofile)
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)