[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 02/12] tests/docker: better handle symlinked libs
From: |
Alex Bennée |
Subject: |
Re: [PATCH v2 02/12] tests/docker: better handle symlinked libs |
Date: |
Fri, 31 Jan 2020 16:48:28 +0000 |
User-agent: |
mu4e 1.3.7; emacs 27.0.60 |
Philippe Mathieu-Daudé <address@hidden> writes:
> On 1/30/20 12:32 PM, Alex Bennée wrote:
>> When we are copying we want to ensure we grab the first
>> resolution (the found in path section). However even that binary might
>> be a symlink so lets make sure we chase the symlinks to copy the right
>> binary to where it can be found.
>> Signed-off-by: Alex Bennée <address@hidden>
>> ---
>> tests/docker/docker.py | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>> diff --git a/tests/docker/docker.py b/tests/docker/docker.py
>> index 31d8adf836..7dfca63fe4 100755
>> --- a/tests/docker/docker.py
>> +++ b/tests/docker/docker.py
>> @@ -109,7 +109,7 @@ def _get_so_libs(executable):
>> ensure theright data is copied."""
>> libs = []
>> - ldd_re = re.compile(r"(/.*/)(\S*)")
>> + ldd_re = re.compile(r"(?:\S+ => )?(\S*) \(:?0x[0-9a-f]+\)")
>> try:
>> ldd_output = subprocess.check_output(["ldd",
>> executable]).decode('utf-8')
>> for line in ldd_output.split("\n"):
>> @@ -145,7 +145,8 @@ def _copy_binary_with_libs(src, bin_dest, dest_dir):
>> if libs:
>> for l in libs:
>> so_path = os.path.dirname(l)
>> - _copy_with_mkdir(l, dest_dir, so_path)
>> + real_l = os.path.realpath(l)
>> + _copy_with_mkdir(real_l, dest_dir, so_path)
>>
>> def _check_binfmt_misc(executable):
>>
>
> Rob raised an issue in this patch, it appears in a separated thread:
> https://www.mail-archive.com/address@hidden/msg675307.html
If fixed it up thusly:
def _get_so_libs(executable):
"""Return a list of libraries associated with an executable.
The paths may be symbolic links which would need to be resolved to
ensure the right data is copied."""
libs = []
ldd_re = re.compile(r"(?:\S+ => )?(\S*) \(:?0x[0-9a-f]+\)")
try:
ldd_output = subprocess.check_output(["ldd",
executable]).decode('utf-8')
for line in ldd_output.split("\n"):
search = ldd_re.search(line)
if search:
try:
libs.append(s.group(1))
except IndexError:
pass
except subprocess.CalledProcessError:
print("%s had no associated libraries (static build?)" % (executable))
return libs
--
Alex Bennée
- [PATCH v2 00/12] testing/next (with build fixes!), Alex Bennée, 2020/01/30
- [PATCH v2 10/12] .travis.yml: move cache flushing to early common phase, Alex Bennée, 2020/01/30
- [PATCH v2 02/12] tests/docker: better handle symlinked libs, Alex Bennée, 2020/01/30
- [PATCH v2 09/12] .travis.yml: build documents under bionic, Alex Bennée, 2020/01/30
- [PATCH v2 05/12] .shippable: --disable-docs for cross-compile tests, Alex Bennée, 2020/01/30
- [PATCH v2 12/12] .travis.yml: limit the arm64 target list, Alex Bennée, 2020/01/30
- [PATCH v2 06/12] hw/hppa/Kconfig: LASI chipset requires PARALLEL port, Alex Bennée, 2020/01/30
- [PATCH v2 07/12] .travis.yml: Drop superfluous use of --python=python3 parameter, Alex Bennée, 2020/01/30