[OE-core] [PATCH 9/9] sstatesig: incremental dump lockedsigs

Hongxu Jia hongxu.jia at windriver.com
Wed Sep 17 08:08:33 UTC 2014


The idea of incremental sig is:

New sig file = Old sig file (if available) + New sig items in current build.

Limit the modification within the dump_lockedsigs, and add two variables
'self.lockedsigs_types' and 'self.lockedsigs_raw' keep old sig file.

How to config for incremental dump:
...
USER_CLASSES += "sstate_lockedsig"
SIGGEN_LOCKEDSIGS_CONFIG = "${TOPDIR}/locked-sigs.inc"
require ${SIGGEN_LOCKEDSIGS_CONFIG}
...

Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
---
 meta/lib/oe/sstatesig.py | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index af7617e..d8cd8e6 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -93,6 +93,10 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
         self.lockedhashfn = {}
         self.machine = data.getVar("MACHINE", True)
         self.mismatch_msgs = []
+        self.lockedsigs_types = (data.getVar("SIGGEN_LOCKEDSIGS_TYPES", True) or "").split()
+        self.lockedsigs_raw = {}
+        for t in self.lockedsigs_types:
+            self.lockedsigs_raw[t] = (data.getVar("SIGGEN_LOCKEDSIGS_%s" % t, True) or "").split()
         pass
     def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None):
         return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCache)
@@ -142,28 +146,29 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
             sigfile = os.getcwd() + "/locked-sigs.inc"
 
         bb.plain("Writing locked sigs to %s" % sigfile)
-        types = {}
         for k in self.runtaskdeps:
             fn = k.rsplit(".",1)[0]
             t = self.lockedhashfn[fn].split(" ")[1].split(":")[5]
             t = 't-' + t.replace('_', '-')
-            if t not in types:
-                types[t] = []
-            types[t].append(k)
+            if t not in self.lockedsigs_types:
+                self.lockedsigs_types.append(t)
+                self.lockedsigs_raw[t] = []
+
+            pn = self.lockedpnmap[fn]
+            task = k.rsplit(".",1)[1]
+            hash = self.taskhash[k]
+            lockedsig = "%s:%s:%s" % (pn, task, hash)
+            if lockedsig not in self.lockedsigs_raw[t]:
+                self.lockedsigs_raw[t].append(lockedsig)
 
         with open(sigfile, "w") as f:
-            for t in types:
+            for t in sorted(self.lockedsigs_types):
                 f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % t)
-                types[t].sort()
-                sortedk = sorted(types[t], key=lambda k: self.lockedpnmap[k.rsplit(".",1)[0]])
-                for k in sortedk:
-                    fn = k.rsplit(".",1)[0]
-                    task = k.rsplit(".",1)[1]
-                    if k not in self.taskhash:
-                        continue
-                    f.write("    " + self.lockedpnmap[fn] + ":" + task + ":" + self.taskhash[k] + " \\\n")
+                for ls in sorted(self.lockedsigs_raw[t]):
+                    f.write("    " + ls + " \\\n")
                 f.write('    "\n')
-            f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(types.keys())))
+            f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' %
+                    (self.machine, " ".join(sorted(self.lockedsigs_types))))
 
     def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d):
         checklevel = d.getVar("SIGGEN_LOCKEDSIGS_CHECK_LEVEL", True)
-- 
1.9.1




More information about the Openembedded-core mailing list