<?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>11441</bug_id>
          
          <creation_ts>2017-05-03 08:05:36 +0000</creation_ts>
          <short_desc>archiver.bbclass should not cause kernel rebuilds</short_desc>
          <delta_ts>2017-06-22 08:14:59 +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>deployment</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Patrick Ohly">patrick.ohly</reporter>
          <assigned_to name="Patrick Ohly">patrick.ohly</assigned_to>
          <cc>mikko.ylinen</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</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>72987</commentid>
    <comment_count>0</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-05-03 08:05:36 +0000</bug_when>
    <thetext>When building a kernel-yocto based kernel with INHERIT += &quot;archiver&quot; in local.conf and then without, the kernel gets rebuilt (i.e. do_kernel_configme, do_compile, etc. run again).

This shouldn&apos;t happen because do_kernel_configme will do the exact same thing in both cases, as it doesn&apos;t depend on the archiver.

The root cause is this special code in archiver.bclass:

python () {
    # Add tasks in the correct order, specifically for linux-yocto to avoid race condition
    if bb.data.inherits_class(&apos;kernel-yocto&apos;, d):
        bb.build.addtask(&apos;do_kernel_configme&apos;, &apos;do_configure&apos;, &apos;do_unpack_and_patch&apos;, d)
}

It leads to a sstate signature difference:

$ bitbake-diffsigs 4.9.15+gitAUTOINC+b65e9b6153_6f425e57c6-r0.do_kernel_configme.sigdata.a8d09670469a0547a5e67c51254e05f4 4.9.15+gitAUTOINC+b65e9b6153_6f425e57c6-r0.do_kernel_configme.sigdata.1b4e707e7808e7e5943cbc5a07f76957
runtaskdeps changed:
[&apos;linux/linux-intel_4.9.bb.do_patch&apos;, -linux/linux-intel_4.9.bb.do_unpack_and_patch]
Number of task dependencies changed
Dependency on task linux/linux-intel_4.9.bb.do_unpack_and_patch was removed with hash dd65da57cbdac87149c486bc932263d5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72988</commentid>
    <comment_count>1</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-05-03 08:14:23 +0000</bug_when>
    <thetext>Personally I think that this can only be solved by defining a new &quot;weak dependency&quot; that defines that &quot;if task A is active, it needs to run before task B&quot; without the current semantic that &quot;task B depends on output from task A and thus needs to be re-run when adding/removing/changing task A&quot;.

Such a weak dependency would also help solving some of the issues with do_rm_work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72989</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2017-05-03 08:24:42 +0000</bug_when>
    <thetext>Adding something to the signature code which allowed it to ignore the dependency from a task signature perspective would probably be comparatively straightforward and allow you to solve the rebuild issue.

Note that running the class would still cause the source to be extracted and archived since there is now way to avoid that in order for this task to do its work.

Note that this dependency is technically correct, do_kernel_configme changes ${S} and hence really *must* run after do_unpack_and_patch. Calling this a weak dependency is therefore misleading, there is very much a hard ordering constraint, the issue is more that the task doesn&apos;t affect the data and therefore the other tasks can be reused from sstate safely.

I do also worry that the semantics of this particular issue may not be 100% the same as the weak task ordering issues that rm_work has. There may certainly be similarities but experience in this code says the bar to adding new tasks has to be extremely high and we&apos;d have to have a much more specific definition of how this new task type would have to work before we&apos;d consider doing that.  The code in this area is already complex and potentially problematic so adding changes here for comparatively minor use cases has to be approached with caution.

So my question comes back to whether we really need a way to whitelist a task dependency from the sstate hash instead?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73056</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2017-05-04 15:58:03 +0000</bug_when>
    <thetext>In sstatesig.py:sstate_rundepfilter(), I think you could add something like:

if dataCache and isKernel(depfn) and isKernel(fn) and task == &quot;do_patch&quot; and dep.endswith(&quot;.do_unpack_and_patch&quot;):
    return False

Unfortunately it would have to go right at the top of the function since:

    # Always include our own inter-task dependencies
    if recipename == depname:
        return True

would otherwise trigger.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74455</commentid>
    <comment_count>4</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-06-22 08:14:59 +0000</bug_when>
    <thetext>Merged, fed0ed82928e6a7846fbad233ac657bd17bcefc7 &quot;archiver.bbclass: do not cause kernel rebuilds&quot;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>