Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ross Burton <ross.burton@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] rootfs_ipkg: fix BAD_RECOMMENDATIONS handling
Date: Tue, 19 Feb 2013 21:31:52 +0000	[thread overview]
Message-ID: <1361309512-4367-1-git-send-email-ross.burton@intel.com> (raw)

If multiple versions of the same package are in the package feed then the
generate status file would only contains a "deinstall" status for the last one,
which meant that BAD_RECOMMENDATIONS wouldn't actually work.

Use awk instead of grep and stop reading when we reach a newline, so we only
ever output a single stanza.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/rootfs_ipk.bbclass |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass
index 135bb60..a609944 100644
--- a/meta/classes/rootfs_ipk.bbclass
+++ b/meta/classes/rootfs_ipk.bbclass
@@ -46,9 +46,13 @@ fakeroot rootfs_ipk_do_rootfs () {
 	for i in ${BAD_RECOMMENDATIONS}; do
 		pkginfo="`opkg-cl ${OPKG_ARGS} info $i`"
 		if [ ! -z "$pkginfo" ]; then
-			echo "$pkginfo" | grep -e '^Package:' -e '^Architecture:' -e '^Version:' >> $STATUS
-			echo "Status: deinstall hold not-installed" >> $STATUS
-			echo >> $STATUS
+			# Take just the first package stanza as otherwise only
+			# the last one will have the right Status line.
+			echo "$pkginfo" | awk "/^Package:/ { print } \
+                        		       /^Architecture:/ { print } \
+                        		       /^Version:/ { print } \
+                        		       /^$/ { exit } \
+                        		       END { print \"Status: deinstall hold not-installed\n\" }" - >> $STATUS
 		else
 			echo "Requested ignored recommendation $i is not a package"
 		fi
-- 
1.7.10.4




                 reply	other threads:[~2013-02-19 21:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1361309512-4367-1-git-send-email-ross.burton@intel.com \
    --to=ross.burton@intel.com \
    --cc=openembedded-core@lists.openembedded.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