diff mbox series

[3/4] classes/package: use eu-srcfiles instead of dwarfsrcfiles

Message ID 20260924155728.295458-3-ross.burton@arm.com
State New
Headers show
Series [1/4] lib/oe/package: remove unused and optional fatal argument to source_info() | expand

Commit Message

Ross Burton Sept. 24, 2026, 3:57 p.m. UTC
elfutils gained a srcfiles command in 0.190[1], which is essentially the
same as our dwarfsrcfiles.  This obsoletes our dwarfsrcfiles, so change
the packaging class to use it instead of dwarfsrcfiles.

Apart from removing code we need to maintain, eu-srcfiles also has better
output and results in some more source files being identified. Across
a core-image-sato, the following changes occur from more source files
being added to the -src packages:

  curl-src: PKGSIZE changed from 6198005 to 8919864 (+44%)
  flac-src: PKGSIZE changed from 2282162 to 2526447 (+11%)
  libjpeg-turbo-src: PKGSIZE changed from 2673297 to 2977880 (+11%)
  libseccomp-src: PKGSIZE changed from 716039 to 1048204 (+46%)
  sbc-src: PKGSIZE changed from 110274 to 176011 (+60%)

[1] elfutils cb4f0e0f ("PR 30000: debuginfod-find should have a source-list verb")

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-global/package.bbclass |  4 ++--
 meta/lib/oe/package.py              | 28 +++-------------------------
 2 files changed, 5 insertions(+), 27 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass
index e21350a06f4..b54f4c0063a 100644
--- a/meta/classes-global/package.bbclass
+++ b/meta/classes-global/package.bbclass
@@ -57,8 +57,8 @@  LOCALE_SECTION ?= ''
 ALL_MULTILIB_PACKAGE_ARCHS = "${@oe.utils.all_multilib_tune_values(d, 'PACKAGE_ARCHS')}"
 
 # rpm is used for the per-file dependency identification
-# dwarfsrcfiles is used to determine the list of debug source files
-PACKAGE_DEPENDS += "rpm-native dwarfsrcfiles-native"
+# elfutils is used to determine the list of debug source files (eu-srcfiles)
+PACKAGE_DEPENDS += "rpm-native elfutils-native"
 
 # If your postinstall can execute at rootfs creation time rather than on
 # target but depends on a native/cross tool in order to execute, you need to
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 777bf99331c..5d4966be295 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -746,15 +746,6 @@  def package_debug_vars(d):
     return debug_vars
 
 
-def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output):
-    debugfiles = {}
-
-    for line in dwarfsrcfiles_output.splitlines():
-        if line.startswith("\t"):
-            debugfiles[os.path.normpath(line.split()[0])] = ""
-
-    return debugfiles.keys()
-
 def source_info(file, d):
     # Skip static libraries when using Clang toolchain with LTO enabled.
     # In this case, .a files contain LLVM bitcode instead of ELF objects,
@@ -764,22 +755,9 @@  def source_info(file, d):
             bb.debug(1, "Skipping dwarfsrcfiles for Clang LTO archive: %s" % file)
             return []
 
-    cmd = ["dwarfsrcfiles", file]
-    try:
-        output = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT)
-        retval = 0
-    except subprocess.CalledProcessError as exc:
-        output = exc.output
-        retval = exc.returncode
-
-    # 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure
-    if retval != 0 and retval != 255:
-        msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "")
-        bb.fatal(msg)
-
-    debugsources = parse_debugsources_from_dwarfsrcfiles_output(output)
-
-    return list(debugsources)
+    cmd = ["eu-srcfiles", "--null", "--debuginfo-path=/not/exist", "--executable", file]
+    output = subprocess.check_output(cmd, text=True, stderr=subprocess.STDOUT)
+    return output.split("\0")
 
 def splitdebuginfo(file, dvar, dv, d):
     # Function to split a single file into two components, one is the stripped