[OE-core] bb.data.*Var -> d.*Var conversion

Richard Purdie richard.purdie at linuxfoundation.org
Thu Nov 10 00:19:00 UTC 2011


On Wed, 2011-11-09 at 11:52 +0000, Richard Purdie wrote:
> I'm tempted to run the following over the metata to convert the
> bb.data.*Var(...,d) and similar expressions to the form d.*Var(...).
> 
> Why? We get a lot of people doing copy, paste and edit of the code and
> this way, we'll increase the chances of them finding better examples.
> 
> I'm still looking at the diff this generates to see if there are any
> more corner cases I need to tweak the expression for but feedback
> welcome.
> 
> sed \
> -e 's:bb.data.\(setVar([^,]*,[^,]*\), \([^ )]*\) *):\2.\1):g' \
> -e 's:bb.data.\(setVarFlag([^,]*,[^,]*,[^,]*\), \([^) ]*\) *):\2.\1):g' \
> -e 's:bb.data.\(getVar([^,]*\), \([^, ]*\) *,\([^)]*\)):\2.\1,\3):g' \
> -e 's:bb.data.\(getVarFlag([^,]*,[^,]*\), \([^, ]*\) *,\([^)]*\)):\2.\1,\3):g' \
> -e 's:bb.data.\(getVarFlag([^,]*,[^,]*\), \([^) ]*\) *):\2.\1):g' \
> -e 's:bb.data.\(getVar([^,]*\), \([^) ]*\) *):\2.\1):g' \
> -i `grep -ril bb.data *`

Incidentally this is worth about a 1.5% increase in parsing speed which
makes sense since it removed one level of function indirection.

Cheers,

Richard





More information about the Openembedded-core mailing list