<?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>3039</bug_id>
          
          <creation_ts>2012-08-29 16:49:48 +0000</creation_ts>
          <short_desc>Can&apos;t add new tasks to sstate without modifying sstate.bbclass</short_desc>
          <delta_ts>2012-11-13 13:27:47 +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>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>Patch out for review</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.3 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jerrod Peach">peachj</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>corneliux.stoicescu</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</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>24621</commentid>
    <comment_count>0</comment_count>
    <who name="Jerrod Peach">peachj</who>
    <bug_when>2012-08-29 16:49:48 +0000</bug_when>
    <thetext>I tried to add a new task to my task graph, and that task used sstate.  The task was called do_log_srcrev, and I added the following to my bbclass to try to enable sstate:

SSTATETASKS += &quot;do_log_srcrev&quot;
do_log_srcrev[sstate-name] = &quot;log-srcrev&quot;
do_log_srcrev[sstate-inputdirs] = &quot;${SRCREV_WORKDIR}&quot;
do_log_srcrev[sstate-outputdirs] = &quot;${SRCREV_INSTALL_DIR}&quot;

python do_log_srcrev_setscene () {
        sstate_setscene(d)
}
addtask do_log_srcrev_setscene

After I inherited the class and built, I hit a nasty error that ended like this:

 File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;sstate.bbclass&quot;, line 16, in sstate_checkhashes
&lt;omitted mounds of stuff passed to the function&gt;
KeyError: &apos;do_log_srcrev&apos;

I looked over in sstate.bbclass at the top of the sstate_checkhashes() function to find the source of my problem:

       # This needs to go away, FIXME
    mapping = {
        &quot;do_populate_sysroot&quot; : &quot;populate-sysroot&quot;,
        &quot;do_populate_lic&quot; : &quot;populate-lic&quot;,
        &quot;do_package_write_ipk&quot; : &quot;deploy-ipk&quot;,
        &quot;do_package_write_deb&quot; : &quot;deploy-deb&quot;,
        &quot;do_package_write_rpm&quot; : &quot;deploy-rpm&quot;,
        &quot;do_package&quot; : &quot;package&quot;,
        &quot;do_deploy&quot; : &quot;deploy&quot;,
    }

    for task in range(len(sq_fn)):
        sstatefile = d.expand(&quot;${SSTATE_DIR}/&quot; + sq_hashfn[task] + &quot;_&quot; + mapping[sq_task[task]] + &quot;.tgz&quot;)

If I added a mapping for my task, the problem disappeared and everything worked normally.  However, I figure it shouldn&apos;t be necessary to modify the base tools in order to make my task use sstate.  If you git show 35d095c2, you should be able to see how this was added.  Can it be made to go away by using information like the sstate-name?  Without a fix for this, it would seem I&apos;m in a situation where I can&apos;t write custom tasks without maintaining local patches for this, which is something I&apos;m trying to avoid.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24686</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-08-31 00:00:30 +0000</bug_when>
    <thetext>Thanks for the reminder, this does need to go away, as per the comment!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24799</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-09-04 14:36:24 +0000</bug_when>
    <thetext>Fixed in master: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=1c64c6b3002b4a01e590263c730e22c89d869bb7</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25102</commentid>
    <comment_count>3</comment_count>
    <who name="Jerrod Peach">peachj</who>
    <bug_when>2012-09-12 12:27:02 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Fixed in master:
&gt; http://git.yoctoproject.org/cgit.cgi/poky/commit/
&gt; ?id=1c64c6b3002b4a01e590263c730e22c89d869bb7

Not exactly.  As we discussed in the IRC channel &apos;EXTRASSTATEMAPS = &quot;do_deploy:deploy&quot;&apos; should use a &quot;+=&quot; instead of an &quot;=&quot;, at the very least.  Otherwise, there&apos;s no way for me to inherit a task as a part of a package and have the mapping work.  At least this way, I can add more mappings to EXTRASSTATEMAPS.

By the way, the documentation at http://www.yoctoproject.org/docs/current/poky-ref-manual/poky-ref-manual.html#shared-state says I should just be able to add my task to the SSTATETASKS variable within my bbclass file.  Is there any reason that can&apos;t work?   Do we actually need EXTRASSTATEMAPS?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25103</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-09-12 13:27:40 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; Fixed in master:
&gt; &gt; http://git.yoctoproject.org/cgit.cgi/poky/commit/
&gt; &gt; ?id=1c64c6b3002b4a01e590263c730e22c89d869bb7
&gt; 
&gt; Not exactly.  As we discussed in the IRC channel &apos;EXTRASSTATEMAPS =
&gt; &quot;do_deploy:deploy&quot;&apos; should use a &quot;+=&quot; instead of an &quot;=&quot;, at the very least. 
&gt; Otherwise, there&apos;s no way for me to inherit a task as a part of a package
&gt; and have the mapping work.  At least this way, I can add more mappings to
&gt; EXTRASSTATEMAPS.

Fixed in master to use an append: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=5a71f258258d4cfa6730b45f58bfe44888903683

&gt; By the way, the documentation at
&gt; http://www.yoctoproject.org/docs/current/poky-ref-manual/poky-ref-manual.
&gt; html#shared-state says I should just be able to add my task to the
&gt; SSTATETASKS variable within my bbclass file.  Is there any reason that can&apos;t
&gt; work?   Do we actually need EXTRASSTATEMAPS?

As we discussed on IRC, it all worlks fine if your extension applies for all recipes and is included as part of the core config (INHERIT += &quot;xxxx&quot; for example). It the class is only included on a per recipe basis (e.g. inherit deploy), the core cannot know about the specific sstate task but this function does need to know about it. This is when EXTRASSTATEMAPS is needed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27390</commentid>
    <comment_count>5</comment_count>
    <who name="Stoicescu Cornel">corneliux.stoicescu</who>
    <bug_when>2012-11-13 13:27:47 +0000</bug_when>
    <thetext>Verified in master: 7e1e3066e37a458b21294e1f5cfc3ed96efd5c7c</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>