mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 17:39:31 +00:00
bitbake: data_smart: Tweak OVERRIDES value cache for performance
Updating the value of OVERRIDES whenever it changes turns out to be extremely expensve/pointless. Instead, clear its value and re-establish the value when we're going to use it. This gives significant speed back. (Bitbake rev: 41cf8d0c92d2d8a33fdad0921e424a0024914be1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -311,8 +311,7 @@ class DataSmart(MutableMapping):
|
|||||||
|
|
||||||
# cookie monster tribute
|
# cookie monster tribute
|
||||||
self.overridedata = {}
|
self.overridedata = {}
|
||||||
|
self.overrides = None
|
||||||
self.overrides = []
|
|
||||||
self.overridevars = set(["OVERRIDES", "FILE"])
|
self.overridevars = set(["OVERRIDES", "FILE"])
|
||||||
|
|
||||||
def enableTracking(self):
|
def enableTracking(self):
|
||||||
@@ -360,8 +359,13 @@ class DataSmart(MutableMapping):
|
|||||||
|
|
||||||
def internal_finalize(self, parent = False):
|
def internal_finalize(self, parent = False):
|
||||||
"""Performs final steps upon the datastore, including application of overrides"""
|
"""Performs final steps upon the datastore, including application of overrides"""
|
||||||
|
self.overrides = None
|
||||||
|
|
||||||
self.overrides = (self.getVar("OVERRIDES", True) or "").split(":") or []
|
def need_overrides(self):
|
||||||
|
if self.overrides is None:
|
||||||
|
self.overrides = []
|
||||||
|
self.overrides = (self.getVar("OVERRIDES", True) or "").split(":") or []
|
||||||
|
self.expand_cache = {}
|
||||||
|
|
||||||
def initVar(self, var):
|
def initVar(self, var):
|
||||||
self.expand_cache = {}
|
self.expand_cache = {}
|
||||||
@@ -587,6 +591,7 @@ class DataSmart(MutableMapping):
|
|||||||
if flag == "_content" and var in self.overridedata and not parsing:
|
if flag == "_content" and var in self.overridedata and not parsing:
|
||||||
match = False
|
match = False
|
||||||
active = {}
|
active = {}
|
||||||
|
self.need_overrides()
|
||||||
for (r, o) in self.overridedata[var]:
|
for (r, o) in self.overridedata[var]:
|
||||||
# What about double overrides both with "_" in the name?
|
# What about double overrides both with "_" in the name?
|
||||||
if o in self.overrides:
|
if o in self.overrides:
|
||||||
@@ -619,6 +624,7 @@ class DataSmart(MutableMapping):
|
|||||||
if flag == "_content" and local_var is not None and "_append" in local_var and not parsing:
|
if flag == "_content" and local_var is not None and "_append" in local_var and not parsing:
|
||||||
if not value:
|
if not value:
|
||||||
value = ""
|
value = ""
|
||||||
|
self.need_overrides()
|
||||||
for (r, o) in local_var["_append"]:
|
for (r, o) in local_var["_append"]:
|
||||||
match = True
|
match = True
|
||||||
if o:
|
if o:
|
||||||
@@ -631,6 +637,7 @@ class DataSmart(MutableMapping):
|
|||||||
if flag == "_content" and local_var is not None and "_prepend" in local_var and not parsing:
|
if flag == "_content" and local_var is not None and "_prepend" in local_var and not parsing:
|
||||||
if not value:
|
if not value:
|
||||||
value = ""
|
value = ""
|
||||||
|
self.need_overrides()
|
||||||
for (r, o) in local_var["_prepend"]:
|
for (r, o) in local_var["_prepend"]:
|
||||||
|
|
||||||
match = True
|
match = True
|
||||||
@@ -652,6 +659,7 @@ class DataSmart(MutableMapping):
|
|||||||
|
|
||||||
if value and flag == "_content" and local_var is not None and "_remove" in local_var:
|
if value and flag == "_content" and local_var is not None and "_remove" in local_var:
|
||||||
removes = []
|
removes = []
|
||||||
|
self.need_overrides()
|
||||||
for (r, o) in local_var["_remove"]:
|
for (r, o) in local_var["_remove"]:
|
||||||
match = True
|
match = True
|
||||||
if o:
|
if o:
|
||||||
@@ -762,7 +770,7 @@ class DataSmart(MutableMapping):
|
|||||||
|
|
||||||
data._tracking = self._tracking
|
data._tracking = self._tracking
|
||||||
|
|
||||||
data.overrides = copy.copy(self.overrides)
|
data.overrides = None
|
||||||
data.overridevars = copy.copy(self.overridevars)
|
data.overridevars = copy.copy(self.overridevars)
|
||||||
data.overridedata = copy.copy(self.overridedata)
|
data.overridedata = copy.copy(self.overridedata)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user