diff mbox series

[1/7] sstate/relocatable: remove manual relocation of .pc files

Message ID 20260320122732.1630715-1-ross.burton@arm.com
State New
Headers show
Series [1/7] sstate/relocatable: remove manual relocation of .pc files | expand

Commit Message

Ross Burton March 20, 2026, 12:27 p.m. UTC
There's no need to manually relocate .pc files in relocatable.bbclass
as the path remapping in sstate.bbclass can do it, if we add .pc to
SSTATE_SCAN_FILES.

This removes some hardcoded behaviour, and puts absolute sysroot paths
into the .pc files instead of paths like ${pcfiledir}/../../include,
which makes it possible for pkgconfig to normalise and strip redundant
paths.

This also has the side effect of not forcibly turning .pc symlinks into
real files, which the sed was doing.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-global/sstate.bbclass |  2 +-
 meta/classes/relocatable.bbclass   | 15 +--------------
 2 files changed, 2 insertions(+), 15 deletions(-)

Comments

Richard Purdie March 20, 2026, 12:48 p.m. UTC | #1
On Fri, 2026-03-20 at 12:27 +0000, Ross Burton via lists.openembedded.org wrote:
> There's no need to manually relocate .pc files in relocatable.bbclass
> as the path remapping in sstate.bbclass can do it, if we add .pc to
> SSTATE_SCAN_FILES.
> 
> This removes some hardcoded behaviour, and puts absolute sysroot paths
> into the .pc files instead of paths like ${pcfiledir}/../../include,
> which makes it possible for pkgconfig to normalise and strip redundant
> paths.
> 
> This also has the side effect of not forcibly turning .pc symlinks into
> real files, which the sed was doing.

Please don't effectively revert https://git.openembedded.org/openembedded-core/commit/meta/classes/relocatable.bbclass?id=a3f4e9ff55c7d9eba175e83eb6c99cf349a74432

The sstate relocation code creates loads of copies of files rather than
allowing us to hardlink them and is bad for performance. By making the
files relocatable, we don't have to do all the fixup handling in that
code and it is generally lower overhead on the system. I think I did
this to stop a lot of sstate objects needing relocations at all.

If there is a symlink issue, we should just make it skip those.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
index 88449d19c7b..3b50985eab1 100644
--- a/meta/classes-global/sstate.bbclass
+++ b/meta/classes-global/sstate.bbclass
@@ -67,7 +67,7 @@  SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/grub-efi"
 SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/systemd-boot"
 SSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_IMAGE}/microcode"
 
-SSTATE_SCAN_FILES ?= "*.la *-config *_config postinst-*"
+SSTATE_SCAN_FILES ?= "*.la *-config *_config postinst-* *.pc"
 SSTATE_SCAN_CMD ??= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES").split())}" \) -type f'
 SSTATE_SCAN_CMD_NATIVE ??= 'grep -Irl -e ${RECIPE_SYSROOT} -e ${RECIPE_SYSROOT_NATIVE} -e ${HOSTTOOLS_DIR} ${SSTATE_BUILDDIR}'
 SSTATE_HASHEQUIV_FILEMAP ?= " \
diff --git a/meta/classes/relocatable.bbclass b/meta/classes/relocatable.bbclass
index d0a623fb0a9..35b2d6ec474 100644
--- a/meta/classes/relocatable.bbclass
+++ b/meta/classes/relocatable.bbclass
@@ -6,21 +6,8 @@ 
 
 inherit chrpath
 
-SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess relocatable_native_pcfiles"
+SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
 
 python relocatable_binaries_preprocess() {
     rpath_replace(d.expand('${SYSROOT_DESTDIR}'), d)
 }
-
-relocatable_native_pcfiles() {
-	for dir in ${libdir}/pkgconfig ${datadir}/pkgconfig; do
-		files_template=${SYSROOT_DESTDIR}$dir/*.pc
-		# Expand to any files matching $files_template
-		files=$(echo $files_template)
-		# $files_template and $files will differ if any files were found
-		if [ "$files_template" != "$files" ]; then
-			rel=$(realpath -m --relative-to=$dir ${base_prefix})
-			sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" $files
-		fi
-	done
-}