diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-09-05 11:55:18 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-09-17 22:00:25 +0100 |
commit | a08d7dc9b2aca452b61ef8d1215aaf2497396e27 (patch) | |
tree | 87f2d24c764fb4d438538eaa45ff95582ca33e3a /meta/lib/oe | |
parent | c5cc4993f0555d3fc7a7aa5a471ec2b8e940dec6 (diff) | |
download | poky-a08d7dc9b2aca452b61ef8d1215aaf2497396e27.tar.gz |
sstatesig: Improve to handle locking of multiple machines
Instead of a single monolithic SIGGEN_LOCKEDSIGS, split this into
separate variables, one per sstate package architecture. Add in
a new SIGGEN_LOCKEDSIGS_TYPES variable which lists the package
architectures to load in.
SIGGEN_LOCKEDSIGS_TYPES is made machine specific using overrides.
Also sort the hashes in the lists by PN to make diffing them easier.
(From OE-Core rev: d8b0ce35981931a39e7db9d8e78de6e009b34688)
(From OE-Core rev: b42f305ce38b9e0f1a2b7cb9586bbabcd2d27429)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/sstatesig.py | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py index 7b860c5b0d..add26193bc 100644 --- a/meta/lib/oe/sstatesig.py +++ b/meta/lib/oe/sstatesig.py | |||
@@ -63,12 +63,14 @@ def sstate_rundepfilter(siggen, fn, recipename, task, dep, depname, dataCache): | |||
63 | 63 | ||
64 | def sstate_lockedsigs(d): | 64 | def sstate_lockedsigs(d): |
65 | sigs = {} | 65 | sigs = {} |
66 | lockedsigs = (d.getVar("SIGGEN_LOCKEDSIGS", True) or "").split() | 66 | types = (d.getVar("SIGGEN_LOCKEDSIGS_TYPES", True) or "").split() |
67 | for ls in lockedsigs: | 67 | for t in types: |
68 | pn, task, h = ls.split(":", 2) | 68 | lockedsigs = (d.getVar("SIGGEN_LOCKEDSIGS_%s" % t, True) or "").split() |
69 | if pn not in sigs: | 69 | for ls in lockedsigs: |
70 | sigs[pn] = {} | 70 | pn, task, h = ls.split(":", 2) |
71 | sigs[pn][task] = h | 71 | if pn not in sigs: |
72 | sigs[pn] = {} | ||
73 | sigs[pn][task] = h | ||
72 | return sigs | 74 | return sigs |
73 | 75 | ||
74 | class SignatureGeneratorOEBasic(bb.siggen.SignatureGeneratorBasic): | 76 | class SignatureGeneratorOEBasic(bb.siggen.SignatureGeneratorBasic): |
@@ -88,16 +90,18 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash): | |||
88 | self.lockedsigs = sstate_lockedsigs(data) | 90 | self.lockedsigs = sstate_lockedsigs(data) |
89 | self.lockedhashes = {} | 91 | self.lockedhashes = {} |
90 | self.lockedpnmap = {} | 92 | self.lockedpnmap = {} |
93 | self.lockedhashfn = {} | ||
94 | self.machine = data.getVar("MACHINE", True) | ||
91 | pass | 95 | pass |
92 | def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None): | 96 | def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None): |
93 | return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCache) | 97 | return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCache) |
94 | 98 | ||
95 | def get_taskdata(self): | 99 | def get_taskdata(self): |
96 | data = super(bb.siggen.SignatureGeneratorBasicHash, self).get_taskdata() | 100 | data = super(bb.siggen.SignatureGeneratorBasicHash, self).get_taskdata() |
97 | return (data, self.lockedpnmap) | 101 | return (data, self.lockedpnmap, self.lockedhashfn) |
98 | 102 | ||
99 | def set_taskdata(self, data): | 103 | def set_taskdata(self, data): |
100 | coredata, self.lockedpnmap = data | 104 | coredata, self.lockedpnmap, self.lockedhashfn = data |
101 | super(bb.siggen.SignatureGeneratorBasicHash, self).set_taskdata(coredata) | 105 | super(bb.siggen.SignatureGeneratorBasicHash, self).set_taskdata(coredata) |
102 | 106 | ||
103 | def dump_sigs(self, dataCache, options): | 107 | def dump_sigs(self, dataCache, options): |
@@ -107,6 +111,7 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash): | |||
107 | def get_taskhash(self, fn, task, deps, dataCache): | 111 | def get_taskhash(self, fn, task, deps, dataCache): |
108 | recipename = dataCache.pkg_fn[fn] | 112 | recipename = dataCache.pkg_fn[fn] |
109 | self.lockedpnmap[fn] = recipename | 113 | self.lockedpnmap[fn] = recipename |
114 | self.lockedhashfn[fn] = dataCache.hashfn[fn] | ||
110 | if recipename in self.lockedsigs: | 115 | if recipename in self.lockedsigs: |
111 | if task in self.lockedsigs[recipename]: | 116 | if task in self.lockedsigs[recipename]: |
112 | k = fn + "." + task | 117 | k = fn + "." + task |
@@ -127,17 +132,27 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash): | |||
127 | 132 | ||
128 | def dump_lockedsigs(self): | 133 | def dump_lockedsigs(self): |
129 | bb.plain("Writing locked sigs to " + os.getcwd() + "/locked-sigs.inc") | 134 | bb.plain("Writing locked sigs to " + os.getcwd() + "/locked-sigs.inc") |
135 | types = {} | ||
136 | for k in self.runtaskdeps: | ||
137 | fn = k.rsplit(".",1)[0] | ||
138 | t = self.lockedhashfn[fn].split(" ")[1].split(":")[5] | ||
139 | if t not in types: | ||
140 | types[t] = [] | ||
141 | types[t].append(k) | ||
142 | |||
130 | with open("locked-sigs.inc", "w") as f: | 143 | with open("locked-sigs.inc", "w") as f: |
131 | f.write('SIGGEN_LOCKEDSIGS = "\\\n') | 144 | for t in types: |
132 | #for fn in self.taskdeps: | 145 | f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % t) |
133 | for k in self.runtaskdeps: | 146 | types[t].sort() |
134 | #k = fn + "." + task | 147 | sortedk = sorted(types[t], key=lambda k: self.lockedpnmap[k.rsplit(".",1)[0]]) |
148 | for k in sortedk: | ||
135 | fn = k.rsplit(".",1)[0] | 149 | fn = k.rsplit(".",1)[0] |
136 | task = k.rsplit(".",1)[1] | 150 | task = k.rsplit(".",1)[1] |
137 | if k not in self.taskhash: | 151 | if k not in self.taskhash: |
138 | continue | 152 | continue |
139 | f.write(" " + self.lockedpnmap[fn] + ":" + task + ":" + self.taskhash[k] + " \\\n") | 153 | f.write(" " + self.lockedpnmap[fn] + ":" + task + ":" + self.taskhash[k] + " \\\n") |
140 | f.write(' "\n') | 154 | f.write(' "\n') |
155 | f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(types.keys()))) | ||
141 | 156 | ||
142 | def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d): | 157 | def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d): |
143 | enforce = (d.getVar("SIGGEN_ENFORCE_LOCKEDSIGS", True) or "1") == "1" | 158 | enforce = (d.getVar("SIGGEN_ENFORCE_LOCKEDSIGS", True) or "1") == "1" |