[OE-core] [PATCH] sanity.bbclass: uppercase check for machine and distro
Yeoh Ee Peng
ee.peng.yeoh at intel.com
Sun Sep 24 19:52:37 UTC 2017
Uppercase in machine and distro will result in unexpected
behavior.
QA check will produce error message if it verified that
machine or distro is uppercase.
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh at intel.com>
---
meta/classes/sanity.bbclass | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 1feb794..82efaef 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -694,6 +694,13 @@ def sanity_check_locale(d):
except locale.Error:
raise_sanity_error("You system needs to support the en_US.UTF-8 locale.", d)
+def check_name_uppercase(type, name):
+ import re
+ messages = ""
+ if re.search('[A-Z]', name):
+ messages = messages + "%s: '%s' is uppercase. Please correct it to lowercase to avoid unexpected behavior.\n" % (type, name)
+ return messages
+
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
@@ -723,6 +730,7 @@ def check_sanity_everybuild(status, d):
# need to take into account DISTRO renaming DISTRO
distro = d.getVar('DISTRO')
if distro and distro != "nodistro":
+ status.addresult(check_name_uppercase('DISTRO', d.getVar('DISTRO')))
if not ( check_conf_exists("conf/distro/${DISTRO}.conf", d) or check_conf_exists("conf/distro/include/${DISTRO}.inc", d) ):
status.addresult("DISTRO '%s' not found. Please set a valid DISTRO in your local.conf\n" % d.getVar("DISTRO"))
@@ -743,6 +751,7 @@ def check_sanity_everybuild(status, d):
# Check that the MACHINE is valid, if it is set
machinevalid = True
if d.getVar('MACHINE'):
+ status.addresult(check_name_uppercase('MACHINE', d.getVar('MACHINE')))
if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
status.addresult('MACHINE=%s is invalid. Please set a valid MACHINE in your local.conf, environment or other configuration file.\n' % (d.getVar('MACHINE')))
machinevalid = False
--
2.7.4
More information about the Openembedded-core
mailing list