Skip to contentSkip to conversation

data_smart: Drop expand parameter default

RFC PATCH In review Richard Purdie 2 participants 3 messages Jun 18, 2015 – Jun 19, 2015

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 data_smart: Drop expand parameter default

Rather than just d.getVar(X), force the use of the more explict d.getVar(X, False) since at some point in the future, having the default of expansion would be nice. This is the first step towards that.

Layers can update to this calling convention with a command along the lines of:

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

Patches for OE-Core and Bitbake are on the mailing lists. Its an open question whether we want to do this, on what timescale and whether we do the same with getVarFLag at the same time?

Paul confirmed that other layers don't have too many of these unexpanded getVar calls.

bitbake/lib/bb/data_smart.py +1 -1
index 9384ffd..1316671 100644
@@ -516,7 +516,7 @@ class DataSmart(MutableMapping):
                 if len(shortvar) == 0:
                     override = None
 
-    def getVar(self, var, expand=False, noweakdefault=False, parsing=False):
+    def getVar(self, var, expand, noweakdefault=False, parsing=False):
         return self.getVarFlag(var, "_content", expand, noweakdefault, parsing)
 
     def _clearOverrides(self, key):
#1 lore raw
Quoted 3 lines · Richard Purdie

Rather than just d.getVar(X), force the use of the more explict d.getVar(X, False) since at some point in the future, having the default of expansion would be nice. This is the first step towards that.

Did you mean that in the future:

d.getVar("PN") equals d.getVar("PN", True) ?

That would be great since expand=True uses more frequently than False.

// Robert

Quoted 29 lines

Layers can update to this calling convention with a command along the lines of:

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

Patches for OE-Core and Bitbake are on the mailing lists. Its an open question whether we want to do this, on what timescale and whether we do the same with getVarFLag at the same time?

Paul confirmed that other layers don't have too many of these unexpanded getVar calls.

bitbake/lib/bb/data_smart.py +1 -1
index 9384ffd..1316671 100644
@@ -516,7 +516,7 @@ class DataSmart(MutableMapping):
                  if len(shortvar) == 0:
                      override = None
 
-    def getVar(self, var, expand=False, noweakdefault=False, parsing=False):
+    def getVar(self, var, expand, noweakdefault=False, parsing=False):
          return self.getVarFlag(var, "_content", expand, noweakdefault, parsing)
 
      def _clearOverrides(self, key):
#2 lore raw
Quoted 6 lines · Robert Yang
Quoted 3 lines · Richard Purdie

Rather than just d.getVar(X), force the use of the more explict d.getVar(X, False) since at some point in the future, having the default of expansion would be nice. This is the first step towards that.

Quoted 6 lines

Did you mean that in the future:

d.getVar("PN") equals d.getVar("PN", True) ?

That would be great since expand=True uses more frequently than False.

The idea would be to get there, yes. How quickly we could do it is a good question but this would be the first step.

Cheers,

Richard