Skip to contentSkip to conversation

data_smart: Drop default expand=False to getVarFlag [API change]

PATCH In review Richard Purdie 2 participants 4 messages Feb 2, 2016 – Feb 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 data_smart: Drop default expand=False to getVarFlag [API change]

At some point in the future, getVarFlag should expand by default. To get there from the current position, we need a period of time where the expand parameter is mandatory.

This patch starts that process. Clear errors will result from any code which doesn't provide this. Layers can be fixed with an expression like:

sed -e 's:\(\.getVarFlag([^,()]*, [^,()]*\)):\1, False):g' -i grep -ril getVar *

bitbake/lib/bb/data_smart.py +1 -1
index 79bec1b..d61ad53 100644
@@ -663,7 +663,7 @@ class DataSmart(MutableMapping):
                 self.dict["__exportlist"]["_content"] = set()
             self.dict["__exportlist"]["_content"].add(var)
 
-    def getVarFlag(self, var, flag, expand=False, noweakdefault=False, parsing=False):
+    def getVarFlag(self, var, flag, expand, noweakdefault=False, parsing=False):
         local_var = self._findVar(var)
         value = None
         if flag == "_content" and var in self.overridedata and not parsing:
#1 lore raw
Quoted 4 lines · Richard Purdie

At some point in the future, getVarFlag should expand by default. To get there from the current position, we need a period of time where the expand parameter is mandatory.

what are advantages of this.

Quoted 26 lines

This patch starts that process. Clear errors will result from any code which doesn't provide this. Layers can be fixed with an expression like:

sed -e 's:\(\.getVarFlag([^,()]*, [^,()]*\)):\1, False):g' -i grep -ril getVar *

bitbake/lib/bb/data_smart.py +1 -1
index 79bec1b..d61ad53 100644
@@ -663,7 +663,7 @@ class DataSmart(MutableMapping):
                 self.dict["__exportlist"]["_content"] = set()
             self.dict["__exportlist"]["_content"].add(var)
 
-    def getVarFlag(self, var, flag, expand=False, noweakdefault=False, parsing=False):
+    def getVarFlag(self, var, flag, expand, noweakdefault=False, parsing=False):
         local_var = self._findVar(var)
         value = None
         if flag == "_content" and var in self.overridedata and not parsing:

_______________________________________________
Openembedded-architecture mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-architecture

#2 lore raw
Quoted 10 lines · Khem Raj
Quoted 6 lines · Richard Purdie

At some point in the future, getVarFlag should expand by default. To
get there from the current position, we need a period of time where the
expand parameter is mandatory.

what are advantages of this.

Most users expect the data to be expanded by default. Most call sites also use getVar(xxx, True), its uncommon to see expand=False, outside the core of bitbake.

So the ultimate advantage is a more sensible default which is what the user expects and leads to neater/smaller code.

We have had several bugs requesting this and it does confuse people.

I have heard regrets from some of the original developers that the default wasn't True as well.

Cheers,

Richard

#3 lore raw
Quoted 10 lines · Richard Purdie
Quoted 9 lines · Khem Raj
Quoted 6 lines · Richard Purdie

At some point in the future, getVarFlag should expand by default. To
get there from the current position, we need a period of time where the
expand parameter is mandatory.

Quoted 9 lines
Quoted 1 line

what are advantages of this.

Most users expect the data to be expanded by default. Most call sites also use getVar(xxx, True), its uncommon to see expand=False, outside the core of bitbake.

So the ultimate advantage is a more sensible default which is what the user expects and leads to neater/smaller code.

That makes sense.

Quoted 9 lines

We have had several bugs requesting this and it does confuse people.

I have heard regrets from some of the original developers that the default wasn't True as well.

Cheers,

Richard