summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/sstatesig.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2020-06-12 12:36:47 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-15 14:53:46 +0100
commit48a883bb6e144a176d36188cb38b7fc6e3fd1d9d (patch)
tree880b8b49af2f0ff3b51fe6d547bf4910562755c5 /meta/lib/oe/sstatesig.py
parent4394a9269ef901eaf5567d846c01c4b379d2b9da (diff)
downloadpoky-48a883bb6e144a176d36188cb38b7fc6e3fd1d9d.tar.gz
sstatesig: Account for all dataCaches being passed
Bitbake now passes all the dataCaches to the taskhash API, so use this to correctly filter mcdepends. [YOCTO #13724] (From OE-Core rev: 749731a420fb905b6af97ce2909f06b2bcd14fe2) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/sstatesig.py')
-rw-r--r--meta/lib/oe/sstatesig.py79
1 files changed, 42 insertions, 37 deletions
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index d24e3738ae..21ae0a7657 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -2,9 +2,10 @@
2# SPDX-License-Identifier: GPL-2.0-only 2# SPDX-License-Identifier: GPL-2.0-only
3# 3#
4import bb.siggen 4import bb.siggen
5import bb.runqueue
5import oe 6import oe
6 7
7def sstate_rundepfilter(siggen, fn, recipename, task, dep, depname, dataCache): 8def sstate_rundepfilter(siggen, fn, recipename, task, dep, depname, dataCaches):
8 # Return True if we should keep the dependency, False to drop it 9 # Return True if we should keep the dependency, False to drop it
9 def isNative(x): 10 def isNative(x):
10 return x.endswith("-native") 11 return x.endswith("-native")
@@ -12,23 +13,26 @@ def sstate_rundepfilter(siggen, fn, recipename, task, dep, depname, dataCache):
12 return "-cross-" in x 13 return "-cross-" in x
13 def isNativeSDK(x): 14 def isNativeSDK(x):
14 return x.startswith("nativesdk-") 15 return x.startswith("nativesdk-")
15 def isKernel(fn): 16 def isKernel(mc, fn):
16 inherits = " ".join(dataCache.inherits[fn]) 17 inherits = " ".join(dataCaches[mc].inherits[fn])
17 return inherits.find("/module-base.bbclass") != -1 or inherits.find("/linux-kernel-base.bbclass") != -1 18 return inherits.find("/module-base.bbclass") != -1 or inherits.find("/linux-kernel-base.bbclass") != -1
18 def isPackageGroup(fn): 19 def isPackageGroup(mc, fn):
19 inherits = " ".join(dataCache.inherits[fn]) 20 inherits = " ".join(dataCaches[mc].inherits[fn])
20 return "/packagegroup.bbclass" in inherits 21 return "/packagegroup.bbclass" in inherits
21 def isAllArch(fn): 22 def isAllArch(mc, fn):
22 inherits = " ".join(dataCache.inherits[fn]) 23 inherits = " ".join(dataCaches[mc].inherits[fn])
23 return "/allarch.bbclass" in inherits 24 return "/allarch.bbclass" in inherits
24 def isImage(fn): 25 def isImage(mc, fn):
25 return "/image.bbclass" in " ".join(dataCache.inherits[fn]) 26 return "/image.bbclass" in " ".join(dataCaches[mc].inherits[fn])
26 27
27 # (Almost) always include our own inter-task dependencies. 28 depmc, _, deptaskname, depmcfn = bb.runqueue.split_tid_mcfn(dep)
28 # The exception is the special do_kernel_configme->do_unpack_and_patch 29 mc, _ = bb.runqueue.split_mc(fn)
29 # dependency from archiver.bbclass. 30
30 if recipename == depname: 31 # (Almost) always include our own inter-task dependencies (unless it comes
31 if task == "do_kernel_configme" and dep.endswith(".do_unpack_and_patch"): 32 # from a mcdepends). The exception is the special
33 # do_kernel_configme->do_unpack_and_patch dependency from archiver.bbclass.
34 if recipename == depname and depmc == mc:
35 if task == "do_kernel_configme" and deptaskname == "do_unpack_and_patch":
32 return False 36 return False
33 return True 37 return True
34 38
@@ -47,11 +51,11 @@ def sstate_rundepfilter(siggen, fn, recipename, task, dep, depname, dataCache):
47 # Only target packages beyond here 51 # Only target packages beyond here
48 52
49 # allarch packagegroups are assumed to have well behaved names which don't change between architecures/tunes 53 # allarch packagegroups are assumed to have well behaved names which don't change between architecures/tunes
50 if isPackageGroup(fn) and isAllArch(fn) and not isNative(depname): 54 if isPackageGroup(mc, fn) and isAllArch(mc, fn) and not isNative(depname):
51 return False 55 return False
52 56
53 # Exclude well defined machine specific configurations which don't change ABI 57 # Exclude well defined machine specific configurations which don't change ABI
54 if depname in siggen.abisaferecipes and not isImage(fn): 58 if depname in siggen.abisaferecipes and not isImage(mc, fn):
55 return False 59 return False
56 60
57 # Kernel modules are well namespaced. We don't want to depend on the kernel's checksum 61 # Kernel modules are well namespaced. We don't want to depend on the kernel's checksum
@@ -59,10 +63,9 @@ def sstate_rundepfilter(siggen, fn, recipename, task, dep, depname, dataCache):
59 # is machine specific. 63 # is machine specific.
60 # Therefore if we're not a kernel or a module recipe (inheriting the kernel classes) 64 # Therefore if we're not a kernel or a module recipe (inheriting the kernel classes)
61 # and we reccomend a kernel-module, we exclude the dependency. 65 # and we reccomend a kernel-module, we exclude the dependency.
62 depfn = dep.rsplit(":", 1)[0] 66 if dataCaches and isKernel(depmc, depmcfn) and not isKernel(mc, fn):
63 if dataCache and isKernel(depfn) and not isKernel(fn): 67 for pkg in dataCaches[mc].runrecs[fn]:
64 for pkg in dataCache.runrecs[fn]: 68 if " ".join(dataCaches[mc].runrecs[fn][pkg]).find("kernel-module-") != -1:
65 if " ".join(dataCache.runrecs[fn][pkg]).find("kernel-module-") != -1:
66 return False 69 return False
67 70
68 # Default to keep dependencies 71 # Default to keep dependencies
@@ -87,10 +90,12 @@ class SignatureGeneratorOEBasic(bb.siggen.SignatureGeneratorBasic):
87 self.abisaferecipes = (data.getVar("SIGGEN_EXCLUDERECIPES_ABISAFE") or "").split() 90 self.abisaferecipes = (data.getVar("SIGGEN_EXCLUDERECIPES_ABISAFE") or "").split()
88 self.saferecipedeps = (data.getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS") or "").split() 91 self.saferecipedeps = (data.getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS") or "").split()
89 pass 92 pass
90 def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None): 93 def rundep_check(self, fn, recipename, task, dep, depname, dataCaches = None):
91 return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCache) 94 return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCaches)
92 95
93class SignatureGeneratorOEBasicHashMixIn(object): 96class SignatureGeneratorOEBasicHashMixIn(object):
97 supports_multiconfig_datacaches = True
98
94 def init_rundepcheck(self, data): 99 def init_rundepcheck(self, data):
95 self.abisaferecipes = (data.getVar("SIGGEN_EXCLUDERECIPES_ABISAFE") or "").split() 100 self.abisaferecipes = (data.getVar("SIGGEN_EXCLUDERECIPES_ABISAFE") or "").split()
96 self.saferecipedeps = (data.getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS") or "").split() 101 self.saferecipedeps = (data.getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS") or "").split()
@@ -126,8 +131,8 @@ class SignatureGeneratorOEBasicHashMixIn(object):
126 newsafedeps.append(a1 + "->" + a2) 131 newsafedeps.append(a1 + "->" + a2)
127 self.saferecipedeps = newsafedeps 132 self.saferecipedeps = newsafedeps
128 133
129 def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None): 134 def rundep_check(self, fn, recipename, task, dep, depname, dataCaches = None):
130 return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCache) 135 return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCaches)
131 136
132 def get_taskdata(self): 137 def get_taskdata(self):
133 return (self.lockedpnmap, self.lockedhashfn, self.lockedhashes) + super().get_taskdata() 138 return (self.lockedpnmap, self.lockedhashfn, self.lockedhashes) + super().get_taskdata()
@@ -142,41 +147,41 @@ class SignatureGeneratorOEBasicHashMixIn(object):
142 self.dump_lockedsigs(sigfile) 147 self.dump_lockedsigs(sigfile)
143 return super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigs(dataCache, options) 148 return super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigs(dataCache, options)
144 149
145 def prep_taskhash(self, tid, deps, dataCache): 150 def prep_taskhash(self, tid, deps, dataCaches):
146 super().prep_taskhash(tid, deps, dataCache) 151 super().prep_taskhash(tid, deps, dataCaches)
147 if hasattr(self, "extramethod"): 152 if hasattr(self, "extramethod"):
148 (_, _, _, fn) = bb.runqueue.split_tid_mcfn(tid) 153 (mc, _, _, fn) = bb.runqueue.split_tid_mcfn(tid)
149 inherits = " ".join(dataCache.inherits[fn]) 154 inherits = " ".join(dataCaches[mc].inherits[fn])
150 if inherits.find("/native.bbclass") != -1 or inherits.find("/cross.bbclass") != -1: 155 if inherits.find("/native.bbclass") != -1 or inherits.find("/cross.bbclass") != -1:
151 self.extramethod[tid] = ":" + self.buildarch 156 self.extramethod[tid] = ":" + self.buildarch
152 157
153 def get_taskhash(self, tid, deps, dataCache): 158 def get_taskhash(self, tid, deps, dataCaches):
154 if tid in self.lockedhashes: 159 if tid in self.lockedhashes:
155 if self.lockedhashes[tid]: 160 if self.lockedhashes[tid]:
156 return self.lockedhashes[tid] 161 return self.lockedhashes[tid]
157 else: 162 else:
158 return super().get_taskhash(tid, deps, dataCache) 163 return super().get_taskhash(tid, deps, dataCaches)
159 164
160 # get_taskhash will call get_unihash internally in the parent class, we 165 # get_taskhash will call get_unihash internally in the parent class, we
161 # need to disable our filter of it whilst this runs else 166 # need to disable our filter of it whilst this runs else
162 # incorrect hashes can be calculated. 167 # incorrect hashes can be calculated.
163 self._internal = True 168 self._internal = True
164 h = super().get_taskhash(tid, deps, dataCache) 169 h = super().get_taskhash(tid, deps, dataCaches)
165 self._internal = False 170 self._internal = False
166 171
167 (mc, _, task, fn) = bb.runqueue.split_tid_mcfn(tid) 172 (mc, _, task, fn) = bb.runqueue.split_tid_mcfn(tid)
168 173
169 recipename = dataCache.pkg_fn[fn] 174 recipename = dataCaches[mc].pkg_fn[fn]
170 self.lockedpnmap[fn] = recipename 175 self.lockedpnmap[fn] = recipename
171 self.lockedhashfn[fn] = dataCache.hashfn[fn] 176 self.lockedhashfn[fn] = dataCaches[mc].hashfn[fn]
172 177
173 unlocked = False 178 unlocked = False
174 if recipename in self.unlockedrecipes: 179 if recipename in self.unlockedrecipes:
175 unlocked = True 180 unlocked = True
176 else: 181 else:
177 def recipename_from_dep(dep): 182 def recipename_from_dep(dep):
178 fn = bb.runqueue.fn_from_tid(dep) 183 (depmc, _, _, depfn) = bb.runqueue.split_tid_mcfn(dep)
179 return dataCache.pkg_fn[fn] 184 return dataCaches[depmc].pkg_fn[depfn]
180 185
181 # If any unlocked recipe is in the direct dependencies then the 186 # If any unlocked recipe is in the direct dependencies then the
182 # current recipe should be unlocked as well. 187 # current recipe should be unlocked as well.