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.
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
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
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.
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 ***