package.bbclass: Don't search for providers of PRIVATE_LIBS
authorMartin Jansa <martin.jansa@gmail.com>
Tue, 28 Jan 2014 14:26:10 +0000 (15:26 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 29 Jan 2014 17:38:50 +0000 (17:38 +0000)
* split PRIVATE_LIBS and don't use find(), so that libfoo cannot be
  found in PRIVATE_LIBS = "libfoobar"

(From OE-Core rev: 2dec075478f977b554061dd9a4b2b8ff4af3597a)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/package.bbclass

index 70f9aaa..ed88daf 100644 (file)
@@ -1402,7 +1402,7 @@ python package_do_shlibs() {
                 this_soname = m.group(1)
                 if not this_soname in sonames:
                     # if library is private (only used by package) then do not build shlib for it
-                    if not private_libs or -1 == private_libs.find(this_soname):
+                    if not private_libs or this_soname not in private_libs:
                         sonames.append(this_soname)
                 if libdir_re.match(os.path.dirname(file)):
                     needs_ldconfig = True
@@ -1486,7 +1486,8 @@ python package_do_shlibs() {
     read_shlib_providers()
 
     for pkg in packages.split():
-        private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True) or d.getVar('PRIVATE_LIBS', True)
+        private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True) or d.getVar('PRIVATE_LIBS', True) or ""
+        private_libs = private_libs.split()
         needs_ldconfig = False
         bb.debug(2, "calculating shlib provides for %s" % pkg)
 
@@ -1556,6 +1557,14 @@ python package_do_shlibs() {
 
         deps = list()
         for n in needed[pkg]:
+            # if n is in private libraries, don't try to search provider for it
+            # this could cause problem in case some abc.bb provides private
+            # /opt/abc/lib/libfoo.so.1 and contains /usr/bin/abc depending on system library libfoo.so.1
+            # but skipping it is still better alternative than providing own
+            # version and then adding runtime dependency for the same system library
+            if private_libs and n in private_libs:
+                bb.debug(2, '%s: Dependency %s covered by PRIVATE_LIBS' % (pkg, n))
+                continue
             if n in shlib_provider.keys():
                 (dep_pkg, ver_needed) = shlib_provider[n]