summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2010-12-16 16:25:13 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2010-12-20 14:54:02 +0000
commit1993ca1f8790ff5bddc347ff22c78fd1c618739a (patch)
treefbe75d51a3e582e57069f305ff8518adab4d1aa2
parent2ec7757a48f298232bf9918a55b46503d5d21025 (diff)
downloadpoky-1993ca1f8790ff5bddc347ff22c78fd1c618739a.tar.gz
sanity.bbclass: allow minimisation of impact of more invasive sanity checks
Add a mechanism to avoid running more invasive checks every time bitbake is invoked. Adds a file in conf/ (i.e. under user's build directory) that tracks a new variable SANITY_VERSION (set in sanity.conf) as well as TMPDIR and SSTATE_DIR, allowing checks to be run when these are changed. Fixes [BUGID #562] Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--meta/classes/sanity.bbclass48
-rw-r--r--meta/conf/sanity.conf1
2 files changed, 48 insertions, 1 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 6dc4716af4..969cc2e59b 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -21,6 +21,18 @@ def check_conf_exists(fn, data):
21 return True 21 return True
22 return False 22 return False
23 23
24def check_sanity_sstate_dir_change():
25 # Sanity checks to be done when the value of SSTATE_DIR changes
26 return ""
27
28def check_sanity_tmpdir_change():
29 # Sanity checks to be done when the value of TMPDIR changes
30 return ""
31
32def check_sanity_version_change():
33 # Sanity checks to be done when SANITY_VERSION changes
34 return ""
35
24def check_sanity(e): 36def check_sanity(e):
25 from bb import note, error, data, __version__ 37 from bb import note, error, data, __version__
26 38
@@ -173,10 +185,44 @@ def check_sanity(e):
173 if os.path.exists('%s/libc.so.6' % lib32path) and not os.path.exists('/usr/include/gnu/stubs-32.h'): 185 if os.path.exists('%s/libc.so.6' % lib32path) and not os.path.exists('/usr/include/gnu/stubs-32.h'):
174 messages = messages + "You have a 32-bit libc, but no 32-bit headers. You must install the 32-bit libc headers.\n" 186 messages = messages + "You have a 32-bit libc, but no 32-bit headers. You must install the 32-bit libc headers.\n"
175 187
188 tmpdir = data.getVar('TMPDIR', e.data, True)
189 sstate_dir = data.getVar('SSTATE_DIR', e.data, True)
190
191 # Check saved sanity info
192 last_sanity_version = 0
193 last_tmpdir = ""
194 last_sstate_dir = ""
195 sanityverfile = 'conf/sanity_info'
196 if os.path.exists(sanityverfile):
197 f = file(sanityverfile, 'r')
198 for line in f:
199 if line.startswith('SANITY_VERSION'):
200 last_sanity_version = int(line.split()[1])
201 if line.startswith('TMPDIR'):
202 last_tmpdir = line.split()[1]
203 if line.startswith('SSTATE_DIR'):
204 last_sstate_dir = line.split()[1]
205
206 sanity_version = int(data.getVar('SANITY_VERSION', e.data, True) or 1)
207 if last_sanity_version < sanity_version:
208 messages = messages + check_sanity_version_change()
209 messages = messages + check_sanity_tmpdir_change()
210 messages = messages + check_sanity_sstate_dir_change()
211 else:
212 if last_tmpdir != tmpdir:
213 messages = messages + check_sanity_tmpdir_change()
214 if last_sstate_dir != sstate_dir:
215 messages = messages + check_sanity_sstate_dir_change()
216
217 if os.path.exists("conf"):
218 f = file(sanityverfile, 'w')
219 f.write("SANITY_VERSION %s\n" % sanity_version)
220 f.write("TMPDIR %s\n" % tmpdir)
221 f.write("SSTATE_DIR %s\n" % sstate_dir)
222
176 # 223 #
177 # Check that TMPDIR hasn't changed location since the last time we were run 224 # Check that TMPDIR hasn't changed location since the last time we were run
178 # 225 #
179 tmpdir = data.getVar('TMPDIR', e.data, True)
180 checkfile = os.path.join(tmpdir, "saved_tmpdir") 226 checkfile = os.path.join(tmpdir, "saved_tmpdir")
181 if os.path.exists(checkfile): 227 if os.path.exists(checkfile):
182 f = file(checkfile, "r") 228 f = file(checkfile, "r")
diff --git a/meta/conf/sanity.conf b/meta/conf/sanity.conf
index eab7619022..1fbeb61aad 100644
--- a/meta/conf/sanity.conf
+++ b/meta/conf/sanity.conf
@@ -7,6 +7,7 @@ BB_MIN_VERSION = "1.8.10"
7 7
8SANITY_ABIFILE = "${TMPDIR}/abi_version" 8SANITY_ABIFILE = "${TMPDIR}/abi_version"
9 9
10SANITY_VERSION = "1"
10POKY_CONF_VERSION = "1" 11POKY_CONF_VERSION = "1"
11LAYER_CONF_VERSION = "3" 12LAYER_CONF_VERSION = "3"
12SITE_CONF_VERSION = "1" 13SITE_CONF_VERSION = "1"