summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-01-16 13:37:53 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-17 16:36:22 +0000
commit7b1896f6f5367010b54c6a8b300db84037734533 (patch)
tree136479153aabb089c0161a5e7260b7d3de85c6b8 /meta/classes
parentd5e1003283f21ed0b3bbe594b24eb4fa1dd27956 (diff)
downloadopenembedded-core-7b1896f6f5367010b54c6a8b300db84037734533.tar.gz
classes/debian: fix library path handling
The existing code is looking for libraries in all paths which end in ${libdir}. This caused false-positives for recipes such as lz4 which had files called /usr/lib/lz4/ptest/usr/lib/liblz4.so, and resulted in lz4-ptest being incorrectly renamed to liblz4. Solve this by explicitly looking for ${libdir} etc under the packages-split directory. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/debian.bbclass26
1 files changed, 16 insertions, 10 deletions
diff --git a/meta/classes/debian.bbclass b/meta/classes/debian.bbclass
index 5cdbf360dc..edc6da1ba3 100644
--- a/meta/classes/debian.bbclass
+++ b/meta/classes/debian.bbclass
@@ -25,12 +25,10 @@ python () {
}
python debian_package_name_hook () {
- import glob, copy, stat, errno, re
+ import glob, copy, stat, errno, re, pathlib
- pkgdest = d.getVar('PKGDEST')
+ pkgdest = d.getVar("PKGDEST")
packages = d.getVar('PACKAGES')
- bin_re = re.compile(".*/s?" + os.path.basename(d.getVar("bindir")) + "$")
- lib_re = re.compile(".*/" + os.path.basename(d.getVar("libdir")) + "$")
so_re = re.compile("lib.*\.so")
def socrunch(s):
@@ -60,17 +58,25 @@ python debian_package_name_hook () {
d.appendVar('RPROVIDES_' + pkg, " " + pkg + " (=" + d.getVar("PKGV") + ")")
def auto_libname(packages, orig_pkg):
+ p = lambda var: pathlib.PurePath(d.getVar(var))
+ libdirs = (p("base_libdir"), p("libdir"))
+ bindirs = (p("base_bindir"), p("base_sbindir"), p("bindir"), p("sbindir"))
+
sonames = []
has_bins = 0
has_libs = 0
- for file in pkgfiles[orig_pkg]:
- root = os.path.dirname(file)
- if bin_re.match(root):
+ for f in pkgfiles[orig_pkg]:
+ # This is .../packages-split/orig_pkg/
+ pkgpath = pathlib.PurePath(pkgdest, orig_pkg)
+ # Strip pkgpath off the full path to a file in the package, re-root
+ # so it is absolute, and then get the parent directory of the file.
+ path = pathlib.PurePath("/") / (pathlib.PurePath(f).relative_to(pkgpath).parent)
+ if path in bindirs:
has_bins = 1
- if lib_re.match(root):
+ if path in libdirs:
has_libs = 1
- if so_re.match(os.path.basename(file)):
- cmd = (d.getVar('TARGET_PREFIX') or "") + "objdump -p " + file + " 2>/dev/null"
+ if so_re.match(os.path.basename(f)):
+ cmd = (d.getVar('TARGET_PREFIX') or "") + "objdump -p " + f + " 2>/dev/null"
fd = os.popen(cmd)
lines = fd.readlines()
fd.close()