From: Dan McGregor <[email protected]>

Ignore shared object names that differ from names we've already
processed only by their version number. This assumes that the
highest priority is first in the list, and ignores those later
in the list if we've alredy found one.

I saw this with the qrencode PACKAGECONFIG enabled. Its note lists
both libqrencode.so.4 and libqrencode.so.3, which led to a packaging
warning.

Signed-off-by: Dan McGregor <[email protected]>
---
 meta/recipes-core/systemd/dlopen-deps.inc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/systemd/dlopen-deps.inc 
b/meta/recipes-core/systemd/dlopen-deps.inc
index e0b333398c2..18768d43491 100644
--- a/meta/recipes-core/systemd/dlopen-deps.inc
+++ b/meta/recipes-core/systemd/dlopen-deps.inc
@@ -3,7 +3,7 @@ PACKAGEFUNCS =+ "package_generate_dlopen_deps"
 python package_generate_dlopen_deps() {
     # https://systemd.io/ELF_DLOPEN_METADATA/
 
-    import struct, json
+    import struct, json, re
 
     def extract_segment(filename, segment):
         """
@@ -66,14 +66,18 @@ python package_generate_dlopen_deps() {
                     elf = oe.qa.ELFFile(f)
                     elf.open()
                     for dep in parse(extract_segment(f, ".note.dlopen"), 
elf.isLittleEndian()):
+                        # Ignore sonames if a higher priority version is found
+                        seen_sonames = []
                         for soname in dep["soname"]:
+                            base_soname = re.sub(r'\.so($|\..*$)', '', soname)
                             if soname in shlibs:
                                 # TODO assumes the first match is good
                                 package, version = 
list(shlibs[soname].values())[0]
                                 dependency = dep_map[dep["priority"]]
                                 bb.note(f"{pkg}: adding {dependency} on 
{package} via .note.dlopen")
                                 d.appendVar(f"{dependency}:{pkg}", f" 
{package} (>= {version})")
-                            else:
+                                seen_sonames.append(base_soname)
+                            elif base_soname not in seen_sonames:
                                 bb.warn(f"cannot find {soname}")
                 except oe.qa.NotELFFileError as e:
                     bb.note(f"Cannot extract ELF notes: {e}")
-- 
2.47.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#207790): 
https://lists.openembedded.org/g/openembedded-core/message/207790
Mute This Topic: https://lists.openembedded.org/mt/109773301/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to