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 += "do_log_srcrev" do_log_srcrev[sstate-name] = "log-srcrev" do_log_srcrev[sstate-inputdirs] = "${SRCREV_WORKDIR}" do_log_srcrev[sstate-outputdirs] = "${SRCREV_INSTALL_DIR}" 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 "<string>", line 1, in <module> File "sstate.bbclass", line 16, in sstate_checkhashes <omitted mounds of stuff passed to the function> KeyError: 'do_log_srcrev' 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 = { "do_populate_sysroot" : "populate-sysroot", "do_populate_lic" : "populate-lic", "do_package_write_ipk" : "deploy-ipk", "do_package_write_deb" : "deploy-deb", "do_package_write_rpm" : "deploy-rpm", "do_package" : "package", "do_deploy" : "deploy", } for task in range(len(sq_fn)): sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz") If I added a mapping for my task, the problem disappeared and everything worked normally. However, I figure it shouldn'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'm in a situation where I can't write custom tasks without maintaining local patches for this, which is something I'm trying to avoid.
Thanks for the reminder, this does need to go away, as per the comment!
Fixed in master: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=1c64c6b3002b4a01e590263c730e22c89d869bb7
(In reply to comment #2) > Fixed in master: > http://git.yoctoproject.org/cgit.cgi/poky/commit/ > ?id=1c64c6b3002b4a01e590263c730e22c89d869bb7 Not exactly. As we discussed in the IRC channel 'EXTRASSTATEMAPS = "do_deploy:deploy"' should use a "+=" instead of an "=", at the very least. Otherwise, there'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't work? Do we actually need EXTRASSTATEMAPS?
(In reply to comment #3) > (In reply to comment #2) > > Fixed in master: > > http://git.yoctoproject.org/cgit.cgi/poky/commit/ > > ?id=1c64c6b3002b4a01e590263c730e22c89d869bb7 > > Not exactly. As we discussed in the IRC channel 'EXTRASSTATEMAPS = > "do_deploy:deploy"' should use a "+=" instead of an "=", at the very least. > Otherwise, there'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. Fixed in master to use an append: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=5a71f258258d4cfa6730b45f58bfe44888903683 > 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't > 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 += "xxxx" 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.
Verified in master: 7e1e3066e37a458b21294e1f5cfc3ed96efd5c7c