diff options
author | Peter Kjellerstedt <pkj@axis.com> | 2020-03-20 19:04:20 +0100 |
---|---|---|
committer | Anuj Mittal <anuj.mittal@intel.com> | 2020-06-29 13:51:06 +0800 |
commit | d449e6b536c197b6723dab1d61e989706c14f19c (patch) | |
tree | 4e70418e770a249ac5428e8012190743472c7814 | |
parent | 03248953d1eacede00971289dc9fff8d97d00464 (diff) | |
download | openembedded-core-contrib-d449e6b536c197b6723dab1d61e989706c14f19c.tar.gz |
relocatable.bbclass: Avoid an exception if an empty pkgconfig dir exist
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit f9c5df6dc1c13e9b05ff1b47ad84ad339f6779a4)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-rw-r--r-- | meta/classes/relocatable.bbclass | 20 |
1 files 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 } |