Hi,

I wanted to add sstate cache support to my WIP meta-bbtracer layer and I ran into a problem.

Following the manual (https://docs.yoctoproject.org/singleindex.html#shared-state), I tried to use sstate-plaindirs instead of separate sstate-inputdirs and sstate-outputdirs since I don't actually need to use different directories, but I noticed that artifacts placed in such dirs always get deleted, and the corresponding zst archive in sstate-cache is empty. If I use sstate-inputdirs/outputdirs, it works.

To isolate and reproduce the issue, I set up a dummy yocto layer that just adds a class that adds a task that writes a dummy file after do_unpack: https://github.com/alpianon/meta-sstate-test

The dummy bbclass is:

```
SSTATE_TEST_DIR = "${TMPDIR}/sstate-test/${PN}"
SSTATE_TEST_FILE = "${SSTATE_TEST_DIR}/sstate-test.json"

python do_sstatetest () {
    bb.warn("writing to %s" % d.getVar("SSTATE_TEST_FILE"))
    with open(d.getVar("SSTATE_TEST_FILE"), "w") as f:
        f.write("Hello World!")
}

addtask do_sstatetest after do_unpack before do_patch

SSTATETASKS += "do_sstatetest"
do_sstatetest[sstate-plaindirs] = "${SSTATE_TEST_DIR}"

python do_sstatetest_setscene () {
    sstate_setscene(d)
}

addtask do_sstatetest_setscene

do_sstatetest[dirs] = "${SSTATE_TEST_DIR}"
```

After running `bitbake -c sstatetest <whatever-recipe>`, a sstate-test.json is expected to be found in tmp/sstate-test/<whatever-recipe>, but such dir is empty instead. But if I remove the whole sstate configuration from the above bbclass, the file is there after running the task.

By adding some debug messages to sstate.bbclass, I concluded that the sstate "plaindir" content gets deleted by prepdir() function called within this code in sstate.bbclass: https://git.yoctoproject.org/poky/tree/meta/classes-global/sstate.bbclass#n385 but I don't understand why.

Is that the intended behaviour? Am I missing something?

Thanks
Cheers,

Alberto
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#190586): 
https://lists.openembedded.org/g/openembedded-core/message/190586
Mute This Topic: https://lists.openembedded.org/mt/102602825/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to