| Submitter | Andy Ross |
|---|---|
| Date | Aug. 17, 2012, 3:53 p.m. |
| Message ID | <1345218791-28891-2-git-send-email-andy.ross@windriver.com> |
| Download | mbox | patch |
| Permalink | /patch/34827/ |
| State | New |
| Headers | show |
Comments
On Fri, 2012-08-17 at 08:53 -0700, Andy Ross wrote: > In toolchain edge cases it's possible for the RPATH of a library to be > set to something like "/usr/lib/../lib". This should be detected as > "/usr/lib" and generate a warning. > > Signed-off-by: Andy Ross <andy.ross@windriver.com> > --- > meta/classes/insane.bbclass | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass > index 556a176..b84a89f 100644 > --- a/meta/classes/insane.bbclass > +++ b/meta/classes/insane.bbclass > @@ -161,6 +161,10 @@ def package_qa_check_rpath(file,name, d, elf, messages): > if dir in line: > messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file)) > > +def rpath_eq(a, b): > + import os.path You don't need that import, os is always assumed to be present for our code since it gets used so often. I'd suggest defining this within the package_qa_check_useless_rpaths() function too since its slightly less effort for the parser. Cheers, Richard > + return os.path.normpath(a) == os.path.normpath(b) > + > QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths" > def package_qa_check_useless_rpaths(file, name, d, elf, messages): > """ > @@ -181,7 +185,7 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages): > m = rpath_re.match(line) > if m: > rpath = m.group(1) > - if rpath == libdir or rpath == base_libdir: > + if rpath_eq(rpath, libdir) or rpath_eq(rpath, base_libdir): > # The dynamic linker searches both these places anyway. There is no point in > # looking there again. > messages.append("%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d), rpath))
Patch
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 556a176..b84a89f 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass @@ -161,6 +161,10 @@ def package_qa_check_rpath(file,name, d, elf, messages): if dir in line: messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file)) +def rpath_eq(a, b): + import os.path + return os.path.normpath(a) == os.path.normpath(b) + QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths" def package_qa_check_useless_rpaths(file, name, d, elf, messages): """ @@ -181,7 +185,7 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages): m = rpath_re.match(line) if m: rpath = m.group(1) - if rpath == libdir or rpath == base_libdir: + if rpath_eq(rpath, libdir) or rpath_eq(rpath, base_libdir): # The dynamic linker searches both these places anyway. There is no point in # looking there again. messages.append("%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d), rpath))
In toolchain edge cases it's possible for the RPATH of a library to be set to something like "/usr/lib/../lib". This should be detected as "/usr/lib" and generate a warning. Signed-off-by: Andy Ross <andy.ross@windriver.com> --- meta/classes/insane.bbclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)