<?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>13897</bug_id>
          
          <creation_ts>2020-05-11 09:56:14 +0000</creation_ts>
          <short_desc>POSTINST_INTERCEPTS_DIR broken by undocumented POSTINST_INTERCEPTS_PATHS since thud</short_desc>
          <delta_ts>2022-10-27 15:52:39 +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>oe-core other</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>Backport</status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.2 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yann Dirson">ydirson</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>alex.kanavin</cc>
    
    <cc>kergoth</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>87177</commentid>
    <comment_count>0</comment_count>
    <who name="Yann Dirson">ydirson</who>
    <bug_when>2020-05-11 09:56:14 +0000</bug_when>
    <thetext>In sumo I have an image recipe setting POSTINST_INTERCEPTS_DIR to a custom directory.

Updating to warrior this does not work any more.  What I found out so far:

* POSTINST_INTERCEPTS_PATHS was added before thud in commits 9ba2f2b1d and 7a2044df, but it is still not documented in dunfell, and nothing appears in &quot;moving to thud&quot; either

* &quot;bitbake -e&quot; says POSTINST_INTERCEPTS is set from image-postinst-intercepts.bbclass, but any trace I add there don&apos;t get into the log

* adding traces to PackageManager._initialize_intercepts() confirms it was set previously

Debugging hints appreciated :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87195</commentid>
    <comment_count>1</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2020-05-14 10:24:44 +0000</bug_when>
    <thetext>Can you provide easy steps to reproduce this please?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87207</commentid>
    <comment_count>2</comment_count>
    <who name="Yann Dirson">ydirson</who>
    <bug_when>2020-05-15 08:09:52 +0000</bug_when>
    <thetext>Good point.  In fact with simple variable setting it works (but that&apos;s not a very interesting case, we can do nearly as much already with the default POSTINST_INTERCEPTS_PATHS).

What does not work is setting it from an anonymous python block, which I&apos;m using to set it conditionally.

$ git clone git://git.yoctoproject.org/poky
$ cd poky
$ cp -a scripts/postinst-intercepts/ intercepts-copy

$ cat &gt; ../meta/recipes-core/images/test-image.bb &lt;&lt;EOF
include core-image-minimal.bb
#POSTINST_INTERCEPTS_DIR=&quot;/tmp/poky/intercepts-copy&quot;
python () {
    d.setVar(&apos;POSTINST_INTERCEPTS_DIR&apos;, &quot;/tmp/poky/intercepts-copy&quot;)
}
EOF

$ bitbake test-image -e |&amp; grep ^POSTINST_INTERCEPT|grep -v CHECKSUM
POSTINST_INTERCEPTS=&quot;/tmp/poky/scripts/postinst-intercepts/delay_to_first_boot /tmp/poky/scripts/postinst-intercepts/postinst_intercept /tmp/poky/scripts/postinst-intercepts/update_font_cache /tmp/poky/scripts/postinst-intercepts/update_gio_module_cache /tmp/poky/scripts/postinst-intercepts/update_gtk_immodules_cache /tmp/poky/scripts/postinst-intercepts/update_icon_cache /tmp/poky/scripts/postinst-intercepts/update_pixbuf_cache /tmp/poky/scripts/postinst-intercepts/update_udev_hwdb&quot;
POSTINST_INTERCEPTS_DIR=&quot;/tmp/poky/intercepts-copy&quot;
POSTINST_INTERCEPTS_PATHS=&quot;/tmp/poky/meta-poky/postinst-intercepts:/tmp/poky/build/postinst-intercepts:/tmp/poky/meta/postinst-intercepts:/tmp/poky/meta-yocto-bsp/postinst-intercepts:/tmp/poky/intercepts-copy&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87240</commentid>
    <comment_count>3</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2020-05-19 09:38:21 +0000</bug_when>
    <thetext>Sadly I cannot help you further. This is not a scenario we test or support, so I&apos;d say you have to find out where it breaks yourself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87241</commentid>
    <comment_count>4</comment_count>
    <who name="Yann Dirson">ydirson</who>
    <bug_when>2020-05-19 10:01:50 +0000</bug_when>
    <thetext>I&apos;d be happy to squash this bug, but:

* the lack of doc ot the feature remains
* I&apos;ll need some assistance as to why traces added to image-postinst-intercepts.bbclass don&apos;t show up in the task log</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87464</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-06-11 08:01:48 +0000</bug_when>
    <thetext>Mingli can you work on this for M2?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87906</commentid>
    <comment_count>6</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-08-10 11:20:15 +0000</bug_when>
    <thetext>Mingli had moved this to 3.99 since she&apos;s not able to work on it for 3.2.
I&apos;m moving it back to 3.2-M3 / unassigned in case someone wants to fix it. It seems like a use case that few people trip over so perhaps it should be a lower importance.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89767</commentid>
    <comment_count>7</comment_count>
    <who name="Christopher Larson">kergoth</who>
    <bug_when>2021-03-25 15:34:05 +0000</bug_when>
    <thetext>The issue here is that image-postinst-intercepts uses the variables to set other variables at RecipePreFinalise event, which runs before anonymous python functions do. To set POSTINST_INTERCEPTS_DIR or POSTINST_INTERCEPTS_PATHS programmatically, you&apos;d have to have an event handler of your own which runs before this one (registered before this one, i.e. create your own class and add it to INHERIT), or define it using inline python, i.e. POSTINST_INTERCEPTS_DIR = &quot;${@my_function(d)}&quot;, or copy the event handler from image-postinst-intercepts.bbclass into a function so you can call it directly after you set it in your anonymous python function.

In any case, there&apos;s no real way around this. image-postinst-intercepts has to do this processing at parse time to ensure we track the checksums of the external postinst intercept scripts to ensure the task is re-run when those change or are created, so it cannot be postponed to image creation time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94287</commentid>
    <comment_count>8</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2022-10-27 15:52:39 +0000</bug_when>
    <thetext>As Christopher mentions, we can&apos;t really avoid this. We have to include the checksums of the intercepts in the task hashes for sstate purposes so setting this conditionally from anonymous python isn&apos;t possible,</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>