Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Jiang Lu <lu.jiang@windriver.com>
To: <lu.jiang@windriver.com>,
	<openembedded-core@lists.openembedded.org>,
	<richard.purdie@linuxfoundation.org>
Subject: [PATCH 4/4] relocatable: add file existence checking in relocatable_native_pcfiles
Date: Wed, 20 Mar 2019 17:39:29 +0800	[thread overview]
Message-ID: <20190320093929.28688-5-lu.jiang@windriver.com> (raw)
In-Reply-To: <20190320093929.28688-1-lu.jiang@windriver.com>

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



  parent reply	other threads:[~2019-03-20  9:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20  9:39 [v2] libsoup:add a new routine & build as native package Jiang Lu
2019-03-20  9:39 ` [PATCH 1/4] libsoup:add soup_uri_to_string_with_password Jiang Lu
2019-03-20 10:15   ` Burton, Ross
2019-03-20  9:39 ` [PATCH 2/4] libsoup:enable libsoup build as native package Jiang Lu
2019-03-20 10:15   ` Burton, Ross
2019-03-20  9:39 ` [PATCH 3/4] glib-networking:enable glib-networking " Jiang Lu
2019-03-20 10:19   ` Burton, Ross
2019-03-20 11:03   ` Martin Jansa
2019-03-20 12:03   ` richard.purdie
2019-03-20  9:39 ` Jiang Lu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-03-20 11:48 [PATCH 4/4] relocatable: add file existence checking in relocatable_native_pcfiles Peter Kjellerstedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190320093929.28688-5-lu.jiang@windriver.com \
    --to=lu.jiang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox