All of lore.kernel.org
 help / color / mirror / Atom feed
* [master][zeus][PATCH] relocatable.bbclass: Avoid an exception if an empty pkgconfig dir exist
@ 2020-03-20 18:04 Peter Kjellerstedt
  2020-04-03 16:24 ` [OE-core] " Peter Kjellerstedt
       [not found] ` <16025BE698C394B5.19764@lists.openembedded.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Kjellerstedt @ 2020-03-20 18:04 UTC (permalink / raw)
  To: openembedded-core

Rewrite relocatable_native_pcfiles() so that it can handle that any of
the checked pkgconfig directories are empty without causing an
exception.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/classes/relocatable.bbclass | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/meta/classes/relocatable.bbclass b/meta/classes/relocatable.bbclass
index 582812c1cf..af04be5cca 100644
--- a/meta/classes/relocatable.bbclass
+++ b/meta/classes/relocatable.bbclass
@@ -6,13 +6,15 @@ python relocatable_binaries_preprocess() {
     rpath_replace(d.expand('${SYSROOT_DESTDIR}'), d)
 }
 
-relocatable_native_pcfiles () {
-	if [ -d ${SYSROOT_DESTDIR}${libdir}/pkgconfig ]; then
-		rel=${@os.path.relpath(d.getVar('base_prefix'), d.getVar('libdir') + "/pkgconfig")}
-		sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" ${SYSROOT_DESTDIR}${libdir}/pkgconfig/*.pc
-	fi
-	if [ -d ${SYSROOT_DESTDIR}${datadir}/pkgconfig ]; then
-		rel=${@os.path.relpath(d.getVar('base_prefix'), d.getVar('datadir') + "/pkgconfig")}
-		sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" ${SYSROOT_DESTDIR}${datadir}/pkgconfig/*.pc
-	fi
+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
 }
-- 
2.21.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-09-01 16:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 18:04 [master][zeus][PATCH] relocatable.bbclass: Avoid an exception if an empty pkgconfig dir exist Peter Kjellerstedt
2020-04-03 16:24 ` [OE-core] " Peter Kjellerstedt
     [not found] ` <16025BE698C394B5.19764@lists.openembedded.org>
2020-04-25  9:16   ` Peter Kjellerstedt
     [not found]   ` <16090558444D87E6.18576@lists.openembedded.org>
2020-05-28  1:25     ` Peter Kjellerstedt
     [not found]     ` <16130CCABBD4F064.18282@lists.openembedded.org>
2020-06-12 16:25       ` Peter Kjellerstedt
     [not found]       ` <1617D89C6070B90C.14082@lists.openembedded.org>
2020-06-17  1:50         ` Peter Kjellerstedt
2020-09-01 16:33           ` Andreas Müller
2020-09-01 16:41             ` Andreas Müller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.