Message ID | 20200122102223.20036-3-alex.bennee@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | current testing/next queue | expand |
On 1/22/20 8:22 AM, 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 <alex.bennee@linaro.org> > --- > tests/docker/docker.py | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tests/docker/docker.py b/tests/docker/docker.py > index 31d8adf836..96d4326d53 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*)") > try: > ldd_output = subprocess.check_output(["ldd", executable]).decode('utf-8') > for line in ldd_output.split("\n"): > @@ -145,6 +145,7 @@ def _copy_binary_with_libs(src, bin_dest, dest_dir): > if libs: > for l in libs: > so_path = os.path.dirname(l) > + real_l = os.path.realpath(l) real_l is not used. - Wainer > _copy_with_mkdir(l, dest_dir, so_path) > >
On 1/22/20 2:24 PM, Wainer dos Santos Moschetta wrote: > > On 1/22/20 8:22 AM, 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 <alex.bennee@linaro.org> >> --- >> tests/docker/docker.py | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/tests/docker/docker.py b/tests/docker/docker.py >> index 31d8adf836..96d4326d53 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*)") Why the 'optional space' after "=>"? >> try: >> ldd_output = subprocess.check_output(["ldd", >> executable]).decode('utf-8') >> for line in ldd_output.split("\n"): >> @@ -145,6 +145,7 @@ def _copy_binary_with_libs(src, bin_dest, dest_dir): >> if libs: >> for l in libs: >> so_path = os.path.dirname(l) >> + real_l = os.path.realpath(l) > > real_l is not used. I suppose the idea is to use it as: _copy_with_mkdir(real_l, dest_dir, so_path) > > - Wainer > >> _copy_with_mkdir(l, dest_dir, so_path) >
Philippe Mathieu-Daudé <philmd@redhat.com> writes: > On 1/22/20 2:24 PM, Wainer dos Santos Moschetta wrote: >> On 1/22/20 8:22 AM, 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 <alex.bennee@linaro.org> >>> --- >>> tests/docker/docker.py | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/tests/docker/docker.py b/tests/docker/docker.py >>> index 31d8adf836..96d4326d53 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*)") > > Why the 'optional space' after "=>"? Actually what I want is an optional "=> " > >>> try: >>> ldd_output = subprocess.check_output(["ldd", >>> executable]).decode('utf-8') >>> for line in ldd_output.split("\n"): >>> @@ -145,6 +145,7 @@ def _copy_binary_with_libs(src, bin_dest, dest_dir): >>> if libs: >>> for l in libs: >>> so_path = os.path.dirname(l) >>> + real_l = os.path.realpath(l) >> real_l is not used. > > I suppose the idea is to use it as: > > _copy_with_mkdir(real_l, dest_dir, so_path) Yes - looks like I need to retest. > >> - Wainer >> >>> _copy_with_mkdir(l, dest_dir, so_path) >>
On 1/22/20 4:58 PM, Alex Bennée wrote: > > Philippe Mathieu-Daudé <philmd@redhat.com> writes: > >> On 1/22/20 2:24 PM, Wainer dos Santos Moschetta wrote: >>> On 1/22/20 8:22 AM, 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 <alex.bennee@linaro.org> >>>> --- >>>> tests/docker/docker.py | 3 ++- >>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/tests/docker/docker.py b/tests/docker/docker.py >>>> index 31d8adf836..96d4326d53 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*)") >> >> Why the 'optional space' after "=>"? > > Actually what I want is an optional "=> " Maybe r"(?:\S+ => )?(\S*) \(:?0x[0-9a-f]+\)"? optional non-capturing upto "=> ", capture until space, non-capture address in parenthesis. > >> >>>> try: >>>> ldd_output = subprocess.check_output(["ldd", >>>> executable]).decode('utf-8') >>>> for line in ldd_output.split("\n"): >>>> @@ -145,6 +145,7 @@ def _copy_binary_with_libs(src, bin_dest, dest_dir): >>>> if libs: >>>> for l in libs: >>>> so_path = os.path.dirname(l) >>>> + real_l = os.path.realpath(l) >>> real_l is not used. >> >> I suppose the idea is to use it as: >> >> _copy_with_mkdir(real_l, dest_dir, so_path) > > Yes - looks like I need to retest. > >> >>> - Wainer >>> >>>> _copy_with_mkdir(l, dest_dir, so_path) >>> > >
diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 31d8adf836..96d4326d53 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*)") try: ldd_output = subprocess.check_output(["ldd", executable]).decode('utf-8') for line in ldd_output.split("\n"): @@ -145,6 +145,7 @@ def _copy_binary_with_libs(src, bin_dest, dest_dir): if libs: for l in libs: so_path = os.path.dirname(l) + real_l = os.path.realpath(l) _copy_with_mkdir(l, dest_dir, so_path)
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 <alex.bennee@linaro.org> --- tests/docker/docker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)