[bitbake-devel] [PATCH 1/2] cooker.py: the var cre maybe undefined

Robert Yang liezhi.yang at windriver.com
Thu Jan 18 09:50:17 UTC 2018


Sorry, I just found that a better fix should be:

commit 6f2ee522a2a63cbb18d4b52cda9ee88bdfe80784
Author: Robert Yang <liezhi.yang at windriver.com>
Date:   Wed Jan 17 14:26:30 2018 +0800

     cooker.py: skip when BBFILE_PATTERN

     There is nothing to do when BBFILE_PATTERN is empty.

     Signed-off-by: Robert Yang <liezhi.yang at windriver.com>

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 28717f4..05d26f8 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1170,6 +1170,7 @@ class BBCooker:
                  elif regex == "":
                      parselog.debug(1, "BBFILE_PATTERN_%s is empty" % c)
                      errors = False
+                    continue
                  else:
                      try:
                          cre = re.compile(regex)


Updated in the repo:

   git://git.pokylinux.org/poky-contrib rbt/cooker
   http://git.pokylinux.org/cgit.cgi//log/?h=rbt/cooker

Robert Yang (2):
   cooker.py: the var cre maybe undefined
   cooker.py: fix for BBFILE_PATTERN matches bbappend

// Robert

On 01/17/2018 04:52 PM, Robert Yang wrote:
> The cre is not defined when re.compile(regex) raise errors, move the code where
> use it to the try block to fix the problem.
> 
> Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
> ---
>   lib/bb/cooker.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
> index 28717f4..ebfed0d 100644
> --- a/lib/bb/cooker.py
> +++ b/lib/bb/cooker.py
> @@ -1173,11 +1173,11 @@ class BBCooker:
>                   else:
>                       try:
>                           cre = re.compile(regex)
> +                        self.bbfile_config_priorities.append((c, regex, cre, collection_priorities[c]))
>                       except re.error:
>                           parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex)
>                           errors = True
>                           continue
> -                self.bbfile_config_priorities.append((c, regex, cre, collection_priorities[c]))
>           if errors:
>               # We've already printed the actual error(s)
>               raise CollectionError("Errors during parsing layer configuration")
> 



More information about the bitbake-devel mailing list