diff mbox series

[4/6] lib/oe/package: improve regex when looking for libraries

Message ID 20261019145837.2487873-4-ross.burton@arm.com
State New
Headers show
Series [1/6] lib/oe/sstatesig: cache the user/group lookups in OEOuthashBasic | expand

Commit Message

Ross Burton Oct. 19, 2026, 2:58 p.m. UTC
Don't match() on .*\.so as that has false-positives for files named like
"file.something".  Instead, search for ".so" followed by either a dot or
the end of the filename.

Note that in an ideal world we'd reuse the elffiles list, which has
already been populated for the debug stripping. Unfortunately at present
this is not accessible here.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oe/package.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 5938798cef0..8ecb2555f3a 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -1619,7 +1619,7 @@  def process_shlibs(pkgfiles, d):
         bb.note("not generating shlibs")
         return
 
-    lib_re = re.compile(r"^.*\.so")
+    lib_re = re.compile(r"\.so(?:\.|$)")
     libdir_re = re.compile(r".*/%s$" % d.getVar('baselib'))
 
     packages = d.getVar('PACKAGES')
@@ -1780,7 +1780,7 @@  def process_shlibs(pkgfiles, d):
                     darwin_so(file, needed, sonames, pkgver)
                 elif hostos.startswith("mingw"):
                     mingw_dll(file, needed, sonames, pkgver)
-                elif cpath.is_executable(file) or lib_re.match(file):
+                elif cpath.is_executable(file) or lib_re.search(file):
                     linuxlist.append(file)
 
         if linuxlist: