Bug 5422

Summary: Stamps not correctly deleted when restoring from sstate on version change
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Paul Eggleton <bluelightning>
Component: coreAssignee: Robert Yang <liezhi.yang>
Status: VERIFIED FIXED QA Contact: Andra Necula <andrax.g.necula>
Severity: normal    
Priority: Medium+ CC: andrax.g.necula, liezhi.yang, meta.mr.watcher, meta.watcher, richard.purdie, sgw
Version: 1.6   
Target Milestone: 1.6 M3   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Paul Eggleton 2013-10-30 14:41:12 UTC
I was switching between dora and master with the same TMPDIR, and I noticed that you can end up with a situation where the system thinks the current version of a recipe's files are in the sysroot but aren't. This is because when the version goes backwards and the sysroot files are restored from shared state the other version's do_populate_sysroot stamp doesn't appear to get deleted, so that when the version goes forward again the sysroot's contents aren't swapped over as they should be.

To reproduce this easily do the following:

(assuming you are initially on master == origin/master)
1. Clear out everything from 5.15:
  bitbake -c cleansstate file-native
2. Revert to 5.14 for the file recipe:
  git revert 8642829d9455738a36fac71c24f0d2b995d288f3
3. Clear out everything from 5.14:
  bitbake -c cleansstate file-native
4. Build 5.14:
  bitbake file-native
5. Build 5.15:
  git checkout origin/master
  bitbake file-native
4. Switch back to 1.14 (which will be restored from sstate, but leaves the stamps for 5.15's do_populate_sysroot behind):
  git checkout master
  bitbake file-native
5. Try to switch back to 5.15 (nothing will actually be done):
  git checkout origin/master
  bitbake file-native
6. Confirm version of file-native installed is actually 5.14 (replacing i686-linux with x86_64-linux on a 64-bit host):
  tmp/sysroots/i686-linux/usr/bin/file --version
Comment 1 Robert Yang 2014-01-14 10:49:14 UTC
The problem is that the sstate_clean() in sstate.bbclass can't clean the old version's stamp, for example, if we have built version 1.0, then build 2.0, it can only remove the 2.0's stamp, we can use the STAMPCLEAN which contains wildcard rather than STAMP in sstate_clean() to remove 1.0's stamp, but it will also remove version .sigdata (should not), we have to do more work on it.
Comment 3 Andra Necula 2014-09-19 08:41:52 UTC
Verified on master  a44006262cf3b810ec78b4cccd8076102a7a0f3e
Host Ubuntu 14.04, x86_64