From 1d0ad602b2a9ccc30d87a7bcf5cf4c01fcf6c188 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 21 Feb 2008 11:35:44 +0000 Subject: sanity.bbclass: Add ABI version number and checks so we can warn users when the 'abi' of TMPDIR changes. Add checks for qemu in various scenarios from poky. Add check TMPDIR hasn't moved from poky. Remove now unneeded bitbake version check. --- classes/sanity.bbclass | 67 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 10 deletions(-) (limited to 'classes/sanity.bbclass') diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass index 9994febf0d..9ef2f09fe0 100644 --- a/classes/sanity.bbclass +++ b/classes/sanity.bbclass @@ -2,6 +2,15 @@ # Sanity check the users setup for common misconfigurations # +# +# SANITY_ABI allows us to notify users when the format of TMPDIR changes in +# an incompatible way. Such changes should usually be detailed in the commit +# that breaks the format and have been previously discussed on the mailing list +# with general agreement from the core team. +# +SANITY_ABI = "0" +SANITY_ABIFILE = "${TMPDIR}/abi_version" + def raise_sanity_error(msg): import bb bb.fatal(""" Openembedded's config sanity checker detected a potential misconfiguration. @@ -31,7 +40,7 @@ def check_sanity(e): from distutils.version import LooseVersion except ImportError: def LooseVersion(v): print "WARNING: sanity.bbclass can't compare versions without python-distutils"; return 1 - import os + import os, commands # Check the bitbake version meets minimum requirements minversion = data.getVar('BB_MIN_VERSION', e.data , True) @@ -64,8 +73,8 @@ def check_sanity(e): # Check that the MACHINE is valid, if it is set if data.getVar('MACHINE', e.data, True): - if not check_conf_exists("conf/machine/${MACHINE}.conf", e.data): - messages = messages + 'Please set a valid MACHINE in your local.conf\n' + if not check_conf_exists("conf/machine/${MACHINE}.conf", e.data): + messages = messages + 'Please set a valid MACHINE in your local.conf\n' # Check that the DISTRO is valid # need to take into account DISTRO renaming DISTRO @@ -85,6 +94,19 @@ def check_sanity(e): required_utilities = "patch help2man diffstat texi2html makeinfo cvs svn bzip2 tar gzip gawk md5sum" + if data.getVar('TARGET_ARCH', e.data, True) == "arm": + # qemu-native needs gcc 3.x + if "qemu-native" not in assume_provided and "gcc3-native" in assume_provided: + gcc_version = commands.getoutput("${BUILD_PREFIX}gcc --version | head -n 1 | cut -f 3 -d ' '") + + if not check_gcc3(e.data) and gcc_version[0] != '3': + messages = messages + "gcc3-native was in ASSUME_PROVIDED but the gcc-3.x binary can't be found in PATH" + missing = missing + "gcc-3.x (needed for qemu-native)," + + if "qemu-native" in assume_provided: + if not check_app_exists("qemu-arm", e.data): + messages = messages + "qemu-native was in ASSUME_PROVIDED but the QEMU binaries (qemu-arm) can't be found in PATH" + for util in required_utilities.split(): if not check_app_exists( util, e.data ): missing = missing + "%s," % util @@ -100,7 +122,37 @@ def check_sanity(e): oes_bb_conf = data.getVar( 'OES_BITBAKE_CONF', e.data, True ) if not oes_bb_conf: - messages = messages + 'You do not include OpenEmbeddeds version of conf/bitbake.conf\n' + messages = messages + 'You do not include OpenEmbeddeds version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n' + + # + # Check that TMPDIR hasn't changed location since the last time we were run + # + tmpdir = data.getVar('TMPDIR', e.data, True) + checkfile = os.path.join(tmpdir, "saved_tmpdir") + if os.path.exists(checkfile): + f = file(checkfile, "r") + if (f.read().strip() != tmpdir): + messages = messages + "Error, TMPDIR has changed location. You need to either move it back to %s or rebuild\n" % tmpdir + else: + f = file(checkfile, "w") + f.write(tmpdir) + f.close() + + # + # Check the 'ABI' of TMPDIR + # + current_abi = data.getVar('SANITY_ABI', e.data, True) + abifile = data.getVar('SANITY_ABIFILE', e.data, True) + if os.path.exists(abifile): + f = file(abifile, "r") + abi = f.read().strip() + if (abi != current_abi): + # Code to convert from one ABI to another could go here if possible. + messages = messages + "Error, TMPDIR has changed ABI (%s to %s) and you need to either rebuild, revert or adjust it at your own risk.\n" % (abi, current_abi) + else: + f = file(abifile, "w") + f.write(current_abi) + f.close() if messages != "": raise_sanity_error(messages) @@ -115,12 +167,7 @@ python check_sanity_eventhandler() { except ImportError: def LooseVersion(v): print "WARNING: sanity.bbclass can't compare versions without python-distutils"; return 1 - if (LooseVersion(bb.__version__) > LooseVersion("1.8.6")): - if getName(e) == "ConfigParsed": - check_sanity(e) - return NotHandled - - if getName(e) == "BuildStarted": + if getName(e) == "ConfigParsed": check_sanity(e) return NotHandled -- cgit v1.2.3 From 4bc37472f48c57a434b5fc479050541cfe869e75 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 21 Feb 2008 13:17:28 +0000 Subject: sanity.bbclass: Remove some now unneeded code --- classes/sanity.bbclass | 5 ----- 1 file changed, 5 deletions(-) (limited to 'classes/sanity.bbclass') diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass index 9ef2f09fe0..08b077a1e1 100644 --- a/classes/sanity.bbclass +++ b/classes/sanity.bbclass @@ -162,11 +162,6 @@ python check_sanity_eventhandler() { from bb import note, error, data, __version__ from bb.event import getName - try: - from distutils.version import LooseVersion - except ImportError: - def LooseVersion(v): print "WARNING: sanity.bbclass can't compare versions without python-distutils"; return 1 - if getName(e) == "ConfigParsed": check_sanity(e) -- cgit v1.2.3 From 6ca016b5ae51f6384315e5648915d0e94a48ba97 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 23 Feb 2008 18:07:14 +0000 Subject: sanity: Move variable declarations to sanity.conf to workaround problems with bitbake 1.8.10 --- classes/sanity.bbclass | 9 --------- 1 file changed, 9 deletions(-) (limited to 'classes/sanity.bbclass') diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass index 08b077a1e1..f0ffa5c31a 100644 --- a/classes/sanity.bbclass +++ b/classes/sanity.bbclass @@ -2,15 +2,6 @@ # Sanity check the users setup for common misconfigurations # -# -# SANITY_ABI allows us to notify users when the format of TMPDIR changes in -# an incompatible way. Such changes should usually be detailed in the commit -# that breaks the format and have been previously discussed on the mailing list -# with general agreement from the core team. -# -SANITY_ABI = "0" -SANITY_ABIFILE = "${TMPDIR}/abi_version" - def raise_sanity_error(msg): import bb bb.fatal(""" Openembedded's config sanity checker detected a potential misconfiguration. -- cgit v1.2.3 From bbaf9d820b71fa259dc9c5ca28c059108d8f8203 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 23 Feb 2008 19:17:11 +0000 Subject: sanity.bbclass: Cope with empty abi files generated by previous issues --- classes/sanity.bbclass | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'classes/sanity.bbclass') diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass index f0ffa5c31a..44c74a0354 100644 --- a/classes/sanity.bbclass +++ b/classes/sanity.bbclass @@ -137,7 +137,10 @@ def check_sanity(e): if os.path.exists(abifile): f = file(abifile, "r") abi = f.read().strip() - if (abi != current_abi): + if not abi.isdigit(): + f = file(abifile, "w") + f.write(current_abi) + elif (abi != current_abi): # Code to convert from one ABI to another could go here if possible. messages = messages + "Error, TMPDIR has changed ABI (%s to %s) and you need to either rebuild, revert or adjust it at your own risk.\n" % (abi, current_abi) else: -- cgit v1.2.3