[yocto] [autobuilder][PATCH] CreateAutoConf.py: check for empty env history variables before using

Beth 'pidge' Flanagan pidge at toganlabs.com
Mon Jun 27 05:27:28 PDT 2016


Pulled into master, thanks!

On Thu, 2016-06-23 at 12:03 -0700, Bill Randle wrote:
> I saw this error on a new AB setup:
> 
> File "/home/pokybuild/yocto-autobuilder/lib/python2.7/site-
> packages/autobuilder/buildsteps/CreateAutoConf.py", line 181, in
> start
>     ta_history_repos=ast.literal_eval(os.environ.get('BUILD_HISTORY_T
> HROWAWAY_WHITELIST').encode('utf-8'))
>     exceptions.AttributeError: 'NoneType' object has no attribute
> 'encode'
> 
> Since the code above line 181 checks for either
> BUILD_HISTORY_THROWAWAY_WHITELIST
> or BUILD_HISTORY_WHITELIST being set, it's possible one of them could
> be empty.
> 
> Signed-off-by: Bill Randle <william.c.randle at intel.com>
> ---
>  .../site-packages/autobuilder/buildsteps/CreateAutoConf.py        |
> 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/python2.7/site-
> packages/autobuilder/buildsteps/CreateAutoConf.py
> b/lib/python2.7/site-
> packages/autobuilder/buildsteps/CreateAutoConf.py
> index 0845ff1..91607e6 100644
> --- a/lib/python2.7/site-
> packages/autobuilder/buildsteps/CreateAutoConf.py
> +++ b/lib/python2.7/site-
> packages/autobuilder/buildsteps/CreateAutoConf.py
> @@ -177,9 +177,13 @@ class CreateAutoConf(ShellCommand):
>  
>                  if os.environ.get('BUILD_HISTORY_WHITELIST') is not
> None or \
>                     os.environ.get('BUILD_HISTORY_THROWAWAY_WHITELIST
> ') is not None:
> +                    ta_history_repos={}
> +                    history_repos={}
>                      fout = fout + 'ERROR_QA_remove = "version-going-
> backwards"\n'
> -                    ta_history_repos=ast.literal_eval(os.environ.get
> ('BUILD_HISTORY_THROWAWAY_WHITELIST').encode('utf-8'))
> -                    history_repos=ast.literal_eval(os.environ.get('B
> UILD_HISTORY_WHITELIST').encode('utf-8'))
> +                    if
> os.environ.get('BUILD_HISTORY_THROWAWAY_WHITELIST') is not None:
> +                        ta_history_repos=ast.literal_eval(os.environ
> .get('BUILD_HISTORY_THROWAWAY_WHITELIST').encode('utf-8'))
> +                    if os.environ.get('BUILD_HISTORY_WHITELIST') is
> not None:
> +                        history_repos=ast.literal_eval(os.environ.ge
> t('BUILD_HISTORY_WHITELIST').encode('utf-8'))
>                      if repo in history_repos.keys() and \
>                         self.getProperty("branch") in
> history_repos[self.getProperty("repository")]:
>                      # We keep this build history
-- 
Beth 'pidge' Flanagan <pidge at toganlabs.com>
toganlabs.com




More information about the yocto mailing list