diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-04-01 15:28:15 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-04-09 17:00:00 +0100 |
commit | 1d631fba8a76a3f29ff94bdb63c6e8ac140f9e70 (patch) | |
tree | 08fa00afa176d88e28ba10a55bd98b70f5e1bfe8 /bitbake | |
parent | 70288db2e94c100b0b4c74e1260923fc5ce26d25 (diff) | |
download | ast2050-yocto-poky-1d631fba8a76a3f29ff94bdb63c6e8ac140f9e70.zip ast2050-yocto-poky-1d631fba8a76a3f29ff94bdb63c6e8ac140f9e70.tar.gz |
bitbake: toaster: do not load all available timezones
This patch makes sure that we only load pytz-recognized
timezones. Pytz is used to transform the timezone information
for the database queries, and needs to be able to deal with
the TIME_ZONE value that we set up.
[YOCTO #6093]
(Bitbake rev: bfe67472e3ee778b78ef004b2153fa88b3807b92)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index e26ee3c..6e9d85d 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py @@ -64,7 +64,15 @@ else: for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH): for fn in filenames: filepath = os.path.join(dirpath, fn) - zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = filepath.lstrip(ZONEINFOPATH).strip() + try: + import pytz + from pytz.exceptions import UnknownTimeZoneError + zonename = filepath.lstrip(ZONEINFOPATH).strip() + if pytz.timezone(zonename) is not None: + zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename + except UnknownTimeZoneError, ValueError: + # we expect timezone failures here, just move over + pass TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] |