Bug 4134 - opkg rebuilds depending on debug-tweaks
Summary: opkg rebuilds depending on debug-tweaks
Status: RESOLVED DUPLICATE of bug 4246
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.4
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.4 M6
Assignee: Chen Qi
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-03-27 13:01 UTC by Ross Burton
Modified: 2013-04-11 16:18 UTC (History)
8 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2013-03-27 13:01:58 UTC
The logging of postinstall output is useful but the current implementation means it rebuilds when IMAGE_FEATURES changes.

$ difftreesigs  /data/poky-master/tmp/stamps/core2-poky-linux/ /data/nightly-build-ftM/build/tmp/stamps/core2-poky-linux/ opkg do_package
basehash changed from cdc2d7d582aefcf6b603be264cea3f25 to dbdef0c9d6b6cc1d86c59efc9e75265b
Variable EXTRA_IMAGE_FEATURES value changed from 'debug-tweaks package-management ssh-server-dropbear' to 'debug-tweaks tools-sdk tools-debug'

Somehow this logging should be configurable without causing the entire package to rebuild.
Comment 1 Chen Qi 2013-03-28 08:48:49 UTC
I think dpkg and rpm may have the same problem, as they both use IMAGE_FEATURES in their recipes.

Also, checking IMAGE_FEATURES in a .bb file seems inappropriate. If 'debug-tweaks' is specified in a image recipe instead of a .conf file, the logging is disabled.

I suggest tweaking the run-postinst in image.bbclass.
Below is a proof-of-concept patch.

Is this approach appropriate?

//Chen Qi
Comment 2 Chen Qi 2013-03-28 08:49:21 UTC
Subject: [PATCH] opkg: make opkg unrelated to IMAGE_FEATURES

---
 meta/classes/image.bbclass          |   11 +++++++++++
 meta/recipes-devtools/opkg/opkg.inc |    9 +++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 9721a6b..07e79be 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -159,6 +159,9 @@ MACHINE_POSTPROCESS_COMMAND ?= ""
 ROOTFS_POSTPROCESS_COMMAND_prepend = "run_intercept_scriptlets; "
 # Allow dropbear/openssh to accept logins from accounts with an empty password string if debug-tweaks is enabled
 ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "ssh_allow_empty_password; ", "",d)}'
+# Enable postinst logging if debug-tweaks is enabled
+POSTINSTALL_INITPOSITION ?= "98"
+ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "run_postinst_enable_logging; ", "",d)}'
 
 # some default locales
 IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
@@ -458,6 +461,14 @@ ssh_allow_empty_password () {
 	fi
 }
 
+# Enable postinst logging if debug-tweaks is enabled
+run_postinst_enable_logging () {
+	if [ -e ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts ]; then
+		sed -i '1 a\
+LOGGING=yes' ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
+	fi
+}
+
 # Turn any symbolic /sbin/init link into a file
 remove_init_link () {
 	if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
diff --git a/meta/recipes-devtools/opkg/opkg.inc b/meta/recipes-devtools/opkg/opkg.inc
index f9c1202..ff13b22 100644
--- a/meta/recipes-devtools/opkg/opkg.inc
+++ b/meta/recipes-devtools/opkg/opkg.inc
@@ -57,8 +57,9 @@ do_install_append_class-native() {
 	fi
 }
 
+# postinst logging configuration
+# LOGGING is set to "yes" in image.bbclass if 'debug-tweaks' is in IMAGE_FEAUTRES
 POSTLOG ?= "/var/log/postinstall.log"
-REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>${POSTLOG} 2>&1', '', d)}"
 
 pkg_postinst_${PN} () {
 #!/bin/sh
@@ -66,7 +67,11 @@ if [ "x$D" != "x" ]; then
 	install -d $D${sysconfdir}/rcS.d
 	# this happens at S98 where our good 'ole packages script used to run
 	echo "#!/bin/sh
-opkg-cl configure ${REDIRECT_CMD}
+if [ "\$LOGGING" = "yes" ]; then
+    opkg-cl configure >${POSTLOG} 2>&1
+else
+    opkg-cl configure
+fi
 rm -f /${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
 " > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
 	chmod 0755 $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
-- 
1.7.5.4
Comment 3 Paul Eggleton 2013-04-11 10:54:16 UTC
I filed bug 4246 about this same issue, except it affects rpm and deb as well. I'm working on a quick fix for the release (remove the variable dependencies); for 1.5 we need to come up with a different implementation.
Comment 4 Paul Eggleton 2013-04-11 16:18:12 UTC
I'm marking this as a duplicate of bug 4246 since there is more info there (and a patch has been merged to fix the issue for all package management backends). I have also opened bug 4262 to improve the implementation of the postinstall log capturing for 1.5.

*** This bug has been marked as a duplicate of bug 4246 ***