[yocto] [autobuilder][PATCH] CreateAutoConf.py: check for empty env history variables before using
Bill Randle
william.c.randle at intel.com
Thu Jun 23 12:03:35 PDT 2016
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_THROWAWAY_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('BUILD_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.get('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
--
2.5.5
More information about the yocto
mailing list