Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | import bb.siggen |
| 2 | |
| 3 | def sstate_rundepfilter(siggen, fn, recipename, task, dep, depname, dataCache): |
| 4 | # Return True if we should keep the dependency, False to drop it |
| 5 | def isNative(x): |
| 6 | return x.endswith("-native") |
| 7 | def isCross(x): |
| 8 | return "-cross-" in x |
| 9 | def isNativeSDK(x): |
| 10 | return x.startswith("nativesdk-") |
| 11 | def isKernel(fn): |
| 12 | inherits = " ".join(dataCache.inherits[fn]) |
| 13 | return inherits.find("/module-base.bbclass") != -1 or inherits.find("/linux-kernel-base.bbclass") != -1 |
| 14 | def isPackageGroup(fn): |
| 15 | inherits = " ".join(dataCache.inherits[fn]) |
| 16 | return "/packagegroup.bbclass" in inherits |
| 17 | def isAllArch(fn): |
| 18 | inherits = " ".join(dataCache.inherits[fn]) |
| 19 | return "/allarch.bbclass" in inherits |
| 20 | def isImage(fn): |
| 21 | return "/image.bbclass" in " ".join(dataCache.inherits[fn]) |
| 22 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 23 | # (Almost) always include our own inter-task dependencies. |
| 24 | # The exception is the special do_kernel_configme->do_unpack_and_patch |
| 25 | # dependency from archiver.bbclass. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | if recipename == depname: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 27 | if task == "do_kernel_configme" and dep.endswith(".do_unpack_and_patch"): |
| 28 | return False |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | return True |
| 30 | |
| 31 | # Quilt (patch application) changing isn't likely to affect anything |
| 32 | excludelist = ['quilt-native', 'subversion-native', 'git-native'] |
| 33 | if depname in excludelist and recipename != depname: |
| 34 | return False |
| 35 | |
| 36 | # Exclude well defined recipe->dependency |
| 37 | if "%s->%s" % (recipename, depname) in siggen.saferecipedeps: |
| 38 | return False |
| 39 | |
| 40 | # Don't change native/cross/nativesdk recipe dependencies any further |
| 41 | if isNative(recipename) or isCross(recipename) or isNativeSDK(recipename): |
| 42 | return True |
| 43 | |
| 44 | # Only target packages beyond here |
| 45 | |
| 46 | # allarch packagegroups are assumed to have well behaved names which don't change between architecures/tunes |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 47 | if isPackageGroup(fn) and isAllArch(fn) and not isNative(depname): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 48 | return False |
| 49 | |
| 50 | # Exclude well defined machine specific configurations which don't change ABI |
| 51 | if depname in siggen.abisaferecipes and not isImage(fn): |
| 52 | return False |
| 53 | |
| 54 | # Kernel modules are well namespaced. We don't want to depend on the kernel's checksum |
| 55 | # if we're just doing an RRECOMMENDS_xxx = "kernel-module-*", not least because the checksum |
| 56 | # is machine specific. |
| 57 | # Therefore if we're not a kernel or a module recipe (inheriting the kernel classes) |
| 58 | # and we reccomend a kernel-module, we exclude the dependency. |
| 59 | depfn = dep.rsplit(".", 1)[0] |
| 60 | if dataCache and isKernel(depfn) and not isKernel(fn): |
| 61 | for pkg in dataCache.runrecs[fn]: |
| 62 | if " ".join(dataCache.runrecs[fn][pkg]).find("kernel-module-") != -1: |
| 63 | return False |
| 64 | |
| 65 | # Default to keep dependencies |
| 66 | return True |
| 67 | |
| 68 | def sstate_lockedsigs(d): |
| 69 | sigs = {} |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 70 | types = (d.getVar("SIGGEN_LOCKEDSIGS_TYPES") or "").split() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 71 | for t in types: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 72 | siggen_lockedsigs_var = "SIGGEN_LOCKEDSIGS_%s" % t |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 73 | lockedsigs = (d.getVar(siggen_lockedsigs_var) or "").split() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 74 | for ls in lockedsigs: |
| 75 | pn, task, h = ls.split(":", 2) |
| 76 | if pn not in sigs: |
| 77 | sigs[pn] = {} |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 78 | sigs[pn][task] = [h, siggen_lockedsigs_var] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 79 | return sigs |
| 80 | |
| 81 | class SignatureGeneratorOEBasic(bb.siggen.SignatureGeneratorBasic): |
| 82 | name = "OEBasic" |
| 83 | def init_rundepcheck(self, data): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 84 | self.abisaferecipes = (data.getVar("SIGGEN_EXCLUDERECIPES_ABISAFE") or "").split() |
| 85 | self.saferecipedeps = (data.getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS") or "").split() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 86 | pass |
| 87 | def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None): |
| 88 | return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCache) |
| 89 | |
| 90 | class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash): |
| 91 | name = "OEBasicHash" |
| 92 | def init_rundepcheck(self, data): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 93 | self.abisaferecipes = (data.getVar("SIGGEN_EXCLUDERECIPES_ABISAFE") or "").split() |
| 94 | self.saferecipedeps = (data.getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS") or "").split() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 95 | self.lockedsigs = sstate_lockedsigs(data) |
| 96 | self.lockedhashes = {} |
| 97 | self.lockedpnmap = {} |
| 98 | self.lockedhashfn = {} |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 99 | self.machine = data.getVar("MACHINE") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 100 | self.mismatch_msgs = [] |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 101 | self.unlockedrecipes = (data.getVar("SIGGEN_UNLOCKED_RECIPES") or |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 102 | "").split() |
| 103 | self.unlockedrecipes = { k: "" for k in self.unlockedrecipes } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 104 | pass |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 105 | |
| 106 | def tasks_resolved(self, virtmap, virtpnmap, dataCache): |
| 107 | # Translate virtual/xxx entries to PN values |
| 108 | newabisafe = [] |
| 109 | for a in self.abisaferecipes: |
| 110 | if a in virtpnmap: |
| 111 | newabisafe.append(virtpnmap[a]) |
| 112 | else: |
| 113 | newabisafe.append(a) |
| 114 | self.abisaferecipes = newabisafe |
| 115 | newsafedeps = [] |
| 116 | for a in self.saferecipedeps: |
| 117 | a1, a2 = a.split("->") |
| 118 | if a1 in virtpnmap: |
| 119 | a1 = virtpnmap[a1] |
| 120 | if a2 in virtpnmap: |
| 121 | a2 = virtpnmap[a2] |
| 122 | newsafedeps.append(a1 + "->" + a2) |
| 123 | self.saferecipedeps = newsafedeps |
| 124 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 125 | def rundep_check(self, fn, recipename, task, dep, depname, dataCache = None): |
| 126 | return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCache) |
| 127 | |
| 128 | def get_taskdata(self): |
| 129 | data = super(bb.siggen.SignatureGeneratorBasicHash, self).get_taskdata() |
| 130 | return (data, self.lockedpnmap, self.lockedhashfn) |
| 131 | |
| 132 | def set_taskdata(self, data): |
| 133 | coredata, self.lockedpnmap, self.lockedhashfn = data |
| 134 | super(bb.siggen.SignatureGeneratorBasicHash, self).set_taskdata(coredata) |
| 135 | |
| 136 | def dump_sigs(self, dataCache, options): |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 137 | sigfile = os.getcwd() + "/locked-sigs.inc" |
| 138 | bb.plain("Writing locked sigs to %s" % sigfile) |
| 139 | self.dump_lockedsigs(sigfile) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 140 | return super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigs(dataCache, options) |
| 141 | |
| 142 | def get_taskhash(self, fn, task, deps, dataCache): |
| 143 | h = super(bb.siggen.SignatureGeneratorBasicHash, self).get_taskhash(fn, task, deps, dataCache) |
| 144 | |
| 145 | recipename = dataCache.pkg_fn[fn] |
| 146 | self.lockedpnmap[fn] = recipename |
| 147 | self.lockedhashfn[fn] = dataCache.hashfn[fn] |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 148 | |
| 149 | unlocked = False |
| 150 | if recipename in self.unlockedrecipes: |
| 151 | unlocked = True |
| 152 | else: |
| 153 | def recipename_from_dep(dep): |
| 154 | # The dep entry will look something like |
| 155 | # /path/path/recipename.bb.task, virtual:native:/p/foo.bb.task, |
| 156 | # ... |
| 157 | fn = dep.rsplit('.', 1)[0] |
| 158 | return dataCache.pkg_fn[fn] |
| 159 | |
| 160 | # If any unlocked recipe is in the direct dependencies then the |
| 161 | # current recipe should be unlocked as well. |
| 162 | depnames = [ recipename_from_dep(x) for x in deps ] |
| 163 | if any(x in y for y in depnames for x in self.unlockedrecipes): |
| 164 | self.unlockedrecipes[recipename] = '' |
| 165 | unlocked = True |
| 166 | |
| 167 | if not unlocked and recipename in self.lockedsigs: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 168 | if task in self.lockedsigs[recipename]: |
| 169 | k = fn + "." + task |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 170 | h_locked = self.lockedsigs[recipename][task][0] |
| 171 | var = self.lockedsigs[recipename][task][1] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 172 | self.lockedhashes[k] = h_locked |
| 173 | self.taskhash[k] = h_locked |
| 174 | #bb.warn("Using %s %s %s" % (recipename, task, h)) |
| 175 | |
| 176 | if h != h_locked: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 177 | self.mismatch_msgs.append('The %s:%s sig is computed to be %s, but the sig is locked to %s in %s' |
| 178 | % (recipename, task, h, h_locked, var)) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 179 | |
| 180 | return h_locked |
| 181 | #bb.warn("%s %s %s" % (recipename, task, h)) |
| 182 | return h |
| 183 | |
| 184 | def dump_sigtask(self, fn, task, stampbase, runtime): |
| 185 | k = fn + "." + task |
| 186 | if k in self.lockedhashes: |
| 187 | return |
| 188 | super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigtask(fn, task, stampbase, runtime) |
| 189 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 190 | def dump_lockedsigs(self, sigfile, taskfilter=None): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 191 | types = {} |
| 192 | for k in self.runtaskdeps: |
| 193 | if taskfilter: |
| 194 | if not k in taskfilter: |
| 195 | continue |
| 196 | fn = k.rsplit(".",1)[0] |
| 197 | t = self.lockedhashfn[fn].split(" ")[1].split(":")[5] |
| 198 | t = 't-' + t.replace('_', '-') |
| 199 | if t not in types: |
| 200 | types[t] = [] |
| 201 | types[t].append(k) |
| 202 | |
| 203 | with open(sigfile, "w") as f: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 204 | l = sorted(types) |
| 205 | for t in l: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 206 | f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % t) |
| 207 | types[t].sort() |
| 208 | sortedk = sorted(types[t], key=lambda k: self.lockedpnmap[k.rsplit(".",1)[0]]) |
| 209 | for k in sortedk: |
| 210 | fn = k.rsplit(".",1)[0] |
| 211 | task = k.rsplit(".",1)[1] |
| 212 | if k not in self.taskhash: |
| 213 | continue |
| 214 | f.write(" " + self.lockedpnmap[fn] + ":" + task + ":" + self.taskhash[k] + " \\\n") |
| 215 | f.write(' "\n') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 216 | f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(l))) |
| 217 | |
| 218 | def dump_siglist(self, sigfile): |
| 219 | with open(sigfile, "w") as f: |
| 220 | tasks = [] |
| 221 | for taskitem in self.taskhash: |
| 222 | (fn, task) = taskitem.rsplit(".", 1) |
| 223 | pn = self.lockedpnmap[fn] |
| 224 | tasks.append((pn, task, fn, self.taskhash[taskitem])) |
| 225 | for (pn, task, fn, taskhash) in sorted(tasks): |
| 226 | f.write('%s.%s %s %s\n' % (pn, task, fn, taskhash)) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 227 | |
| 228 | def checkhashes(self, missed, ret, sq_fn, sq_task, sq_hash, sq_hashfn, d): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 229 | warn_msgs = [] |
| 230 | error_msgs = [] |
| 231 | sstate_missing_msgs = [] |
| 232 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 233 | for task in range(len(sq_fn)): |
| 234 | if task not in ret: |
| 235 | for pn in self.lockedsigs: |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 236 | if sq_hash[task] in iter(self.lockedsigs[pn].values()): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 237 | if sq_task[task] == 'do_shared_workdir': |
| 238 | continue |
| 239 | sstate_missing_msgs.append("Locked sig is set for %s:%s (%s) yet not in sstate cache?" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 240 | % (pn, sq_task[task], sq_hash[task])) |
| 241 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 242 | checklevel = d.getVar("SIGGEN_LOCKEDSIGS_TASKSIG_CHECK") |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 243 | if checklevel == 'warn': |
| 244 | warn_msgs += self.mismatch_msgs |
| 245 | elif checklevel == 'error': |
| 246 | error_msgs += self.mismatch_msgs |
| 247 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 248 | checklevel = d.getVar("SIGGEN_LOCKEDSIGS_SSTATE_EXISTS_CHECK") |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 249 | if checklevel == 'warn': |
| 250 | warn_msgs += sstate_missing_msgs |
| 251 | elif checklevel == 'error': |
| 252 | error_msgs += sstate_missing_msgs |
| 253 | |
| 254 | if warn_msgs: |
| 255 | bb.warn("\n".join(warn_msgs)) |
| 256 | if error_msgs: |
| 257 | bb.fatal("\n".join(error_msgs)) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 258 | |
| 259 | |
| 260 | # Insert these classes into siggen's namespace so it can see and select them |
| 261 | bb.siggen.SignatureGeneratorOEBasic = SignatureGeneratorOEBasic |
| 262 | bb.siggen.SignatureGeneratorOEBasicHash = SignatureGeneratorOEBasicHash |
| 263 | |
| 264 | |
| 265 | def find_siginfo(pn, taskname, taskhashlist, d): |
| 266 | """ Find signature data files for comparison purposes """ |
| 267 | |
| 268 | import fnmatch |
| 269 | import glob |
| 270 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 271 | if not taskname: |
| 272 | # We have to derive pn and taskname |
| 273 | key = pn |
| 274 | splitit = key.split('.bb.') |
| 275 | taskname = splitit[1] |
| 276 | pn = os.path.basename(splitit[0]).split('_')[0] |
| 277 | if key.startswith('virtual:native:'): |
| 278 | pn = pn + '-native' |
| 279 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 280 | hashfiles = {} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 281 | filedates = {} |
| 282 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 283 | def get_hashval(siginfo): |
| 284 | if siginfo.endswith('.siginfo'): |
| 285 | return siginfo.rpartition(':')[2].partition('_')[0] |
| 286 | else: |
| 287 | return siginfo.rpartition('.')[2] |
| 288 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 289 | # First search in stamps dir |
| 290 | localdata = d.createCopy() |
| 291 | localdata.setVar('MULTIMACH_TARGET_SYS', '*') |
| 292 | localdata.setVar('PN', pn) |
| 293 | localdata.setVar('PV', '*') |
| 294 | localdata.setVar('PR', '*') |
| 295 | localdata.setVar('EXTENDPE', '') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 296 | stamp = localdata.getVar('STAMP') |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 297 | if pn.startswith("gcc-source"): |
| 298 | # gcc-source shared workdir is a special case :( |
| 299 | stamp = localdata.expand("${STAMPS_DIR}/work-shared/gcc-${PV}-${PR}") |
| 300 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 301 | filespec = '%s.%s.sigdata.*' % (stamp, taskname) |
| 302 | foundall = False |
| 303 | import glob |
| 304 | for fullpath in glob.glob(filespec): |
| 305 | match = False |
| 306 | if taskhashlist: |
| 307 | for taskhash in taskhashlist: |
| 308 | if fullpath.endswith('.%s' % taskhash): |
| 309 | hashfiles[taskhash] = fullpath |
| 310 | if len(hashfiles) == len(taskhashlist): |
| 311 | foundall = True |
| 312 | break |
| 313 | else: |
| 314 | try: |
| 315 | filedates[fullpath] = os.stat(fullpath).st_mtime |
| 316 | except OSError: |
| 317 | continue |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 318 | hashval = get_hashval(fullpath) |
| 319 | hashfiles[hashval] = fullpath |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 320 | |
| 321 | if not taskhashlist or (len(filedates) < 2 and not foundall): |
| 322 | # That didn't work, look in sstate-cache |
| 323 | hashes = taskhashlist or ['*'] |
| 324 | localdata = bb.data.createCopy(d) |
| 325 | for hashval in hashes: |
| 326 | localdata.setVar('PACKAGE_ARCH', '*') |
| 327 | localdata.setVar('TARGET_VENDOR', '*') |
| 328 | localdata.setVar('TARGET_OS', '*') |
| 329 | localdata.setVar('PN', pn) |
| 330 | localdata.setVar('PV', '*') |
| 331 | localdata.setVar('PR', '*') |
| 332 | localdata.setVar('BB_TASKHASH', hashval) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 333 | swspec = localdata.getVar('SSTATE_SWSPEC') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 334 | if taskname in ['do_fetch', 'do_unpack', 'do_patch', 'do_populate_lic', 'do_preconfigure'] and swspec: |
| 335 | localdata.setVar('SSTATE_PKGSPEC', '${SSTATE_SWSPEC}') |
| 336 | elif pn.endswith('-native') or "-cross-" in pn or "-crosssdk-" in pn: |
| 337 | localdata.setVar('SSTATE_EXTRAPATH', "${NATIVELSBSTRING}/") |
| 338 | sstatename = taskname[3:] |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 339 | filespec = '%s_%s.*.siginfo' % (localdata.getVar('SSTATE_PKG'), sstatename) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 340 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 341 | matchedfiles = glob.glob(filespec) |
| 342 | for fullpath in matchedfiles: |
| 343 | actual_hashval = get_hashval(fullpath) |
| 344 | if actual_hashval in hashfiles: |
| 345 | continue |
| 346 | hashfiles[hashval] = fullpath |
| 347 | if not taskhashlist: |
| 348 | try: |
| 349 | filedates[fullpath] = os.stat(fullpath).st_mtime |
| 350 | except: |
| 351 | continue |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 352 | |
| 353 | if taskhashlist: |
| 354 | return hashfiles |
| 355 | else: |
| 356 | return filedates |
| 357 | |
| 358 | bb.siggen.find_siginfo = find_siginfo |
| 359 | |
| 360 | |
| 361 | def sstate_get_manifest_filename(task, d): |
| 362 | """ |
| 363 | Return the sstate manifest file path for a particular task. |
| 364 | Also returns the datastore that can be used to query related variables. |
| 365 | """ |
| 366 | d2 = d.createCopy() |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 367 | extrainf = d.getVarFlag("do_" + task, 'stamp-extra-info') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 368 | if extrainf: |
| 369 | d2.setVar("SSTATE_MANMACH", extrainf) |
| 370 | return (d2.expand("${SSTATE_MANFILEPREFIX}.%s" % task), d2) |