]> code.ossystems Code Review - openembedded-core.git/commitdiff
sanity: check that the en_US.UTF-8 locale exists
authorRoss Burton <ross.burton@intel.com>
Tue, 24 May 2016 16:37:45 +0000 (17:37 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 30 May 2016 08:30:29 +0000 (09:30 +0100)
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/sanity.bbclass

index 77813e41bcf03d0761be1a071b2b849bb1708403..3d5ace20a769a146c394f649975a1b4c7086d054 100644 (file)
@@ -765,6 +765,17 @@ def check_sanity_version_change(status, d):
     # Check that TMPDIR isn't located on nfs
     status.addresult(check_not_nfs(tmpdir, "TMPDIR"))
 
+def sanity_check_locale(d):
+    """
+    Currently bitbake switches locale to en_US.UTF-8 so check that this locale actually exists.
+    """
+    import locale
+    try:
+        locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
+    except locale.Error:
+        raise_sanity_error("You system needs to support the en_US.UTF-8 locale.", d)
+    locale.setlocale(locale.LC_ALL, "C")
+
 def check_sanity_everybuild(status, d):
     import os, stat
     # Sanity tests which test the users environment so need to run at each build (or are so cheap
@@ -784,6 +795,8 @@ def check_sanity_everybuild(status, d):
     if (LooseVersion(bb.__version__) < LooseVersion(minversion)):
         status.addresult('Bitbake version %s is required and version %s was found\n' % (minversion, bb.__version__))
 
+    sanity_check_locale(d)
+
     sanity_check_conffiles(status, d)
 
     paths = d.getVar('PATH', True).split(":")