[yocto] [PATCH 2/2] [yocto-ab-helper] utils.py: Resolved unicode data expansion

Richard Purdie richard.purdie at linuxfoundation.org
Mon Jul 2 03:52:24 PDT 2018


On Mon, 2018-07-02 at 18:30 +0800, Aaron Chan wrote:
> A patch to fix the data expansion config.json
> 
> Signed-off-by: Aaron Chan <aaron.chun.yew.chan at intel.com>
> ---
>  scripts/utils.py | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/scripts/utils.py b/scripts/utils.py
> index 7c6535c..d26cd0c 100644
> --- a/scripts/utils.py
> +++ b/scripts/utils.py
> @@ -142,6 +142,22 @@ def loadconfig():
>              else:
>                  ourconfig[c][x] = config[c][x]
>  
> +    def resolvexp(pattern, config, c):
> +        try:
> +            strMatch = re.compile(pattern)
> +            expansion = strMatch.match(config[c]).group(1)
> +            reference = strMatch.match(config[c]).group(2)
> +            if reference:
> +                ourconfig[c] = config[c].replace(expansion, config[reference])
> +        except:
> +            pass
> +
> +    def handlestr(config, ourconfig, c):
> +        if not c in ourconfig:
> +            ourconfig[c] = config[c]
> +        if isinstance(config[c], str):
> +            resolvexp(r"(\${(.+)})", config, c)
> +        
>      ourconfig = {}
>      for f in files.split():
>          p = f

There is something wrong here as you don't ever call handlestr() which
means resolveexp() is also unused. As far as I can tell, this patch
therefore doesn't do anything.

I'm also puzzled why unicode data is causing a problem. Are you using
python 2 or 3? Can you give me an example of the kind of data which is
failing please?

Cheers,

Richard



More information about the yocto mailing list