Skip to contentSkip to conversation

data_smart: Ensure all possible overrides are cache including those with '_' in the name

PATCH New Richard Purdie 1 participant 1 message May 7, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 data_smart: Ensure all possible overrides are cache including those with '_' in the name

Unfortunately we've been neglecting to pay the correct tributes to the cookie monster and hence the datastore is malfunctioning.

Currently tributes are only paid on the last part of a variable after the last "_" character. We need to split by *all* "_" characters since an override may contain the character.

This fixes the code so the correct number of tributes are made. Paradoxically parsing appears to be faster after this change.

---

bitbake/lib/bb/data_smart.py +6 -1
index 9da86ce..27806f9 100644
@@ -539,10 +539,15 @@ class DataSmart(MutableMapping):
     def _setvar_update_overrides(self, var):
         # aka pay the cookie monster
         override = var[var.rfind('_')+1:]
-        if len(override) > 0:
+        shortvar = var[:var.rfind('_')]
+        while override:
             if override not in self._seen_overrides:
                 self._seen_overrides[override] = set()
             self._seen_overrides[override].add( var )
+            override = None
+            if "_" in shortvar:
+                override = var[shortvar.rfind('_')+1:]
+                shortvar = var[:shortvar.rfind('_')]
 
     def getVar(self, var, expand=False, noweakdefault=False):
         return self.getVarFlag(var, "_content", expand, noweakdefault)