On 2017-09-24 21:52, Yeoh Ee Peng wrote:
Uppercase in machine and distro will result in unexpected
behavior.
Wouldn't other checks make sense as well; e.g. underscore or starting
with "pn-" ?
I'd prefer a whitelist check instead of an ever growing number of
blacklist checks.
// Martin
QA check will produce error message if it verified that
machine or distro is uppercase.
Signed-off-by: Yeoh Ee Peng <[email protected]>
---
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
--
MARTIN HUNDEBØLL, Prevas A/S
Software Developer
Hedeager 3, DK-8200 Aarhus N
Phone +45 87438070
Mobile +45 25562438
[email protected]
www.prevas.com
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core