Patchwork [4/4] rpm-postinsts.bb: enable postinst logging

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date May 16, 2013, 7:56 a.m.
Message ID <f5f342b1188325a222a7e9c776286ea1cef79165.1368690819.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/49985/
State New
Headers show

Comments

Qi.Chen@windriver.com - May 16, 2013, 7:56 a.m.
From: Chen Qi <Qi.Chen@windriver.com>

Enable postinst logging according to the existence of the file
/etc/.enable_postinst_logging.

In this way, the postinst logging is enabled if 'debug-tweaks' is
in IMAGE_FEATURES, and at the same time, we avoid unnecessary rebuild
if IMAGE_FEATURES is changed.

[YOCTO #4262]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-devtools/rpm/rpm-postinsts.bb |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Patch

diff --git a/meta/recipes-devtools/rpm/rpm-postinsts.bb b/meta/recipes-devtools/rpm/rpm-postinsts.bb
index 3d2d05d..ae0e37e 100644
--- a/meta/recipes-devtools/rpm/rpm-postinsts.bb
+++ b/meta/recipes-devtools/rpm/rpm-postinsts.bb
@@ -11,10 +11,6 @@  inherit allarch
 #
 POSTINSTALL_INITPOSITION ?= "98"
 
-POSTLOG ?= "/var/log/postinstall.log"
-REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>>${POSTLOG} 2>&1', '', d)}"
-REDIRECT_CMD[vardepsexclude] += "IMAGE_FEATURES POSTLOG"
-
 do_fetch() {
 	:
 }
@@ -40,7 +36,12 @@  if [ "x$D" != "x" ] && [ -f $D/var/lib/rpm/Packages ]; then
 [ -d /etc/rpm-postinsts ] && for i in `ls /etc/rpm-postinsts/`; do
 	i=/etc/rpm-postinsts/$i
 	echo "Running postinst $i..."
-	if [ -f $i ] && $i ${REDIRECT_CMD}; then
+	if [ -x $i ]; then
+		if [ -e /etc/.enable_postinst_logging ]; then
+			$i >/var/log/postinstall.log 2&>1
+		else
+			$i
+		fi
 		rm $i
 	else
 		echo "ERROR: postinst $i failed."