Skip to contentSkip to conversation

sstate.bbclass: remove previous version's stamp

PATCH Superseded Robert Yang 2 participants 3 messages Jan 15, 2014

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover sstate.bbclass: remove previous version's stamp

The following changes since commit 12e5a3ee5ef9e6af5ab3dfcbace433888b0914aa:

local.conf.sample.extended: update for the archiver (2014-01-14 18:01:58 +0800)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib rbt/clean_stamp
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/clean_stamp

Robert Yang (1):
sstate.bbclass: remove previous version's stamp

 meta/classes/sstate.bbclass | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 sstate.bbclass: remove previous version's stamp

There is a potential problem if we don't remove the previous version's stamp, for example:

The depend chain is:
libtool-native -> autoconf-native -> m4-native
We have two m4-native: 1.4.9 and 1.4.7

1) Clean all of them to make a fresh build so that we can reproduce the problem

$ bitbake m4-native autoconf-native libtool-native -ccleansstate

2) Build libtool-native so that the m4-native_1.4.17 will be built

$ bitbake libtool-native

3) Set PREFERRED_VERSION_m4-native = "1.4.9" and build again

$ bitbake libtool-native

4) Set PREFERRED_VERSION_m4-native = "1.4.17" and build again

$ bitbake libtool-native -ccleansstate && bitbake libtool-native

Then the build will fail:
[snip]

| m4: unrecognized option '--gnu'
| Try `m4 --help' for more information.
| autom4te: m4 failed with exit status: 1

[snip]

The is because when we change m4-native to 1.4.17 and build libtool-native again:
5) libtool-native depends on autoconf-native, and autoconf-native's version isn't change, so it can remove the current stamp and mirror the sstate (the one depends on m4-native_1.4.9) from the SSTATE_DIR correctly.

6) The mirrored autoconf-native depends on m4-native_1.4.17's do_populate_sysroot, and the stamp is already there (which is made by step 2), so it would do nothing, but this is incorrect, since the one that really in the sysroot is m4-native_1.4.9, then the error happens.

Remove previous version's stamp in sstate_clean() will fix the problem.

[YOCTO #5422]

---
 meta/classes/sstate.bbclass | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
meta/classes/sstate.bbclass +10 -9
index 35c3f85..8802d79 100644
@@ -331,6 +331,8 @@ def sstate_clean_manifest(manifest, d):
 
 def sstate_clean(ss, d):
     import oe.path
+    import glob
+    import re
 
     d2 = d.createCopy()
     extrainf = d.getVarFlag("do_" + ss['task'], 'stamp-extra-info', True)
@@ -350,15 +352,14 @@ def sstate_clean(ss, d):
         for lock in locks:
             bb.utils.unlockfile(lock)
 
-    stfile = d.getVar("STAMP", True) + ".do_" + ss['task']
-    oe.path.remove(stfile)
-    oe.path.remove(stfile + "_setscene")
-    if extrainf:
-        oe.path.remove(stfile + ".*" + extrainf)
-        oe.path.remove(stfile + "_setscene" + ".*" + extrainf)
-    else:
-        oe.path.remove(stfile + ".*")
-        oe.path.remove(stfile + "_setscene" + ".*")
+    stamp_dir = os.path.dirname(d.getVar("STAMP", True))
+    # Remove the current and previous stamps, but keep the sigdata
+    wildcard_stfile = "%s/*.do_%s*" % (stamp_dir, ss['task'])
+    re_stfile_sigdata = "%s/.*\.do_%s\.sigdata\.*" % (stamp_dir, ss['task'])
+    for stfile in glob.glob(wildcard_stfile):
+        # Keep the sigdata
+        if not re.match(re_stfile_sigdata, stfile):
+            oe.path.remove(stfile)
 
 CLEANFUNCS += "sstate_cleanall"
 
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 74 lines · Robert Yang

There is a potential problem if we don't remove the previous version's stamp, for example:

The depend chain is:
libtool-native -> autoconf-native -> m4-native
We have two m4-native: 1.4.9 and 1.4.7

1) Clean all of them to make a fresh build so that we can reproduce the problem

$ bitbake m4-native autoconf-native libtool-native -ccleansstate

2) Build libtool-native so that the m4-native_1.4.17 will be built

$ bitbake libtool-native

3) Set PREFERRED_VERSION_m4-native = "1.4.9" and build again

$ bitbake libtool-native

4) Set PREFERRED_VERSION_m4-native = "1.4.17" and build again

$ bitbake libtool-native -ccleansstate && bitbake libtool-native

Then the build will fail:
[snip]

| m4: unrecognized option '--gnu'
| Try `m4 --help' for more information.
| autom4te: m4 failed with exit status: 1

[snip]

The is because when we change m4-native to 1.4.17 and build libtool-native again:
5) libtool-native depends on autoconf-native, and autoconf-native's version isn't change, so it can remove the current stamp and mirror the sstate (the one depends on m4-native_1.4.9) from the SSTATE_DIR correctly.

6) The mirrored autoconf-native depends on m4-native_1.4.17's do_populate_sysroot, and the stamp is already there (which is made by step 2), so it would do nothing, but this is incorrect, since the one that really in the sysroot is m4-native_1.4.9, then the error happens.

Remove previous version's stamp in sstate_clean() will fix the problem.

[YOCTO #5422]

---
 meta/classes/sstate.bbclass | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
meta/classes/sstate.bbclass +2 -8
index 35c3f85..8802d79 100644
@@ -331,6 +331,8 @@ def sstate_clean_manifest(manifest, d):
 
 def sstate_clean(ss, d):
     import oe.path
+    import glob
+    import re
 
     d2 = d.createCopy()
     extrainf = d.getVarFlag("do_" + ss['task'], 'stamp-extra-info', True)
@@ -350,15 +352,14 @@ def sstate_clean(ss, d):
         for lock in locks:
             bb.utils.unlockfile(lock)
 
-    stfile = d.getVar("STAMP", True) + ".do_" + ss['task']
-    oe.path.remove(stfile)
-    oe.path.remove(stfile + "_setscene")
-    if extrainf:
-        oe.path.remove(stfile + ".*" + extrainf)
-        oe.path.remove(stfile + "_setscene" + ".*" + extrainf)
-    else:
-        oe.path.remove(stfile + ".*")

meta/classes/sstate.bbclass def sstate_clean(ss, d): · line 363

Quoted 10 lines
meta/classes/sstate.bbclass +8 -1
-        oe.path.remove(stfile + "_setscene" + ".*")
+    stamp_dir = os.path.dirname(d.getVar("STAMP", True))
+    # Remove the current and previous stamps, but keep the sigdata
+    wildcard_stfile = "%s/*.do_%s*" % (stamp_dir, ss['task'])
+    re_stfile_sigdata = "%s/.*\.do_%s\.sigdata\.*" % (stamp_dir, ss['task'])
+    for stfile in glob.glob(wildcard_stfile):
+        # Keep the sigdata
+        if not re.match(re_stfile_sigdata, stfile):
+            oe.path.remove(stfile)
 

You can't do this, the extrainf data *is* important since for tasks which are machine specific, you must not trample on another machine's stamp files.

Please use STAMPCLEAN here instead of STAMP, setup an appropriate glob or two glob expressions based on that, search for it, then iterate the result and only delete anything that doesn't have sigdata in it.

Cheers,

Richard