CreateAutoConf.py: check for empty env history variables before using
PATCH 1/1 CreateAutoConf.py: check for empty env history variables before using
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.
--- .../site-packages/autobuilder/buildsteps/CreateAutoConf.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
lib/python2.7/site-packages/autobuilder/buildsteps/CreateAutoConf.py +6 -2
@@ -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
Signature · 1 line
2.5.5
Pulled into master, thanks!
Quoted 56 lines · Bill Randle
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
orBUILD_HISTORY_WHITELISTbeing set, it's possible one of them could be empty.Signed-off-by Bill Randle <[email protected]>---
.../site-packages/autobuilder/buildsteps/CreateAutoConf.py | 8 ++++++--1 file changed, 6 insertions(+), 2 deletions(-)(quoted diff) +0
-0
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(quoted diff) +0
-0@@ -177,9 +177,13 @@ class CreateAutoConf(ShellCommand):
ifos.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'))
+ ifos.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')) + ifos.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 inhistory_repos.keys()and \
self.getProperty("branch") in history_repos[self.getProperty("repository")]:
# We keep this build history
Signature · 2 lines
Beth 'pidge' Flanagan <[email protected]> toganlabs.com