summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/sanity.bbclass64
-rw-r--r--conf/sanity.conf2
2 files changed, 46 insertions, 20 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
+}
diff --git a/conf/sanity.conf b/conf/sanity.conf
index df2ec3e82a..93700ef145 100644
--- a/conf/sanity.conf
+++ b/conf/sanity.conf
@@ -3,6 +3,6 @@
# See sanity.bbclass
#
# Expert users can confirm their sanity with "touch conf/sanity.conf"
-
+BB_MIN_VERSION = "1.3.3"
INHERIT += "sanity"