> -----Original Message-----
> From: [email protected] <openembedded-
> [email protected]> On Behalf Of Jiang Lu
> Sent: den 20 mars 2019 10:39
> To: [email protected]; [email protected];
> [email protected]
> Subject: [OE-core] [PATCH 4/4] relocatable: add file existence checking
> in relocatable_native_pcfiles
>
> Some package may create a ${libdir}/pkgconfig directory in its sysroot
> without .pc file. It leads following error:
> sed: can't read ${sysroot}/${libdir}/pkgconfig/*.pc: No such file or
> directory
>
> To avoid this, add a file existence checking in
> relocatable_native_pcfiles()
> before sed.
>
> Signed-off-by: Jiang Lu <[email protected]>
> ---
> meta/classes/relocatable.bbclass | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/relocatable.bbclass
> b/meta/classes/relocatable.bbclass
> index 582812c1cf..eb9989d18c 100644
> --- a/meta/classes/relocatable.bbclass
> +++ b/meta/classes/relocatable.bbclass
> @@ -7,11 +7,13 @@ python relocatable_binaries_preprocess() {
> }
>
> relocatable_native_pcfiles () {
> - if [ -d ${SYSROOT_DESTDIR}${libdir}/pkgconfig ]; then
> + filecnt=`ls -l ${SYSROOT_DESTDIR}${libdir}/pkgconfig/*.pc 2>/dev/null |
> wc -l`
> + if [ $filecnt -gt 0 ]; 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
> + filecnt=`ls -l ${SYSROOT_DESTDIR}${datadir}/pkgconfig/*.pc 2>/dev/null
> | wc -l`
> + if [ $filecnt -gt 0 ]; 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
> --
> 2.17.1
May I suggest the following instead:
relocatable_native_pcfiles () {
files=$(find ${SYSROOT_DESTDIR}${libdir}/pkgconfig -name '*.pc'
2>/dev/null)
if [ "$files" ]; then
rel=${@os.path.relpath(d.getVar('base_prefix'),
d.getVar('libdir') + "/pkgconfig")}
sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" $files
fi
files=$(find ${SYSROOT_DESTDIR}${datadir}/pkgconfig -name '*.pc'
2>/dev/null)
if [ "$files" ]; then
rel=${@os.path.relpath(d.getVar('base_prefix'),
d.getVar('datadir') + "/pkgconfig")}
sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" $files
fi
}
//Peter
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core