<?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>12862</bug_id>
          
          <creation_ts>2018-07-25 13:29:35 +0000</creation_ts>
          <short_desc>do_package_setscene is unwillingly skipped</short_desc>
          <delta_ts>2026-03-11 21:25:01 +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>2.5.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>  </status_whiteboard>
          <keywords></keywords>
          <priority>Low</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dmitry">d-bazhenov</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>mark.asselstine</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>New (Never tested)</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>81178</commentid>
    <comment_count>0</comment_count>
      <attachid>4350</attachid>
    <who name="Dmitry">d-bazhenov</who>
    <bug_when>2018-07-25 13:29:35 +0000</bug_when>
    <thetext>Created attachment 4350
bug-fix

Hi everyone,

do_package_setscene task can be unwillingly skipped in some situations.
One such situation is to restore recipe to a previous state for which the recipe has built results stored in the shared state.
    
When do_package_setscene is skipped, the recipe&apos;s packages-split directory is not updated accordingly to the stored state and its contents become out of sync.

How to reproduce:
1. Make a recipe which installs files &apos;a&apos; and &apos;b&apos; and produces a package &apos;ab&apos; which would contain both files.
2. Build the recipe.
3. Change the recipe to produce two packages &apos;a&apos; and &apos;b&apos; each containing a single file.
4. Build the recipe.
5. Restore original recipe (as in #1)
6. Build the recipe
7. Check ${workdir}/packages-split directory. There will still be two sub-directories for packages &apos;a&apos; and &apos;b&apos;.
    
I was able to fix this bug by making a direct reference from do_build to do_package. This made do_package_setscene task &apos;unskippable&apos; from the bitbake point of view.

The attached patch fixes the bug. Please review.

Best regards,
Dmitry Bazhenov</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81181</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2018-07-25 22:11:56 +0000</bug_when>
    <thetext>I&apos;m not sure this is a bug since if anything actually depends on do_package, it would restore the correct artifact from sstate before allowing anything depending upon it to run.

What problem is this causing other than some slightly stale data in a work directory? I suspect your patch will break assumptions made by rm_work.bbclass that the package task is removable and it will also cause builds from sstate to install much more data than they need to.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81182</commentid>
    <comment_count>2</comment_count>
    <who name="Dmitry">d-bazhenov</who>
    <bug_when>2018-07-26 04:37:38 +0000</bug_when>
    <thetext>Hi Richard,

As I understand package tasks are removed in rm_work.bbclass entirely.
When removing, bitbake updates dependencies for the remaining tasks, so no harm is made with adding a direct reference in this regard.

As for populating packages-split directory via do_package_setscene. It is the only task which is not run while do_packagedata_setscene and do_package_write_rpm are actually run restoring both the recipe-specific files and project-wise build artifacts. And the two latter tasks have more files to restore than do_package_setscene, so you shouldn&apos;t even notice much change. Especially because the typical usage scenario for this is when you restore a state of a single recipe or a group of recipes, but not the whole distribution.

The stale data in the packages-split directory is misleading in understanding if everything is okay with the build, because there are discrepancies between split package data and generated packages.

For example I can&apos;t be sure the configuration option which I introduced for my recipe to change the package generation (bundled package or a set of packages) works okay seeing that the packages-split directory contents do not coordinate with the option value.

So even though the issue does not affect the finally built packages I still believe it is a bug.

Regards,
Dmitry</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81189</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2018-07-26 14:49:21 +0000</bug_when>
    <thetext>We very nearly closed this as WONTFIX, instead I&apos;ve left it as a low future, unassigned. The proposed fix will break rm_work and cause lots of extra sstate to be downloaded and unpacked even when it isn&apos;t used.

I do agree there is a usability issue here. I&apos;m not sure how we&apos;d fix it though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86562</commentid>
    <comment_count>4</comment_count>
    <who name="Mark">mark.asselstine</who>
    <bug_when>2020-02-22 18:36:11 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; We very nearly closed this as WONTFIX, instead I&apos;ve left it as a low future,
&gt; unassigned. The proposed fix will break rm_work and cause lots of extra
&gt; sstate to be downloaded and unpacked even when it isn&apos;t used.
&gt; 
&gt; I do agree there is a usability issue here. I&apos;m not sure how we&apos;d fix it
&gt; though.

Rather than the approach of attempting to make the packages-split be properly sync&apos;d with the state of the world to solve this, would it not be equally valid to assume it may be out of sync and thus just remove it.

Thus, would removing the packages-split directory when SSTATETASKS doesn&apos;t include do_package_setscene be an option?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86563</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-02-23 11:15:15 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; We very nearly closed this as WONTFIX, instead I&apos;ve left it as a low future,
&gt; &gt; unassigned. The proposed fix will break rm_work and cause lots of extra
&gt; &gt; sstate to be downloaded and unpacked even when it isn&apos;t used.
&gt; &gt; 
&gt; &gt; I do agree there is a usability issue here. I&apos;m not sure how we&apos;d fix it
&gt; &gt; though.
&gt; 
&gt; Rather than the approach of attempting to make the packages-split be
&gt; properly sync&apos;d with the state of the world to solve this, would it not be
&gt; equally valid to assume it may be out of sync and thus just remove it.

Yes, removing it would be better. The question is when to remove it and how to know when to do that.
 
&gt; Thus, would removing the packages-split directory when SSTATETASKS doesn&apos;t
&gt; include do_package_setscene be an option?

SSTATETASKS is a fixed value, it doesn&apos;t dynamically change depending on system state unfortunately.

My big worry with this bug is making things even more complex and fragile with the solution being worse than the original problem :(.

There is code already there to remove conflicting/skipped recipes. We probably need to extend that to include sstate tasks which no longer match their hashes.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4350</attachid>
            <date>2018-07-25 13:29:35 +0000</date>
            <delta_ts>2018-07-25 13:29:35 +0000</delta_ts>
            <desc>bug-fix</desc>
            <filename>0001-classes-package-add-direct-build-dependency-on-do_pa.patch</filename>
            <type>text/plain</type>
            <size>1483</size>
            <attacher name="Dmitry">d-bazhenov</attacher>
            
              <data encoding="base64">RnJvbSA0OWFiOTg3MTAyNDdiZWEwZjFlY2Y4YjU4MWNiODgzZmM4OGUzN2U1IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBEbWl0cnkgQmF6aGVub3YgPGRtaXRyeS5iYXpoZW5vdkBhdXJp
Z2EuY29tPgpEYXRlOiBXZWQsIDI1IEp1bCAyMDE4IDE3OjI0OjU4ICswNTAwClN1YmplY3Q6IFtQ
QVRDSF0gY2xhc3Nlcy9wYWNrYWdlOiBhZGQgZGlyZWN0IGJ1aWxkIGRlcGVuZGVuY3kgb24gZG9f
cGFja2FnZQoKZG9fcGFja2FnZV9zZXRzY2VuZSB0YXNrIGNhbiBiZSB1bndpbGxpbmdseSBza2lw
cGVkIGluIHNvbWUKc2l0dWF0aW9ucy4gQSBrbm93biBzaXR1YXRpb24gaXMgdG8gcmVzdG9yZSBy
ZWNpcGUgdG8gYSBwcmV2aW91cwpzdGF0ZSBmb3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