summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2024-05-23 12:17:58 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-05-28 23:46:21 +0100
commitd31c64296d446cb37e9da098e347f8b745fda074 (patch)
tree7ebb1c28989235d5768d8007b1c11452fc708263 /bitbake
parente598b2d135712d79577ac8ec95fc89735571687f (diff)
downloadpoky-d31c64296d446cb37e9da098e347f8b745fda074.tar.gz
bitbake: bb: Use namedtuple for Task data
Task dependency data is becoming unwieldy with the number of indices it contains. Convert it to use a named tuple instead, which allows members to be indexed by a named property or an index (which allows it to retain backward compatibility). (Bitbake rev: 26446cca4d22734c3f1b328a205c169dadb7e494) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/__init__.py12
-rw-r--r--bitbake/lib/bb/runqueue.py45
2 files changed, 39 insertions, 18 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index 8b6ea2d8ed..b04d4c8a83 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -36,6 +36,7 @@ class BBHandledException(Exception):
36 36
37import os 37import os
38import logging 38import logging
39from collections import namedtuple
39 40
40 41
41class NullHandler(logging.Handler): 42class NullHandler(logging.Handler):
@@ -227,3 +228,14 @@ def deprecate_import(current, modulename, fromlist, renames = None):
227 228
228 setattr(sys.modules[current], newname, newobj) 229 setattr(sys.modules[current], newname, newobj)
229 230
231TaskData = namedtuple("TaskData", [
232 "pn",
233 "taskname",
234 "fn",
235 "deps",
236 "provides",
237 "taskhash",
238 "unihash",
239 "hashfn",
240 "taskhash_deps",
241])
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 47f48304ea..93079a9776 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -2452,15 +2452,17 @@ class RunQueueExecute:
2452 taskdepdata_cache = {} 2452 taskdepdata_cache = {}
2453 for task in self.rqdata.runtaskentries: 2453 for task in self.rqdata.runtaskentries:
2454 (mc, fn, taskname, taskfn) = split_tid_mcfn(task) 2454 (mc, fn, taskname, taskfn) = split_tid_mcfn(task)
2455 pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn] 2455 taskdepdata_cache[task] = bb.TaskData(
2456 deps = self.rqdata.runtaskentries[task].depends 2456 pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn],
2457 provides = self.rqdata.dataCaches[mc].fn_provides[taskfn] 2457 taskname = taskname,
2458 taskhash = self.rqdata.runtaskentries[task].hash 2458 fn = fn,
2459 unihash = self.rqdata.runtaskentries[task].unihash 2459 deps = self.filtermcdeps(task, mc, self.rqdata.runtaskentries[task].depends),
2460 deps = self.filtermcdeps(task, mc, deps) 2460 provides = self.rqdata.dataCaches[mc].fn_provides[taskfn],
2461 hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn] 2461 taskhash = self.rqdata.runtaskentries[task].hash,
2462 taskhash_deps = self.rqdata.runtaskentries[task].taskhash_deps 2462 unihash = self.rqdata.runtaskentries[task].unihash,
2463 taskdepdata_cache[task] = [pn, taskname, fn, deps, provides, taskhash, unihash, hashfn, taskhash_deps] 2463 hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn],
2464 taskhash_deps = self.rqdata.runtaskentries[task].taskhash_deps,
2465 )
2464 2466
2465 self.taskdepdata_cache = taskdepdata_cache 2467 self.taskdepdata_cache = taskdepdata_cache
2466 2468
@@ -2475,9 +2477,11 @@ class RunQueueExecute:
2475 while next: 2477 while next:
2476 additional = [] 2478 additional = []
2477 for revdep in next: 2479 for revdep in next:
2478 self.taskdepdata_cache[revdep][6] = self.rqdata.runtaskentries[revdep].unihash 2480 self.taskdepdata_cache[revdep] = self.taskdepdata_cache[revdep]._replace(
2481 unihash=self.rqdata.runtaskentries[revdep].unihash
2482 )
2479 taskdepdata[revdep] = self.taskdepdata_cache[revdep] 2483 taskdepdata[revdep] = self.taskdepdata_cache[revdep]
2480 for revdep2 in self.taskdepdata_cache[revdep][3]: 2484 for revdep2 in self.taskdepdata_cache[revdep].deps:
2481 if revdep2 not in taskdepdata: 2485 if revdep2 not in taskdepdata:
2482 additional.append(revdep2) 2486 additional.append(revdep2)
2483 next = additional 2487 next = additional
@@ -2841,14 +2845,19 @@ class RunQueueExecute:
2841 additional = [] 2845 additional = []
2842 for revdep in next: 2846 for revdep in next:
2843 (mc, fn, taskname, taskfn) = split_tid_mcfn(revdep) 2847 (mc, fn, taskname, taskfn) = split_tid_mcfn(revdep)
2844 pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn]
2845 deps = getsetscenedeps(revdep) 2848 deps = getsetscenedeps(revdep)
2846 provides = self.rqdata.dataCaches[mc].fn_provides[taskfn] 2849
2847 taskhash = self.rqdata.runtaskentries[revdep].hash 2850 taskdepdata[revdep] = bb.TaskData(
2848 unihash = self.rqdata.runtaskentries[revdep].unihash 2851 pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn],
2849 hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn] 2852 taskname = taskname,
2850 taskhash_deps = self.rqdata.runtaskentries[revdep].taskhash_deps 2853 fn = fn,
2851 taskdepdata[revdep] = [pn, taskname, fn, deps, provides, taskhash, unihash, hashfn, taskhash_deps] 2854 deps = deps,
2855 provides = self.rqdata.dataCaches[mc].fn_provides[taskfn],
2856 taskhash = self.rqdata.runtaskentries[revdep].hash,
2857 unihash = self.rqdata.runtaskentries[revdep].unihash,
2858 hashfn = self.rqdata.dataCaches[mc].hashfn[taskfn],
2859 taskhash_deps = self.rqdata.runtaskentries[revdep].taskhash_deps,
2860 )
2852 for revdep2 in deps: 2861 for revdep2 in deps:
2853 if revdep2 not in taskdepdata: 2862 if revdep2 not in taskdepdata:
2854 additional.append(revdep2) 2863 additional.append(revdep2)