A packaging hook installed via PACKAGEFUNCS may want to access the list
of debug symbol files produced during packaging.

Correctly determining the list of debug files based on existing
variables is non-trivial, so this patch introduces the PKGDEBUGFILES
variable which holds the path to all files generated during stripping.

Signed-off-by: Philip Lorenz <[email protected]>
---
 meta/classes-global/package.bbclass |  4 ++++
 meta/lib/oe/package.py              | 19 ++++++++++---------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/meta/classes-global/package.bbclass 
b/meta/classes-global/package.bbclass
index aa1eb5e901..f2d358459f 100644
--- a/meta/classes-global/package.bbclass
+++ b/meta/classes-global/package.bbclass
@@ -67,6 +67,10 @@ PACKAGE_DEPENDS += "rpm-native dwarfsrcfiles-native"
 # tools at rootfs build time.
 PACKAGE_WRITE_DEPS ??= ""
 
+# List of files containing debug symbols. The paths are rooted at their
+# destination path (e.g. /usr/lib/.debug instead of ${PKGD}/usr/lib/.debug)
+PKGDEBUGFILES = ""
+
 def legitimize_package_name(s):
     return oe.package.legitimize_package_name(s)
 
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 587810bdaf..921a958ed1 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -781,7 +781,7 @@ def splitdebuginfo(file, dvar, dv, d):
     # target system binary, the other contains any debugging information. The
     # two files are linked to reference each other.
     #
-    # return a mapping of files:debugsources
+    # return a mapping of files:debugfile:debugsources
 
     src = file[len(dvar):]
     dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + 
os.path.basename(src) + dv["append"]
@@ -791,7 +791,7 @@ def splitdebuginfo(file, dvar, dv, d):
     if file.endswith(".ko") and file.find("/lib/modules/") != -1:
         if oe.package.is_kernel_module_signed(file):
             bb.debug(1, "Skip strip on signed module %s" % file)
-            return (file, sources)
+            return (file, file, sources)
 
     # Split the file...
     bb.utils.mkdirhier(os.path.dirname(debugfile))
@@ -821,7 +821,7 @@ def splitdebuginfo(file, dvar, dv, d):
     if newmode:
         os.chmod(file, origmode)
 
-    return (file, sources)
+    return (file, debugfile, sources)
 
 def splitstaticdebuginfo(file, dvar, dv, d):
     # Unlike the function above, there is no way to split a static library
@@ -830,7 +830,7 @@ def splitstaticdebuginfo(file, dvar, dv, d):
     # We will then strip (preserving symbols) the static library in the
     # typical location.
     #
-    # return a mapping of files:debugsources
+    # return a mapping of files:debugfile:debugsources
 
     src = file[len(dvar):]
     dest = dv["staticlibdir"] + os.path.dirname(src) + dv["staticdir"] + "/" + 
os.path.basename(src) + dv["staticappend"]
@@ -861,7 +861,7 @@ def splitstaticdebuginfo(file, dvar, dv, d):
     if newmode:
         os.chmod(file, origmode)
 
-    return (file, sources)
+    return (file, debugfile, sources)
 
 def inject_minidebuginfo(file, dvar, dv, d):
     # Extract just the symbols from debuginfo into minidebuginfo,
@@ -1175,13 +1175,14 @@ def process_split_and_strip_files(d):
                 results = oe.utils.multiprocess_launch(splitstaticdebuginfo, 
staticlibs, d, extraargs=(dvar, dv, d))
             else:
                 for file in staticlibs:
-                    results.append( (file,source_info(file, d)) )
+                    results.append( (file,file,source_info(file, d)) )
 
-        d.setVar("PKGDEBUGSOURCES", {strip_pkgd_prefix(f): sorted(s) for f, s 
in results})
+        d.setVar("PKGDEBUGSOURCES", {strip_pkgd_prefix(f): sorted(s) for f, _, 
s in results})
+        d.setVar("PKGDEBUGFILES", [strip_pkgd_prefix(d) for _, d, _ in 
results])
 
         sources = set()
-        for r in results:
-            sources.update(r[1])
+        for _, _, sourcefile in results:
+            sources.update(sourcefile)
 
         # Hardlink our debug symbols to the other hardlink copies
         for ref in inodes:
-- 
2.43.2

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

Reply via email to