All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 4/4] relocatable: add file existence checking in relocatable_native_pcfiles
@ 2019-03-20 11:48 Peter Kjellerstedt
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Kjellerstedt @ 2019-03-20 11:48 UTC (permalink / raw)
  To: Jiang Lu, openembedded-core, richard.purdie

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
> core-bounces@lists.openembedded.org> On Behalf Of Jiang Lu
> Sent: den 20 mars 2019 10:39
> To: lu.jiang@windriver.com; openembedded-core@lists.openembedded.org;
> richard.purdie@linuxfoundation.org
> 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 <lu.jiang@windriver.com>
> ---
>  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



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

* [PATCH 4/4] relocatable: add file existence checking in relocatable_native_pcfiles
  2019-03-20  9:39 [v2] libsoup:add a new routine & build as native package Jiang Lu
@ 2019-03-20  9:39 ` Jiang Lu
  0 siblings, 0 replies; 2+ messages in thread
From: Jiang Lu @ 2019-03-20  9:39 UTC (permalink / raw)
  To: lu.jiang, openembedded-core, richard.purdie

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 <lu.jiang@windriver.com>
---
 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



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

end of thread, other threads:[~2019-03-20 11:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 11:48 [PATCH 4/4] relocatable: add file existence checking in relocatable_native_pcfiles Peter Kjellerstedt
  -- strict thread matches above, loose matches on Subject: below --
2019-03-20  9:39 [v2] libsoup:add a new routine & build as native package Jiang Lu
2019-03-20  9:39 ` [PATCH 4/4] relocatable: add file existence checking in relocatable_native_pcfiles Jiang Lu

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.