summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-04 11:27:07 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-04 12:12:45 +0000
commit36e40ed24ff7cc0fdb7fd5230256edae7a3c7ade (patch)
treed33c37f2137aecdeecce872e79b6e5c7fb28bd7e /bitbake/lib/bb
parentf271a6773a4fb8cbf26acc3a050618cb81eda481 (diff)
downloadpoky-36e40ed24ff7cc0fdb7fd5230256edae7a3c7ade.tar.gz
bitbake: runqueue/siggen: Allow handling of equivalent hashes
Based on the hashserv's new ability to accept hash mappings, update runqueue to use this through a helper function in siggen. This addresses problems with meta-extsdk-toolchain and its dependency on gdb-cross which caused errors when building eSDK. See the previous commit for more details. (Bitbake rev: 39098b4ba2133f4d9229a0aa4fcf4c3e1291286a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/runqueue.py31
-rw-r--r--bitbake/lib/bb/siggen.py26
2 files changed, 45 insertions, 12 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index bd7f03f981..a869ba527a 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -2283,12 +2283,26 @@ class RunQueueExecute:
2283 for dep in self.rqdata.runtaskentries[tid].depends: 2283 for dep in self.rqdata.runtaskentries[tid].depends:
2284 procdep.append(dep) 2284 procdep.append(dep)
2285 orighash = self.rqdata.runtaskentries[tid].hash 2285 orighash = self.rqdata.runtaskentries[tid].hash
2286 self.rqdata.runtaskentries[tid].hash = bb.parse.siggen.get_taskhash(tid, procdep, self.rqdata.dataCaches[mc_from_tid(tid)]) 2286 newhash = bb.parse.siggen.get_taskhash(tid, procdep, self.rqdata.dataCaches[mc_from_tid(tid)])
2287 origuni = self.rqdata.runtaskentries[tid].unihash 2287 origuni = self.rqdata.runtaskentries[tid].unihash
2288 self.rqdata.runtaskentries[tid].unihash = bb.parse.siggen.get_unihash(tid) 2288 newuni = bb.parse.siggen.get_unihash(tid)
2289 logger.debug(1, "Task %s hash changes: %s->%s %s->%s" % (tid, orighash, self.rqdata.runtaskentries[tid].hash, origuni, self.rqdata.runtaskentries[tid].unihash)) 2289 # FIXME, need to check it can come from sstate at all for determinism?
2290 remapped = False
2291 if newuni == origuni:
2292 # Nothing to do, we match, skip code below
2293 remapped = True
2294 elif tid in self.scenequeue_covered or tid in self.sq_live:
2295 # Already ran this setscene task or it running. Report the new taskhash
2296 remapped = bb.parse.siggen.report_unihash_equiv(tid, newhash, origuni, newuni, self.rqdata.dataCaches)
2297 logger.info("Already covered setscene for %s so ignoring rehash (remap)" % (tid))
2298
2299 if not remapped:
2300 logger.debug(1, "Task %s hash changes: %s->%s %s->%s" % (tid, orighash, newhash, origuni, newuni))
2301 self.rqdata.runtaskentries[tid].hash = newhash
2302 self.rqdata.runtaskentries[tid].unihash = newuni
2303 changed.add(tid)
2304
2290 next |= self.rqdata.runtaskentries[tid].revdeps 2305 next |= self.rqdata.runtaskentries[tid].revdeps
2291 changed.add(tid)
2292 total.remove(tid) 2306 total.remove(tid)
2293 next.intersection_update(total) 2307 next.intersection_update(total)
2294 2308
@@ -2307,18 +2321,11 @@ class RunQueueExecute:
2307 self.pending_migrations.add(tid) 2321 self.pending_migrations.add(tid)
2308 2322
2309 for tid in self.pending_migrations.copy(): 2323 for tid in self.pending_migrations.copy():
2310 if tid in self.runq_running: 2324 if tid in self.runq_running or tid in self.sq_live:
2311 # Too late, task already running, not much we can do now 2325 # Too late, task already running, not much we can do now
2312 self.pending_migrations.remove(tid) 2326 self.pending_migrations.remove(tid)
2313 continue 2327 continue
2314 2328
2315 if tid in self.scenequeue_covered or tid in self.sq_live:
2316 # Already ran this setscene task or it running
2317 # Potentially risky, should we report this hash as a match?
2318 logger.info("Already covered setscene for %s so ignoring rehash" % (tid))
2319 self.pending_migrations.remove(tid)
2320 continue
2321
2322 valid = True 2329 valid = True
2323 # Check no tasks this covers are running 2330 # Check no tasks this covers are running
2324 for dep in self.sqdata.sq_covered_tasks[tid]: 2331 for dep in self.sqdata.sq_covered_tasks[tid]:
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index e19812b17c..edf10105f9 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -525,6 +525,32 @@ class SignatureGeneratorUniHashMixIn(object):
525 except OSError: 525 except OSError:
526 pass 526 pass
527 527
528 def report_unihash_equiv(self, tid, taskhash, wanted_unihash, current_unihash, datacaches):
529 try:
530 extra_data = {}
531 data = self.client().report_unihash_equiv(taskhash, self.method, wanted_unihash, extra_data)
532 bb.note('Reported task %s as unihash %s to %s (%s)' % (tid, wanted_unihash, self.server, str(data)))
533
534 if data is None:
535 bb.warn("Server unable to handle unihash report")
536 return False
537
538 finalunihash = data['unihash']
539
540 if finalunihash == current_unihash:
541 bb.note('Task %s unihash %s unchanged by server' % (tid, finalunihash))
542 elif finalunihash == wanted_unihash:
543 bb.note('Task %s unihash changed %s -> %s as wanted' % (tid, current_unihash, finalunihash))
544 self.set_unihash(tid, finalunihash)
545 return True
546 else:
547 # TODO: What to do here?
548 bb.note('Task %s unihash reported as unwanted hash %s' % (tid, finalunihash))
549
550 except hashserv.client.HashConnectionError as e:
551 bb.warn('Error contacting Hash Equivalence Server %s: %s' % (self.server, str(e)))
552
553 return False
528 554
529# 555#
530# Dummy class used for bitbake-selftest 556# Dummy class used for bitbake-selftest