summaryrefslogtreecommitdiffstats
path: root/openembedded/classes/sanity.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-05-09 16:10:46 +0000
committerRichard Purdie <richard@openedhand.com>2006-05-09 16:10:46 +0000
commit189b9a916b845c90db5e51f62496a13f60936d36 (patch)
treee9227d9f63eea070317afffd41cbcdfed018753f /openembedded/classes/sanity.bbclass
parent8d41bd1c8f4c36ed9c1c73e0586031af8a0f292c (diff)
downloadpoky-189b9a916b845c90db5e51f62496a13f60936d36.tar.gz
Sync bbclass files with OE
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@374 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'openembedded/classes/sanity.bbclass')
-rw-r--r--openembedded/classes/sanity.bbclass68
1 files changed, 49 insertions, 19 deletions
diff --git a/openembedded/classes/sanity.bbclass b/openembedded/classes/sanity.bbclass
index f82af18d74..8253b27930 100644
--- a/openembedded/classes/sanity.bbclass
+++ b/openembedded/classes/sanity.bbclass
@@ -2,11 +2,9 @@
2# Sanity check the users setup for common misconfigurations 2# Sanity check the users setup for common misconfigurations
3# 3#
4 4
5BB_MIN_VERSION = "1.3.3"
6
7def raise_sanity_error(msg): 5def raise_sanity_error(msg):
8 import bb 6 import bb
9 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) 7 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)
10 8
11def check_conf_exists(fn, data): 9def check_conf_exists(fn, data):
12 import bb, os 10 import bb, os
@@ -22,37 +20,41 @@ def check_conf_exists(fn, data):
22 return True 20 return True
23 return False 21 return False
24 22
25addhandler check_sanity_eventhandler 23def check_app_exists(app, d):
26python check_sanity_eventhandler() { 24 from bb import which, data
25
26 app = data.expand(app, d)
27 path = data.getVar('PATH', d)
28 return len(which(path, app)) != 0
29
30
31def check_sanity(e):
27 from bb import note, error, data, __version__ 32 from bb import note, error, data, __version__
28 from bb.event import Handled, NotHandled, getName 33 from bb.event import Handled, NotHandled, getName
29 from distutils.version import LooseVersion 34 from distutils.version import LooseVersion
30 import os 35 import os
31 36
32 sanity_checked = bb.data.getVar('SANITY_CHECKED', e.data)
33 if sanity_checked == "1":
34 return
35
36 # Check the bitbake version meets minimum requirements 37 # Check the bitbake version meets minimum requirements
37 minversion = bb.data.getVar('BB_MIN_VERSION', e.data , True) 38 minversion = data.getVar('BB_MIN_VERSION', e.data , True)
38 if not minversion: 39 if not minversion:
39 # Hack: BB_MIN_VERSION hasn't been parsed yet so return 40 # Hack: BB_MIN_VERSION hasn't been parsed yet so return
40 # and wait for the next call 41 # and wait for the next call
42 print "Foo %s" % minversion
41 return 43 return
42 44
43 if (LooseVersion(bb.__version__) < LooseVersion(minversion)): 45 if (LooseVersion(__version__) < LooseVersion(minversion)):
44 raise_sanity_error('Bitbake version %s is required and version %s was found' % (minversion, bb.__version__)) 46 raise_sanity_error('Bitbake version %s is required and version %s was found' % (minversion, __version__))
45 47
46 # Check TARGET_ARCH is set 48 # Check TARGET_ARCH is set
47 if bb.data.getVar('TARGET_ARCH', e.data, True) == 'INVALID': 49 if data.getVar('TARGET_ARCH', e.data, True) == 'INVALID':
48 raise_sanity_error('Please set TARGET_ARCH directly, or choose a MACHINE or DISTRO that does so.') 50 raise_sanity_error('Please set TARGET_ARCH directly, or choose a MACHINE or DISTRO that does so.')
49 51
50 # Check TARGET_OS is set 52 # Check TARGET_OS is set
51 if bb.data.getVar('TARGET_OS', e.data, True) == 'INVALID': 53 if data.getVar('TARGET_OS', e.data, True) == 'INVALID':
52 raise_sanity_error('Please set TARGET_OS directly, or choose a MACHINE or DISTRO that does so.') 54 raise_sanity_error('Please set TARGET_OS directly, or choose a MACHINE or DISTRO that does so.')
53 55
54 # Check user doesn't have ASSUME_PROVIDED = instead of += in local.conf 56 # Check user doesn't have ASSUME_PROVIDED = instead of += in local.conf
55 if "diffstat-native" not in bb.data.getVar('ASSUME_PROVIDED', e.data, True).split(): 57 if "diffstat-native" not in data.getVar('ASSUME_PROVIDED', e.data, True).split():
56 raise_sanity_error('Please use ASSUME_PROVIDED +=, not ASSUME_PROVIDED = in your local.conf') 58 raise_sanity_error('Please use ASSUME_PROVIDED +=, not ASSUME_PROVIDED = in your local.conf')
57 59
58 # Check the MACHINE is valid 60 # Check the MACHINE is valid
@@ -62,8 +64,36 @@ python check_sanity_eventhandler() {
62 # Check the distro is valid 64 # Check the distro is valid
63 if not check_conf_exists("conf/distro/${DISTRO}.conf", e.data): 65 if not check_conf_exists("conf/distro/${DISTRO}.conf", e.data):
64 raise_sanity_error('Please set a valid DISTRO in your local.conf') 66 raise_sanity_error('Please set a valid DISTRO in your local.conf')
65
66 bb.data.setVar('SANITY_CHECKED', "1", e.data)
67 return
68}
69 67
68 if not check_app_exists("${MAKE}", e.data):
69 raise_sanity_error('GNU make missing. Please install GNU make')
70
71 if not check_app_exists('${BUILD_PREFIX}gcc', e.data):
72 raise_sanity_error('C Host-Compiler is missing, please install one' )
73
74 if not check_app_exists('${BUILD_PREFIX}g++', e.data):
75 raise_sanity_error('C++ Host-Compiler is missing, please install one' )
76
77 if not check_app_exists('patch', e.data):
78 raise_sanity_error('Please install the patch utility, preferable GNU patch.')
79
80 if not check_app_exists('diffstat', e.data):
81 raise_sanity_error('Please install the diffstat utility')
82
83 if not check_app_exists('texi2html', e.data):
84 raise_sanity_error('Please install the texi2html binary')
85
86 oes_bb_conf = data.getVar( 'OES_BITBAKE_CONF', e.data, True )
87 if not oes_bb_conf:
88 raise_sanity_error('You do not include OpenEmbeddeds version of conf/bitbake.conf')
89
90addhandler check_sanity_eventhandler
91python check_sanity_eventhandler() {
92 from bb import note, error, data, __version__
93 from bb.event import getName
94
95 if getName(e) == "BuildStarted":
96 check_sanity(e)
97
98 return NotHandled
99}