aboutsummaryrefslogtreecommitdiffstats
path: root/classes/sanity.bbclass
diff options
context:
space:
mode:
authorHolger Freyther <zecke@selfish.org>2006-04-07 21:22:26 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-04-07 21:22:26 +0000
commit2e5f3f0f8cbba0a438512c9ff5dab3a2d27df5f6 (patch)
tree696be37a49f97b670c6615ea2d59b5fe34c2c177 /classes/sanity.bbclass
parent6c97f56d28872da36cc0cc52631668985d8db22a (diff)
downloadopenembedded-2e5f3f0f8cbba0a438512c9ff5dab3a2d27df5f6.tar.gz
conf/sanity.conf:
Set BB_MIN_VERSION here classes/sanity.bbclass: -Run the sanitycheck exactly once (on BuildStart) -Check for common utilities/executables as well
Diffstat (limited to 'classes/sanity.bbclass')
-rw-r--r--classes/sanity.bbclass64
1 files changed, 45 insertions, 19 deletions
diff --git a/classes/sanity.bbclass b/classes/sanity.bbclass
index f82af18d74..f03564c607 100644
--- a/classes/sanity.bbclass
+++ b/classes/sanity.bbclass
@@ -2,11 +2,9 @@
# Sanity check the users setup for common misconfigurations
#
-BB_MIN_VERSION = "1.3.3"
-
def raise_sanity_error(msg):
import bb
- bb.fatal("Openembedded's config sanity checker detected a potential misconfiguration.\nEither fix cause of this error or at your own risk disable the checker (see sanity.conf).\n%s" % msg)
+ bb.fatal("Openembedded's config sanity checker detected a potential misconfiguration.\nEither fix the cause of this error or at your own risk disable the checker (see sanity.conf).\n%s" % msg)
def check_conf_exists(fn, data):
import bb, os
@@ -22,37 +20,41 @@ def check_conf_exists(fn, data):
return True
return False
-addhandler check_sanity_eventhandler
-python check_sanity_eventhandler() {
+def check_app_exists(app, d):
+ from bb import which, data
+
+ app = data.expand(app, d)
+ path = data.getVar('PATH', d)
+ return len(which(path, app)) != 0
+
+
+def check_sanity(e):
from bb import note, error, data, __version__
from bb.event import Handled, NotHandled, getName
from distutils.version import LooseVersion
import os
- sanity_checked = bb.data.getVar('SANITY_CHECKED', e.data)
- if sanity_checked == "1":
- return
-
# Check the bitbake version meets minimum requirements
- minversion = bb.data.getVar('BB_MIN_VERSION', e.data , True)
+ minversion = data.getVar('BB_MIN_VERSION', e.data , True)
if not minversion:
# Hack: BB_MIN_VERSION hasn't been parsed yet so return
# and wait for the next call
+ print "Foo %s" % minversion
return
- if (LooseVersion(bb.__version__) < LooseVersion(minversion)):
- raise_sanity_error('Bitbake version %s is required and version %s was found' % (minversion, bb.__version__))
+ if (LooseVersion(__version__) < LooseVersion(minversion)):
+ raise_sanity_error('Bitbake version %s is required and version %s was found' % (minversion, __version__))
# Check TARGET_ARCH is set
- if bb.data.getVar('TARGET_ARCH', e.data, True) == 'INVALID':
+ if data.getVar('TARGET_ARCH', e.data, True) == 'INVALID':
raise_sanity_error('Please set TARGET_ARCH directly, or choose a MACHINE or DISTRO that does so.')
# Check TARGET_OS is set
- if bb.data.getVar('TARGET_OS', e.data, True) == 'INVALID':
+ if data.getVar('TARGET_OS', e.data, True) == 'INVALID':
raise_sanity_error('Please set TARGET_OS directly, or choose a MACHINE or DISTRO that does so.')
# Check user doesn't have ASSUME_PROVIDED = instead of += in local.conf
- if "diffstat-native" not in bb.data.getVar('ASSUME_PROVIDED', e.data, True).split():
+ if "diffstat-native" not in data.getVar('ASSUME_PROVIDED', e.data, True).split():
raise_sanity_error('Please use ASSUME_PROVIDED +=, not ASSUME_PROVIDED = in your local.conf')
# Check the MACHINE is valid
@@ -62,8 +64,32 @@ python check_sanity_eventhandler() {
# Check the distro is valid
if not check_conf_exists("conf/distro/${DISTRO}.conf", e.data):
raise_sanity_error('Please set a valid DISTRO in your local.conf')
-
- bb.data.setVar('SANITY_CHECKED', "1", e.data)
- return
-}
+ if not check_app_exists("${MAKE}", e.data):
+ raise_sanity_error('GNU make missing. Please install GNU make')
+
+ if not check_app_exists('${BUILD_PREFIX}gcc', e.data):
+ raise_sanity_error('C Host-Compiler is missing, please install one' )
+
+ if not check_app_exists('${BUILD_PREFIX}g++', e.data):
+ raise_sanity_error('C++ Host-Compiler is missing, please install one' )
+
+ if not check_app_exists('patch', e.data):
+ raise_sanity_error('Please install the patch utility, preferable GNU patch.')
+
+ if not check_app_exists('diffstat', e.data):
+ raise_sanity_error('Please install the diffstat utilits')
+
+ if not check_app_exists('texi2html', e.data):
+ raise_sanity_error('Please install the texi2html binary')
+
+addhandler check_sanity_eventhandler
+python check_sanity_eventhandler() {
+ from bb import note, error, data, __version__
+ from bb.event import getName
+
+ if getName(e) == "BuildStarted":
+ check_sanity(e)
+
+ return NotHandled
+}