Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1]insane.bbclass: add library dir sanity check
@ 2012-09-19  9:32 Radu Moisan
  2012-09-19  9:32 ` [PATCH 1/1] insane.bbclass: " Radu Moisan
  2012-09-21 22:22 ` [PATCH 0/1]insane.bbclass: " Saul Wold
  0 siblings, 2 replies; 4+ messages in thread
From: Radu Moisan @ 2012-09-19  9:32 UTC (permalink / raw)
  To: openembedded-core

    Check in ${PKGD} for libraries in wrong locations.
    Trigger a warning if so.
    Eg. Catch recipe installing /lib/bar.so when ${base_libdir}="lib32"
    or installing in /usr/lib64 when ${libdir}="/usr/lib"

The following changes since commit 7887b99646d8e1e736ad6e4a306e47df9955221e:

  local.conf.sample: change valgrind support architecture comment (2012-09-14 17:05:59 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib rmoisan/tmp1
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=rmoisan/tmp1

Radu Moisan (1):
  insane.bbclass: add library dir sanity check

 meta/classes/insane.bbclass |   39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

-- 
1.7.9.5




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] insane.bbclass: add library dir sanity check
  2012-09-19  9:32 [PATCH 0/1]insane.bbclass: add library dir sanity check Radu Moisan
@ 2012-09-19  9:32 ` Radu Moisan
  2012-09-21 10:19   ` Richard Purdie
  2012-09-21 22:22 ` [PATCH 0/1]insane.bbclass: " Saul Wold
  1 sibling, 1 reply; 4+ messages in thread
From: Radu Moisan @ 2012-09-19  9:32 UTC (permalink / raw)
  To: openembedded-core

Check in ${PKGD} for libraries in wrong locations.
Trigger a warning if so.
Eg. Catch recipe installing /lib/bar.so when ${base_libdir}="lib32"
or installing in /usr/lib64 when ${libdir}="/usr/lib"

[Yocto #2038]

Signed-off-by: Radu Moisan <radu.moisan@intel.com>
---
 meta/classes/insane.bbclass |   39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index e74eb3f..425e93a 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -113,7 +113,7 @@ def package_qa_get_machine_dict():
 
 
 # Currently not being used by default "desktop"
-WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev"
+WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir"
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms"
 
 def package_qa_clean_path(path,d):
@@ -212,6 +212,40 @@ def package_qa_check_staticdev(path, name, d, elf, messages):
         messages.append("non -staticdev package contains static .a library: %s path '%s'" % \
                  (name, package_qa_clean_path(path,d)))
 
+def package_qa_check_libdir(d):
+    """
+    Check for wrong library installation paths. For instance, catch
+    recipes installing /lib/bar.so when ${base_libdir}="lib32" or
+    installing in /usr/lib64 when ${libdir}="/usr/lib"
+    """
+    import re
+
+    pkgd = d.getVar('PKGD', True)
+    base_libdir = d.getVar("base_libdir",True) + os.sep
+    libdir = d.getVar("libdir", True) + os.sep
+    exec_prefix = d.getVar("exec_prefix", True) + os.sep
+
+    messages = []
+    my_files = []
+
+    for root, dirs, files in os.walk(pkgd):
+        for file in files:
+            full_path = os.path.join(root,file)
+            my_files.append(full_path[len(pkgd):])
+
+    lib_re = re.compile("^/lib.*\.so")
+    exec_re = re.compile("^%s.*/lib*.\.so" % exec_prefix)
+
+    for file in my_files:
+        if lib_re.match(file):
+            if base_libdir not in file:
+                messages.append("Found library in wrong location: %s" % file)
+        if exec_re.match(file):
+            if libdir not in file:
+                messages.append("Found library in wrong location: %s" % file)
+    if messages:
+        package_qa_handle_error("libdir", "\n".join(messages), d)
+
 QAPATHTEST[debug-files] = "package_qa_check_dbg"
 def package_qa_check_dbg(path, name, d, elf, messages):
     """
@@ -688,6 +722,9 @@ python do_package_qa () {
             rdepends_sane = False
 
 
+    if 'libdir' in (d.getVar("WARN_QA", True) or "").split():
+        package_qa_check_libdir(d)
+
     if not walk_sane or not rdepends_sane:
         bb.fatal("QA run found fatal errors. Please consider fixing them.")
     bb.note("DONE with PACKAGE QA")
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] insane.bbclass: add library dir sanity check
  2012-09-19  9:32 ` [PATCH 1/1] insane.bbclass: " Radu Moisan
@ 2012-09-21 10:19   ` Richard Purdie
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2012-09-21 10:19 UTC (permalink / raw)
  To: Radu Moisan; +Cc: openembedded-core

On Wed, 2012-09-19 at 12:32 +0300, Radu Moisan wrote:
> Check in ${PKGD} for libraries in wrong locations.
> Trigger a warning if so.
> Eg. Catch recipe installing /lib/bar.so when ${base_libdir}="lib32"
> or installing in /usr/lib64 when ${libdir}="/usr/lib"
> 
> [Yocto #2038]
> 
> Signed-off-by: Radu Moisan <radu.moisan@intel.com>
> ---
>  meta/classes/insane.bbclass |   39 ++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
> index e74eb3f..425e93a 100644
> --- a/meta/classes/insane.bbclass
> +++ b/meta/classes/insane.bbclass
> @@ -113,7 +113,7 @@ def package_qa_get_machine_dict():
>  
> 
>  # Currently not being used by default "desktop"
> -WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev"
> +WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir"
>  ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms"
>  
>  def package_qa_clean_path(path,d):
> @@ -212,6 +212,40 @@ def package_qa_check_staticdev(path, name, d, elf, messages):
>          messages.append("non -staticdev package contains static .a library: %s path '%s'" % \
>                   (name, package_qa_clean_path(path,d)))
>  
> +def package_qa_check_libdir(d):
> +    """
> +    Check for wrong library installation paths. For instance, catch
> +    recipes installing /lib/bar.so when ${base_libdir}="lib32" or
> +    installing in /usr/lib64 when ${libdir}="/usr/lib"
> +    """
> +    import re
> +
> +    pkgd = d.getVar('PKGD', True)
> +    base_libdir = d.getVar("base_libdir",True) + os.sep
> +    libdir = d.getVar("libdir", True) + os.sep
> +    exec_prefix = d.getVar("exec_prefix", True) + os.sep
> +
> +    messages = []
> +    my_files = []
> +
> +    for root, dirs, files in os.walk(pkgd):
> +        for file in files:
> +            full_path = os.path.join(root,file)
> +            my_files.append(full_path[len(pkgd):])
> +
> +    lib_re = re.compile("^/lib.*\.so")
> +    exec_re = re.compile("^%s.*/lib*.\.so" % exec_prefix)
> +
> +    for file in my_files:
> +        if lib_re.match(file):
> +            if base_libdir not in file:
> +                messages.append("Found library in wrong location: %s" % file)
> +        if exec_re.match(file):
> +            if libdir not in file:
> +                messages.append("Found library in wrong location: %s" % file)
> +    if messages:
> +        package_qa_handle_error("libdir", "\n".join(messages), d)
> +
>  QAPATHTEST[debug-files] = "package_qa_check_dbg"
>  def package_qa_check_dbg(path, name, d, elf, messages):
>      """
> @@ -688,6 +722,9 @@ python do_package_qa () {
>              rdepends_sane = False
>  
> 
> +    if 'libdir' in (d.getVar("WARN_QA", True) or "").split():
> +        package_qa_check_libdir(d)


I merged this but added a follow up with one other tweak since this
wouldn't work in the case libdir was in ERROR_QA:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=30b7781650e3ff092d04889beab2e87eaff29cdb

I had some other cleanup in mind so I wrote the patch as that was the
easiest way to explain it :)

Cheers,

Richard




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/1]insane.bbclass: add library dir sanity check
  2012-09-19  9:32 [PATCH 0/1]insane.bbclass: add library dir sanity check Radu Moisan
  2012-09-19  9:32 ` [PATCH 1/1] insane.bbclass: " Radu Moisan
@ 2012-09-21 22:22 ` Saul Wold
  1 sibling, 0 replies; 4+ messages in thread
From: Saul Wold @ 2012-09-21 22:22 UTC (permalink / raw)
  To: Radu Moisan; +Cc: openembedded-core

On 09/19/2012 02:32 AM, Radu Moisan wrote:
>      Check in ${PKGD} for libraries in wrong locations.
>      Trigger a warning if so.
>      Eg. Catch recipe installing /lib/bar.so when ${base_libdir}="lib32"
>      or installing in /usr/lib64 when ${libdir}="/usr/lib"
>
> The following changes since commit 7887b99646d8e1e736ad6e4a306e47df9955221e:
>
>    local.conf.sample: change valgrind support architecture comment (2012-09-14 17:05:59 +0100)
>
> are available in the git repository at:
>
>    git://git.yoctoproject.org/poky-contrib rmoisan/tmp1
>    http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=rmoisan/tmp1
>
> Radu Moisan (1):
>    insane.bbclass: add library dir sanity check
>
>   meta/classes/insane.bbclass |   39 ++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 38 insertions(+), 1 deletion(-)
>

Merged into OE-Core

Thanks
	Sau!




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-21 22:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-19  9:32 [PATCH 0/1]insane.bbclass: add library dir sanity check Radu Moisan
2012-09-19  9:32 ` [PATCH 1/1] insane.bbclass: " Radu Moisan
2012-09-21 10:19   ` Richard Purdie
2012-09-21 22:22 ` [PATCH 0/1]insane.bbclass: " Saul Wold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox