summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-07 18:40:55 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-10 17:38:31 +0100
commit3ead62a57833e2a3fd25e592a754c3ecfcd77b3a (patch)
tree52e82560ff70c91aad3da1fb3d1df933f70cae84
parentdb788ac702d0f23811470fd93506e938953a1529 (diff)
downloadpoky-3ead62a57833e2a3fd25e592a754c3ecfcd77b3a.tar.gz
package.bbclass: Rewrite shlib_provider handling to include RPATH
Change the do_package shlibs code to account for RPATHS. This means that for library dependency purposes, only libraries in system paths or in any declared RPATH will be seen. This is important to resolve problems people have been having where similarly named libraries in "private" paths were conflicting, e.g. with gstreamer. For now this code assumes the default search path is libdir and base_libdir and places ASSUME_SHLIBS in libdir so they are searched by default. (From OE-Core rev: 48b9ecd5335f63fb2bcc47c4b23d067122734fe9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package.bbclass47
1 files changed, 30 insertions, 17 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index d7de72bda3..988e148893 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1375,7 +1375,9 @@ python package_do_shlibs() {
1375 fd.close() 1375 fd.close()
1376 for l in lines: 1376 for l in lines:
1377 s = l.strip().split(":") 1377 s = l.strip().split(":")
1378 shlib_provider[s[0]] = (dep_pkg, s[2]) 1378 if s[0] not in shlib_provider:
1379 shlib_provider[s[0]] = {}
1380 shlib_provider[s[0]][s[1]] = (dep_pkg, s[2])
1379 1381
1380 def linux_so(file, needed, sonames, renames, pkgver): 1382 def linux_so(file, needed, sonames, renames, pkgver):
1381 needs_ldconfig = False 1383 needs_ldconfig = False
@@ -1518,13 +1520,15 @@ python package_do_shlibs() {
1518 if len(sonames): 1520 if len(sonames):
1519 fd = open(shlibs_file, 'w') 1521 fd = open(shlibs_file, 'w')
1520 for s in sonames: 1522 for s in sonames:
1521 if s[0] in shlib_provider: 1523 if s[0] in shlib_provider and s[1] in shlib_provider[s[0]]:
1522 (old_pkg, old_pkgver) = shlib_provider[s[0]] 1524 (old_pkg, old_pkgver) = shlib_provider[s[0]][s[1]]
1523 if old_pkg != pkg: 1525 if old_pkg != pkg:
1524 bb.warn('%s-%s was registered as shlib provider for %s, changing it to %s-%s because it was built later' % (old_pkg, old_pkgver, s[0], pkg, pkgver)) 1526 bb.warn('%s-%s was registered as shlib provider for %s, changing it to %s-%s because it was built later' % (old_pkg, old_pkgver, s[0], pkg, pkgver))
1525 bb.debug(1, 'registering %s-%s as shlib provider for %s' % (pkg, pkgver, s[0])) 1527 bb.debug(1, 'registering %s-%s as shlib provider for %s' % (pkg, pkgver, s[0]))
1526 fd.write(s[0] + ':' + s[1] + ':' + s[2] + '\n') 1528 fd.write(s[0] + ':' + s[1] + ':' + s[2] + '\n')
1527 shlib_provider[s[0]] = (pkg, pkgver) 1529 if s[0] not in shlib_provider:
1530 shlib_provider[s[0]] = {}
1531 shlib_provider[s[0]][s[1]] = (pkg, pkgver)
1528 fd.close() 1532 fd.close()
1529 if needs_ldconfig and use_ldconfig: 1533 if needs_ldconfig and use_ldconfig:
1530 bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) 1534 bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
@@ -1539,6 +1543,7 @@ python package_do_shlibs() {
1539 1543
1540 assumed_libs = d.getVar('ASSUME_SHLIBS', True) 1544 assumed_libs = d.getVar('ASSUME_SHLIBS', True)
1541 if assumed_libs: 1545 if assumed_libs:
1546 libdir = d.getVar("libdir", True)
1542 for e in assumed_libs.split(): 1547 for e in assumed_libs.split():
1543 l, dep_pkg = e.split(":") 1548 l, dep_pkg = e.split(":")
1544 lib_ver = None 1549 lib_ver = None
@@ -1546,7 +1551,9 @@ python package_do_shlibs() {
1546 if len(dep_pkg) == 2: 1551 if len(dep_pkg) == 2:
1547 lib_ver = dep_pkg[1] 1552 lib_ver = dep_pkg[1]
1548 dep_pkg = dep_pkg[0] 1553 dep_pkg = dep_pkg[0]
1549 shlib_provider[l] = (dep_pkg, lib_ver) 1554 shlib_provider[l][libdir] = (dep_pkg, lib_ver)
1555
1556 libsearchpath = [d.getVar('libdir', True), d.getVar('base_libdir', True)]
1550 1557
1551 for pkg in packages.split(): 1558 for pkg in packages.split():
1552 bb.debug(2, "calculating shlib requirements for %s" % pkg) 1559 bb.debug(2, "calculating shlib requirements for %s" % pkg)
@@ -1562,21 +1569,27 @@ python package_do_shlibs() {
1562 bb.debug(2, '%s: Dependency %s covered by PRIVATE_LIBS' % (pkg, n[0])) 1569 bb.debug(2, '%s: Dependency %s covered by PRIVATE_LIBS' % (pkg, n[0]))
1563 continue 1570 continue
1564 if n[0] in shlib_provider.keys(): 1571 if n[0] in shlib_provider.keys():
1565 (dep_pkg, ver_needed) = shlib_provider[n[0]] 1572 match = None
1573 for p in n[2] + libsearchpath:
1574 if p in shlib_provider[n[0]]:
1575 match = p
1576 break
1577 if match:
1578 (dep_pkg, ver_needed) = shlib_provider[n[0]][match]
1566 1579
1567 bb.debug(2, '%s: Dependency %s requires package %s (used by files: %s)' % (pkg, n[0], dep_pkg, n[1])) 1580 bb.debug(2, '%s: Dependency %s requires package %s (used by files: %s)' % (pkg, n[0], dep_pkg, n[1]))
1568 1581
1569 if dep_pkg == pkg: 1582 if dep_pkg == pkg:
1570 continue 1583 continue
1571 1584
1572 if ver_needed: 1585 if ver_needed:
1573 dep = "%s (>= %s)" % (dep_pkg, ver_needed) 1586 dep = "%s (>= %s)" % (dep_pkg, ver_needed)
1574 else: 1587 else:
1575 dep = dep_pkg 1588 dep = dep_pkg
1576 if not dep in deps: 1589 if not dep in deps:
1577 deps.append(dep) 1590 deps.append(dep)
1578 else: 1591 continue
1579 bb.note("Couldn't find shared library provider for %s, used by files: %s" % (n[0], n[1])) 1592 bb.note("Couldn't find shared library provider for %s, used by files: %s" % (n[0], n[1]))
1580 1593
1581 deps_file = os.path.join(pkgdest, pkg + ".shlibdeps") 1594 deps_file = os.path.join(pkgdest, pkg + ".shlibdeps")
1582 if os.path.exists(deps_file): 1595 if os.path.exists(deps_file):