Patchwork [RFC,1/4] package.bbclass: move reading shlibs providers to separate function

login
register
mail settings
Submitter Martin Jansa
Date July 6, 2013, 11:13 p.m.
Message ID <1373152387-19393-1-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/53235/
State New
Headers show

Comments

Martin Jansa - July 6, 2013, 11:13 p.m.
* prepare for reading shlibs providers only from dependency tree of
  current recipe

[YOCTO #4628]

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/classes/package.bbclass | 43 +++++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 20 deletions(-)
Martin Jansa - Aug. 28, 2013, 8:33 a.m.
On Sun, Jul 07, 2013 at 01:13:04AM +0200, Martin Jansa wrote:
> * prepare for reading shlibs providers only from dependency tree of
>   current recipe
> 
> [YOCTO #4628]

Any comment on this patchset?

I'm using first 3 commits for some time in world builds and they helped
me to discover some unexpected shlib providers (and fix them by setting
PRIVATE_LIBS).

> 
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  meta/classes/package.bbclass | 43 +++++++++++++++++++++++--------------------
>  1 file changed, 23 insertions(+), 20 deletions(-)
> 
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index 5c2d1c6..d80535d 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -1337,6 +1337,28 @@ python package_do_shlibs() {
>      # Take shared lock since we're only reading, not writing
>      lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"))
>  
> +    def read_shlib_providers:
> +        list_re = re.compile('^(.*)\.list$')
> +        # Go from least to most specific since the last one found wins
> +        for dir in reversed(shlibs_dirs):
> +            if not os.path.exists(dir):
> +                continue
> +            for file in os.listdir(dir):
> +                m = list_re.match(file)
> +                if m:
> +                    dep_pkg = m.group(1)
> +                    fd = open(os.path.join(dir, file))
> +                    lines = fd.readlines()
> +                    fd.close()
> +                    ver_file = os.path.join(dir, dep_pkg + '.ver')
> +                    lib_ver = None
> +                    if os.path.exists(ver_file):
> +                        fd = open(ver_file)
> +                        lib_ver = fd.readline().rstrip()
> +                        fd.close()
> +                    for l in lines:
> +                        shlib_provider[l.rstrip()] = (dep_pkg, lib_ver)
> +
>      def linux_so(file):
>          needs_ldconfig = False
>          cmd = d.getVar('OBJDUMP', True) + " -p " + pipes.quote(file) + " 2>/dev/null"
> @@ -1479,26 +1501,7 @@ python package_do_shlibs() {
>              postinst += d.getVar('ldconfig_postinst_fragment', True)
>              d.setVar('pkg_postinst_%s' % pkg, postinst)
>  
> -    list_re = re.compile('^(.*)\.list$')
> -    # Go from least to most specific since the last one found wins
> -    for dir in reversed(shlibs_dirs):
> -        if not os.path.exists(dir):
> -            continue
> -        for file in os.listdir(dir):
> -            m = list_re.match(file)
> -            if m:
> -                dep_pkg = m.group(1)
> -                fd = open(os.path.join(dir, file))
> -                lines = fd.readlines()
> -                fd.close()
> -                ver_file = os.path.join(dir, dep_pkg + '.ver')
> -                lib_ver = None
> -                if os.path.exists(ver_file):
> -                    fd = open(ver_file)
> -                    lib_ver = fd.readline().rstrip()
> -                    fd.close()
> -                for l in lines:
> -                    shlib_provider[l.rstrip()] = (dep_pkg, lib_ver)
> +    read_shlib_providers()
>  
>      bb.utils.unlockfile(lf)
>  
> -- 
> 1.8.2.1
>
Richard Purdie - Sept. 2, 2013, 11:19 a.m.
On Wed, 2013-08-28 at 10:33 +0200, Martin Jansa wrote:
> On Sun, Jul 07, 2013 at 01:13:04AM +0200, Martin Jansa wrote:
> > * prepare for reading shlibs providers only from dependency tree of
> >   current recipe
> > 
> > [YOCTO #4628]
> 
> Any comment on this patchset?
> 
> I'm using first 3 commits for some time in world builds and they helped
> me to discover some unexpected shlib providers (and fix them by setting
> PRIVATE_LIBS).

It was sent as an RFC and the last patch was incomplete so it dropped
off the radar :(.

If we remove the "continue" in 2/4 and maintain existing behaviour with
a warning, it would probably seem reasonable. I'll have a further look
at them.

Cheers,

Richard

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 5c2d1c6..d80535d 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1337,6 +1337,28 @@  python package_do_shlibs() {
     # Take shared lock since we're only reading, not writing
     lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"))
 
+    def read_shlib_providers:
+        list_re = re.compile('^(.*)\.list$')
+        # Go from least to most specific since the last one found wins
+        for dir in reversed(shlibs_dirs):
+            if not os.path.exists(dir):
+                continue
+            for file in os.listdir(dir):
+                m = list_re.match(file)
+                if m:
+                    dep_pkg = m.group(1)
+                    fd = open(os.path.join(dir, file))
+                    lines = fd.readlines()
+                    fd.close()
+                    ver_file = os.path.join(dir, dep_pkg + '.ver')
+                    lib_ver = None
+                    if os.path.exists(ver_file):
+                        fd = open(ver_file)
+                        lib_ver = fd.readline().rstrip()
+                        fd.close()
+                    for l in lines:
+                        shlib_provider[l.rstrip()] = (dep_pkg, lib_ver)
+
     def linux_so(file):
         needs_ldconfig = False
         cmd = d.getVar('OBJDUMP', True) + " -p " + pipes.quote(file) + " 2>/dev/null"
@@ -1479,26 +1501,7 @@  python package_do_shlibs() {
             postinst += d.getVar('ldconfig_postinst_fragment', True)
             d.setVar('pkg_postinst_%s' % pkg, postinst)
 
-    list_re = re.compile('^(.*)\.list$')
-    # Go from least to most specific since the last one found wins
-    for dir in reversed(shlibs_dirs):
-        if not os.path.exists(dir):
-            continue
-        for file in os.listdir(dir):
-            m = list_re.match(file)
-            if m:
-                dep_pkg = m.group(1)
-                fd = open(os.path.join(dir, file))
-                lines = fd.readlines()
-                fd.close()
-                ver_file = os.path.join(dir, dep_pkg + '.ver')
-                lib_ver = None
-                if os.path.exists(ver_file):
-                    fd = open(ver_file)
-                    lib_ver = fd.readline().rstrip()
-                    fd.close()
-                for l in lines:
-                    shlib_provider[l.rstrip()] = (dep_pkg, lib_ver)
+    read_shlib_providers()
 
     bb.utils.unlockfile(lf)