<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>4134</bug_id>
          
          <creation_ts>2013-03-27 13:01:58 +0000</creation_ts>
          <short_desc>opkg rebuilds depending on debug-tweaks</short_desc>
          <delta_ts>2013-04-11 16:18:12 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>1.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>4246</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.4 M6</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="Chen Qi">Qi.Chen</assigned_to>
          <cc>bluelightning</cc>
    
    <cc>kai.kang</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>Qi.Chen</cc>
    
    <cc>sgw</cc>
    
    <cc>yi.zhao</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>31237</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2013-03-27 13:01:58 +0000</bug_when>
    <thetext>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 &apos;debug-tweaks package-management ssh-server-dropbear&apos; to &apos;debug-tweaks tools-sdk tools-debug&apos;

Somehow this logging should be configurable without causing the entire package to rebuild.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31257</commentid>
    <comment_count>1</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2013-03-28 08:48:49 +0000</bug_when>
    <thetext>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 &apos;debug-tweaks&apos; 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31258</commentid>
    <comment_count>2</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2013-03-28 08:49:21 +0000</bug_when>
    <thetext>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 ?= &quot;&quot;
 ROOTFS_POSTPROCESS_COMMAND_prepend = &quot;run_intercept_scriptlets; &quot;
 # Allow dropbear/openssh to accept logins from accounts with an empty password string if debug-tweaks is enabled
 ROOTFS_POSTPROCESS_COMMAND += &apos;${@base_contains(&quot;IMAGE_FEATURES&quot;, &quot;debug-tweaks&quot;, &quot;ssh_allow_empty_password; &quot;, &quot;&quot;,d)}&apos;
+# Enable postinst logging if debug-tweaks is enabled
+POSTINSTALL_INITPOSITION ?= &quot;98&quot;
+ROOTFS_POSTPROCESS_COMMAND += &apos;${@base_contains(&quot;IMAGE_FEATURES&quot;, &quot;debug-tweaks&quot;, &quot;run_postinst_enable_logging; &quot;, &quot;&quot;,d)}&apos;
 
 # some default locales
 IMAGE_LINGUAS ?= &quot;de-de fr-fr en-gb&quot;
@@ -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 &apos;1 a\
+LOGGING=yes&apos; ${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 &quot;yes&quot; in image.bbclass if &apos;debug-tweaks&apos; is in IMAGE_FEAUTRES
 POSTLOG ?= &quot;/var/log/postinstall.log&quot;
-REDIRECT_CMD = &quot;${@base_contains(&apos;IMAGE_FEATURES&apos;, &apos;debug-tweaks&apos;, &apos;&gt;${POSTLOG} 2&gt;&amp;1&apos;, &apos;&apos;, d)}&quot;
 
 pkg_postinst_${PN} () {
 #!/bin/sh
@@ -66,7 +67,11 @@ if [ &quot;x$D&quot; != &quot;x&quot; ]; then
 	install -d $D${sysconfdir}/rcS.d
 	# this happens at S98 where our good &apos;ole packages script used to run
 	echo &quot;#!/bin/sh
-opkg-cl configure ${REDIRECT_CMD}
+if [ &quot;\$LOGGING&quot; = &quot;yes&quot; ]; then
+    opkg-cl configure &gt;${POSTLOG} 2&gt;&amp;1
+else
+    opkg-cl configure
+fi
 rm -f /${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
 &quot; &gt; $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
 	chmod 0755 $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
-- 
1.7.5.4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31898</commentid>
    <comment_count>3</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2013-04-11 10:54:16 +0000</bug_when>
    <thetext>I filed bug 4246 about this same issue, except it affects rpm and deb as well. I&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31993</commentid>
    <comment_count>4</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2013-04-11 16:18:12 +0000</bug_when>
    <thetext>I&apos;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 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>