summaryrefslogtreecommitdiffstats
path: root/meta/classes/sanity.bbclass
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2012-05-23 15:16:19 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-24 08:51:40 +0100
commit198304539159cdabb28a097c20fd939c73156172 (patch)
treee220f1a552edc3e978c74d6cd597e3955a25a38f /meta/classes/sanity.bbclass
parent6a4c55df3c4915a5b5dad1daca71abebc2472c59 (diff)
downloadpoky-198304539159cdabb28a097c20fd939c73156172.tar.gz
sanity.bbclass: copy the data store and finalise before running checks
At the ConfigParsed event the datastore has yet to be finalised and thus appends and overrides have not been set. To ensure the sanity check is being run against the configuration values the user has set call finalize() on a copy of the datastore and pass that for all sanity checks. (From OE-Core rev: 71142172efc0f44a50216550c2b6cc3094fdc21d) Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sanity.bbclass')
-rw-r--r--meta/classes/sanity.bbclass129
1 files changed, 69 insertions, 60 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 05545f45f7..5361f1fe2f 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -182,8 +182,8 @@ def check_connectivity(d):
182 182
183 return retval 183 return retval
184 184
185def check_supported_distro(e): 185def check_supported_distro(sanity_data):
186 tested_distros = e.data.getVar('SANITY_TESTED_DISTROS', True) 186 tested_distros = sanity_data.getVar('SANITY_TESTED_DISTROS', True)
187 if not tested_distros: 187 if not tested_distros:
188 return 188 return
189 189
@@ -230,26 +230,26 @@ def check_supported_distro(e):
230 bb.warn('Host distribution could not be determined; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.') 230 bb.warn('Host distribution could not be determined; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.')
231 231
232# Checks we should only make if MACHINE is set correctly 232# Checks we should only make if MACHINE is set correctly
233def check_sanity_validmachine(e): 233def check_sanity_validmachine(sanity_data):
234 from bb import data 234 from bb import data
235 235
236 messages = "" 236 messages = ""
237 237
238 # Check TUNE_ARCH is set 238 # Check TUNE_ARCH is set
239 if data.getVar('TUNE_ARCH', e.data, True) == 'INVALID': 239 if data.getVar('TUNE_ARCH', sanity_data, True) == 'INVALID':
240 messages = messages + 'TUNE_ARCH is unset. Please ensure your MACHINE configuration includes a valid tune configuration file which will set this correctly.\n' 240 messages = messages + 'TUNE_ARCH is unset. Please ensure your MACHINE configuration includes a valid tune configuration file which will set this correctly.\n'
241 241
242 # Check TARGET_ARCH is set correctly 242 # Check TARGET_ARCH is set correctly
243 if data.getVar('TARGE_ARCH', e.data, False) == '${TUNE_ARCH}': 243 if data.getVar('TARGE_ARCH', sanity_data, False) == '${TUNE_ARCH}':
244 messages = messages + 'TARGET_ARCH is being overwritten, likely by your MACHINE configuration files.\nPlease use a valid tune configuration file which should set this correctly automatically\nand avoid setting this in the machine configuration. See the OE-Core mailing list for more information.\n' 244 messages = messages + 'TARGET_ARCH is being overwritten, likely by your MACHINE configuration files.\nPlease use a valid tune configuration file which should set this correctly automatically\nand avoid setting this in the machine configuration. See the OE-Core mailing list for more information.\n'
245 245
246 # Check TARGET_OS is set 246 # Check TARGET_OS is set
247 if data.getVar('TARGET_OS', e.data, True) == 'INVALID': 247 if data.getVar('TARGET_OS', sanity_data, True) == 'INVALID':
248 messages = messages + 'Please set TARGET_OS directly, or choose a MACHINE or DISTRO that does so.\n' 248 messages = messages + 'Please set TARGET_OS directly, or choose a MACHINE or DISTRO that does so.\n'
249 249
250 # Check that we don't have duplicate entries in PACKAGE_ARCHS & that TUNE_PKGARCH is in PACKAGE_ARCHS 250 # Check that we don't have duplicate entries in PACKAGE_ARCHS & that TUNE_PKGARCH is in PACKAGE_ARCHS
251 pkgarchs = data.getVar('PACKAGE_ARCHS', e.data, True) 251 pkgarchs = data.getVar('PACKAGE_ARCHS', sanity_data, True)
252 tunepkg = data.getVar('TUNE_PKGARCH', e.data, True) 252 tunepkg = data.getVar('TUNE_PKGARCH', sanity_data, True)
253 tunefound = False 253 tunefound = False
254 seen = {} 254 seen = {}
255 dups = [] 255 dups = []
@@ -271,7 +271,7 @@ def check_sanity_validmachine(e):
271 return messages 271 return messages
272 272
273 273
274def check_sanity(e): 274def check_sanity(sanity_data):
275 from bb import note, error, data, __version__ 275 from bb import note, error, data, __version__
276 276
277 try: 277 try:
@@ -281,7 +281,7 @@ def check_sanity(e):
281 import commands 281 import commands
282 282
283 # Check the bitbake version meets minimum requirements 283 # Check the bitbake version meets minimum requirements
284 minversion = data.getVar('BB_MIN_VERSION', e.data , True) 284 minversion = data.getVar('BB_MIN_VERSION', sanity_data , True)
285 if not minversion: 285 if not minversion:
286 # Hack: BB_MIN_VERSION hasn't been parsed yet so return 286 # Hack: BB_MIN_VERSION hasn't been parsed yet so return
287 # and wait for the next call 287 # and wait for the next call
@@ -303,42 +303,42 @@ def check_sanity(e):
303 messages = messages + 'Bitbake version %s is required and version %s was found\n' % (minversion, __version__) 303 messages = messages + 'Bitbake version %s is required and version %s was found\n' % (minversion, __version__)
304 304
305 # Check that the MACHINE is valid, if it is set 305 # Check that the MACHINE is valid, if it is set
306 if data.getVar('MACHINE', e.data, True): 306 if data.getVar('MACHINE', sanity_data, True):
307 if not check_conf_exists("conf/machine/${MACHINE}.conf", e.data): 307 if not check_conf_exists("conf/machine/${MACHINE}.conf", sanity_data):
308 messages = messages + 'Please set a valid MACHINE in your local.conf or environment\n' 308 messages = messages + 'Please set a valid MACHINE in your local.conf or environment\n'
309 else: 309 else:
310 messages = messages + check_sanity_validmachine(e) 310 messages = messages + check_sanity_validmachine(sanity_data)
311 else: 311 else:
312 messages = messages + 'Please set a MACHINE in your local.conf or environment\n' 312 messages = messages + 'Please set a MACHINE in your local.conf or environment\n'
313 313
314 # Check we are using a valid lacal.conf 314 # Check we are using a valid lacal.conf
315 current_conf = data.getVar('CONF_VERSION', e.data, True) 315 current_conf = data.getVar('CONF_VERSION', sanity_data, True)
316 conf_version = data.getVar('LOCALCONF_VERSION', e.data, True) 316 conf_version = data.getVar('LOCALCONF_VERSION', sanity_data, True)
317 317
318 if current_conf != conf_version: 318 if current_conf != conf_version:
319 messages = messages + "Your version of local.conf was generated from an older version of local.conf.sample and there have been updates made to this file. Please compare the two files and merge any changes before continuing.\nMatching the version numbers will remove this message.\n\"meld conf/local.conf conf/local.conf.sample\" is a good way to visualise the changes.\n" 319 messages = messages + "Your version of local.conf was generated from an older version of local.conf.sample and there have been updates made to this file. Please compare the two files and merge any changes before continuing.\nMatching the version numbers will remove this message.\n\"meld conf/local.conf conf/local.conf.sample\" is a good way to visualise the changes.\n"
320 320
321 # Check bblayers.conf is valid 321 # Check bblayers.conf is valid
322 current_lconf = data.getVar('LCONF_VERSION', e.data, True) 322 current_lconf = data.getVar('LCONF_VERSION', sanity_data, True)
323 lconf_version = data.getVar('LAYER_CONF_VERSION', e.data, True) 323 lconf_version = data.getVar('LAYER_CONF_VERSION', sanity_data, True)
324 if current_lconf != lconf_version: 324 if current_lconf != lconf_version:
325 messages = messages + "Your version of bblayers.conf was generated from an older version of bblayers.conf.sample and there have been updates made to this file. Please compare the two files and merge any changes before continuing.\nMatching the version numbers will remove this message.\n\"meld conf/bblayers.conf conf/bblayers.conf.sample\" is a good way to visualise the changes.\n" 325 messages = messages + "Your version of bblayers.conf was generated from an older version of bblayers.conf.sample and there have been updates made to this file. Please compare the two files and merge any changes before continuing.\nMatching the version numbers will remove this message.\n\"meld conf/bblayers.conf conf/bblayers.conf.sample\" is a good way to visualise the changes.\n"
326 326
327 # If we have a site.conf, check it's valid 327 # If we have a site.conf, check it's valid
328 if check_conf_exists("conf/site.conf", e.data): 328 if check_conf_exists("conf/site.conf", sanity_data):
329 current_sconf = data.getVar('SCONF_VERSION', e.data, True) 329 current_sconf = data.getVar('SCONF_VERSION', sanity_data, True)
330 sconf_version = data.getVar('SITE_CONF_VERSION', e.data, True) 330 sconf_version = data.getVar('SITE_CONF_VERSION', sanity_data, True)
331 if current_sconf != sconf_version: 331 if current_sconf != sconf_version:
332 messages = messages + "Your version of site.conf was generated from an older version of site.conf.sample and there have been updates made to this file. Please compare the two files and merge any changes before continuing.\nMatching the version numbers will remove this message.\n\"meld conf/site.conf conf/site.conf.sample\" is a good way to visualise the changes.\n" 332 messages = messages + "Your version of site.conf was generated from an older version of site.conf.sample and there have been updates made to this file. Please compare the two files and merge any changes before continuing.\nMatching the version numbers will remove this message.\n\"meld conf/site.conf conf/site.conf.sample\" is a good way to visualise the changes.\n"
333 333
334 assume_provided = data.getVar('ASSUME_PROVIDED', e.data , True).split() 334 assume_provided = data.getVar('ASSUME_PROVIDED', sanity_data , True).split()
335 # Check user doesn't have ASSUME_PROVIDED = instead of += in local.conf 335 # Check user doesn't have ASSUME_PROVIDED = instead of += in local.conf
336 if "diffstat-native" not in assume_provided: 336 if "diffstat-native" not in assume_provided:
337 messages = messages + 'Please use ASSUME_PROVIDED +=, not ASSUME_PROVIDED = in your local.conf\n' 337 messages = messages + 'Please use ASSUME_PROVIDED +=, not ASSUME_PROVIDED = in your local.conf\n'
338 338
339 # Check that DL_DIR is set, exists and is writable. In theory, we should never even hit the check if DL_DIR isn't 339 # Check that DL_DIR is set, exists and is writable. In theory, we should never even hit the check if DL_DIR isn't
340 # set, since so much relies on it being set. 340 # set, since so much relies on it being set.
341 dldir = data.getVar('DL_DIR', e.data, True) 341 dldir = data.getVar('DL_DIR', sanity_data, True)
342 if not dldir: 342 if not dldir:
343 messages = messages + "DL_DIR is not set. Your environment is misconfigured, check that DL_DIR is set, and if the directory exists, that it is writable. \n" 343 messages = messages + "DL_DIR is not set. Your environment is misconfigured, check that DL_DIR is set, and if the directory exists, that it is writable. \n"
344 if os.path.exists(dldir) and not os.access(dldir, os.W_OK): 344 if os.path.exists(dldir) and not os.access(dldir, os.W_OK):
@@ -346,33 +346,33 @@ def check_sanity(e):
346 346
347 # Check that the DISTRO is valid, if set 347 # Check that the DISTRO is valid, if set
348 # need to take into account DISTRO renaming DISTRO 348 # need to take into account DISTRO renaming DISTRO
349 distro = data.getVar('DISTRO', e.data, True) 349 distro = data.getVar('DISTRO', sanity_data, True)
350 if distro: 350 if distro:
351 if not ( check_conf_exists("conf/distro/${DISTRO}.conf", e.data) or check_conf_exists("conf/distro/include/${DISTRO}.inc", e.data) ): 351 if not ( check_conf_exists("conf/distro/${DISTRO}.conf", sanity_data) or check_conf_exists("conf/distro/include/${DISTRO}.inc", sanity_data) ):
352 messages = messages + "DISTRO '%s' not found. Please set a valid DISTRO in your local.conf\n" % data.getVar("DISTRO", e.data, True ) 352 messages = messages + "DISTRO '%s' not found. Please set a valid DISTRO in your local.conf\n" % data.getVar("DISTRO", sanity_data, True )
353 353
354 missing = "" 354 missing = ""
355 355
356 if not check_app_exists("${MAKE}", e.data): 356 if not check_app_exists("${MAKE}", sanity_data):
357 missing = missing + "GNU make," 357 missing = missing + "GNU make,"
358 358
359 if not check_app_exists('${BUILD_PREFIX}gcc', e.data): 359 if not check_app_exists('${BUILD_PREFIX}gcc', sanity_data):
360 missing = missing + "C Compiler (%sgcc)," % data.getVar("BUILD_PREFIX", e.data, True) 360 missing = missing + "C Compiler (%sgcc)," % data.getVar("BUILD_PREFIX", sanity_data, True)
361 361
362 if not check_app_exists('${BUILD_PREFIX}g++', e.data): 362 if not check_app_exists('${BUILD_PREFIX}g++', sanity_data):
363 missing = missing + "C++ Compiler (%sg++)," % data.getVar("BUILD_PREFIX", e.data, True) 363 missing = missing + "C++ Compiler (%sg++)," % data.getVar("BUILD_PREFIX", sanity_data, True)
364 364
365 required_utilities = e.data.getVar('SANITY_REQUIRED_UTILITIES', True) 365 required_utilities = sanity_data.getVar('SANITY_REQUIRED_UTILITIES', True)
366 366
367 if "qemu-native" in assume_provided: 367 if "qemu-native" in assume_provided:
368 if not check_app_exists("qemu-arm", e.data): 368 if not check_app_exists("qemu-arm", sanity_data):
369 messages = messages + "qemu-native was in ASSUME_PROVIDED but the QEMU binaries (qemu-arm) can't be found in PATH" 369 messages = messages + "qemu-native was in ASSUME_PROVIDED but the QEMU binaries (qemu-arm) can't be found in PATH"
370 370
371 paths = data.getVar('PATH', e.data, True).split(":") 371 paths = data.getVar('PATH', sanity_data, True).split(":")
372 if "." in paths or "" in paths: 372 if "." in paths or "" in paths:
373 messages = messages + "PATH contains '.' or '', which will break the build, please remove this." 373 messages = messages + "PATH contains '.' or '', which will break the build, please remove this."
374 374
375 if data.getVar('TARGET_ARCH', e.data, True) == "arm": 375 if data.getVar('TARGET_ARCH', sanity_data, True) == "arm":
376 # This path is no longer user-readable in modern (very recent) Linux 376 # This path is no longer user-readable in modern (very recent) Linux
377 try: 377 try:
378 if os.path.exists("/proc/sys/vm/mmap_min_addr"): 378 if os.path.exists("/proc/sys/vm/mmap_min_addr"):
@@ -386,7 +386,7 @@ def check_sanity(e):
386 pass 386 pass
387 387
388 for util in required_utilities.split(): 388 for util in required_utilities.split():
389 if not check_app_exists( util, e.data ): 389 if not check_app_exists( util, sanity_data ):
390 missing = missing + "%s," % util 390 missing = missing + "%s," % util
391 391
392 if missing != "": 392 if missing != "":
@@ -397,13 +397,13 @@ def check_sanity(e):
397 if pseudo_msg != "": 397 if pseudo_msg != "":
398 messages = messages + pseudo_msg + '\n' 398 messages = messages + pseudo_msg + '\n'
399 399
400 check_supported_distro(e) 400 check_supported_distro(sanity_data)
401 toolchain_msg = check_toolchain(e.data) 401 toolchain_msg = check_toolchain(sanity_data)
402 if toolchain_msg != "": 402 if toolchain_msg != "":
403 messages = messages + toolchain_msg + '\n' 403 messages = messages + toolchain_msg + '\n'
404 404
405 # Check if DISPLAY is set if IMAGETEST is set 405 # Check if DISPLAY is set if IMAGETEST is set
406 if not data.getVar( 'DISPLAY', e.data, True ) and data.getVar( 'IMAGETEST', e.data, True ) == 'qemu': 406 if not data.getVar( 'DISPLAY', sanity_data, True ) and data.getVar( 'IMAGETEST', sanity_data, True ) == 'qemu':
407 messages = messages + 'qemuimagetest needs a X desktop to start qemu, please set DISPLAY correctly (e.g. DISPLAY=:1.0)\n' 407 messages = messages + 'qemuimagetest needs a X desktop to start qemu, please set DISPLAY correctly (e.g. DISPLAY=:1.0)\n'
408 408
409 omask = os.umask(022) 409 omask = os.umask(022)
@@ -411,11 +411,11 @@ def check_sanity(e):
411 messages = messages + "Please use a umask which allows a+rx and u+rwx\n" 411 messages = messages + "Please use a umask which allows a+rx and u+rwx\n"
412 os.umask(omask) 412 os.umask(omask)
413 413
414 oes_bb_conf = data.getVar( 'OES_BITBAKE_CONF', e.data, True ) 414 oes_bb_conf = data.getVar( 'OES_BITBAKE_CONF', sanity_data, True )
415 if not oes_bb_conf: 415 if not oes_bb_conf:
416 messages = messages + 'You do not include OpenEmbeddeds version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n' 416 messages = messages + 'You do not include OpenEmbeddeds version of conf/bitbake.conf. This means your environment is misconfigured, in particular check BBPATH.\n'
417 417
418 nolibs = data.getVar('NO32LIBS', e.data, True) 418 nolibs = data.getVar('NO32LIBS', sanity_data, True)
419 if not nolibs: 419 if not nolibs:
420 lib32path = '/lib' 420 lib32path = '/lib'
421 if os.path.exists('/lib64') and ( os.path.islink('/lib64') or os.path.islink('/lib') ): 421 if os.path.exists('/lib64') and ( os.path.islink('/lib64') or os.path.islink('/lib') ):
@@ -424,8 +424,8 @@ def check_sanity(e):
424 if os.path.exists('%s/libc.so.6' % lib32path) and not os.path.exists('/usr/include/gnu/stubs-32.h'): 424 if os.path.exists('%s/libc.so.6' % lib32path) and not os.path.exists('/usr/include/gnu/stubs-32.h'):
425 messages = messages + "You have a 32-bit libc, but no 32-bit headers. You must install the 32-bit libc headers.\n" 425 messages = messages + "You have a 32-bit libc, but no 32-bit headers. You must install the 32-bit libc headers.\n"
426 426
427 tmpdir = data.getVar('TMPDIR', e.data, True) 427 tmpdir = data.getVar('TMPDIR', sanity_data, True)
428 sstate_dir = data.getVar('SSTATE_DIR', e.data, True) 428 sstate_dir = data.getVar('SSTATE_DIR', sanity_data, True)
429 429
430 # Check saved sanity info 430 # Check saved sanity info
431 last_sanity_version = 0 431 last_sanity_version = 0
@@ -442,16 +442,16 @@ def check_sanity(e):
442 if line.startswith('SSTATE_DIR'): 442 if line.startswith('SSTATE_DIR'):
443 last_sstate_dir = line.split()[1] 443 last_sstate_dir = line.split()[1]
444 444
445 sanity_version = int(data.getVar('SANITY_VERSION', e.data, True) or 1) 445 sanity_version = int(data.getVar('SANITY_VERSION', sanity_data, True) or 1)
446 if last_sanity_version < sanity_version: 446 if last_sanity_version < sanity_version:
447 messages = messages + check_sanity_version_change(e.data) 447 messages = messages + check_sanity_version_change(sanity_data)
448 messages = messages + check_sanity_tmpdir_change(tmpdir, e.data) 448 messages = messages + check_sanity_tmpdir_change(tmpdir, sanity_data)
449 messages = messages + check_sanity_sstate_dir_change(sstate_dir, e.data) 449 messages = messages + check_sanity_sstate_dir_change(sstate_dir, sanity_data)
450 else: 450 else:
451 if last_tmpdir != tmpdir: 451 if last_tmpdir != tmpdir:
452 messages = messages + check_sanity_tmpdir_change(tmpdir, e.data) 452 messages = messages + check_sanity_tmpdir_change(tmpdir, sanity_data)
453 if last_sstate_dir != sstate_dir: 453 if last_sstate_dir != sstate_dir:
454 messages = messages + check_sanity_sstate_dir_change(sstate_dir, e.data) 454 messages = messages + check_sanity_sstate_dir_change(sstate_dir, sanity_data)
455 455
456 if os.path.exists("conf") and not messages: 456 if os.path.exists("conf") and not messages:
457 f = file(sanityverfile, 'w') 457 f = file(sanityverfile, 'w')
@@ -476,8 +476,8 @@ def check_sanity(e):
476 # 476 #
477 # Check the 'ABI' of TMPDIR 477 # Check the 'ABI' of TMPDIR
478 # 478 #
479 current_abi = data.getVar('OELAYOUT_ABI', e.data, True) 479 current_abi = data.getVar('OELAYOUT_ABI', sanity_data, True)
480 abifile = data.getVar('SANITY_ABIFILE', e.data, True) 480 abifile = data.getVar('SANITY_ABIFILE', sanity_data, True)
481 if os.path.exists(abifile): 481 if os.path.exists(abifile):
482 f = file(abifile, "r") 482 f = file(abifile, "r")
483 abi = f.read().strip() 483 abi = f.read().strip()
@@ -486,16 +486,16 @@ def check_sanity(e):
486 f.write(current_abi) 486 f.write(current_abi)
487 elif abi == "2" and current_abi == "3": 487 elif abi == "2" and current_abi == "3":
488 bb.note("Converting staging from layout version 2 to layout version 3") 488 bb.note("Converting staging from layout version 2 to layout version 3")
489 os.system(e.data.expand("mv ${TMPDIR}/staging ${TMPDIR}/sysroots")) 489 os.system(sanity_data.expand("mv ${TMPDIR}/staging ${TMPDIR}/sysroots"))
490 os.system(e.data.expand("ln -s sysroots ${TMPDIR}/staging")) 490 os.system(sanity_data.expand("ln -s sysroots ${TMPDIR}/staging"))
491 os.system(e.data.expand("cd ${TMPDIR}/stamps; for i in */*do_populate_staging; do new=`echo $i | sed -e 's/do_populate_staging/do_populate_sysroot/'`; mv $i $new; done")) 491 os.system(sanity_data.expand("cd ${TMPDIR}/stamps; for i in */*do_populate_staging; do new=`echo $i | sed -e 's/do_populate_staging/do_populate_sysroot/'`; mv $i $new; done"))
492 f = file(abifile, "w") 492 f = file(abifile, "w")
493 f.write(current_abi) 493 f.write(current_abi)
494 elif abi == "3" and current_abi == "4": 494 elif abi == "3" and current_abi == "4":
495 bb.note("Converting staging layout from version 3 to layout version 4") 495 bb.note("Converting staging layout from version 3 to layout version 4")
496 if os.path.exists(e.data.expand("${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}")): 496 if os.path.exists(sanity_data.expand("${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}")):
497 os.system(e.data.expand("mv ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS} ${STAGING_BINDIR_CROSS}")) 497 os.system(sanity_data.expand("mv ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS} ${STAGING_BINDIR_CROSS}"))
498 os.system(e.data.expand("ln -s ${STAGING_BINDIR_CROSS} ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}")) 498 os.system(sanity_data.expand("ln -s ${STAGING_BINDIR_CROSS} ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}"))
499 499
500 f = file(abifile, "w") 500 f = file(abifile, "w")
501 f.write(current_abi) 501 f.write(current_abi)
@@ -503,7 +503,7 @@ def check_sanity(e):
503 messages = messages + "Staging layout has changed. The cross directory has been deprecated and cross packages are now built under the native sysroot.\nThis requires a rebuild.\n" 503 messages = messages + "Staging layout has changed. The cross directory has been deprecated and cross packages are now built under the native sysroot.\nThis requires a rebuild.\n"
504 elif abi == "5" and current_abi == "6": 504 elif abi == "5" and current_abi == "6":
505 bb.note("Converting staging layout from version 5 to layout version 6") 505 bb.note("Converting staging layout from version 5 to layout version 6")
506 os.system(e.data.expand("mv ${TMPDIR}/pstagelogs ${SSTATE_MANIFESTS}")) 506 os.system(sanity_data.expand("mv ${TMPDIR}/pstagelogs ${SSTATE_MANIFESTS}"))
507 f = file(abifile, "w") 507 f = file(abifile, "w")
508 f.write(current_abi) 508 f.write(current_abi)
509 elif abi == "7" and current_abi == "8": 509 elif abi == "7" and current_abi == "8":
@@ -516,7 +516,7 @@ def check_sanity(e):
516 f.write(current_abi) 516 f.write(current_abi)
517 f.close() 517 f.close()
518 518
519 oeroot = data.getVar('COREBASE', e.data) 519 oeroot = data.getVar('COREBASE', sanity_data)
520 if oeroot.find ('+') != -1: 520 if oeroot.find ('+') != -1:
521 messages = messages + "Error, you have an invalid character (+) in your COREBASE directory path. Please move the installation to a directory which doesn't include a +." 521 messages = messages + "Error, you have an invalid character (+) in your COREBASE directory path. Please move the installation to a directory which doesn't include a +."
522 elif oeroot.find (' ') != -1: 522 elif oeroot.find (' ') != -1:
@@ -525,12 +525,21 @@ def check_sanity(e):
525 if messages != "": 525 if messages != "":
526 raise_sanity_error(messages) 526 raise_sanity_error(messages)
527 527
528# Create a copy of the datastore and finalise it to ensure appends and
529# overrides are set - the datastore has yet to be finalised at ConfigParsed
530def copy_data(e):
531 sanity_data = bb.data.createCopy(e.data)
532 sanity_data.finalize()
533 return sanity_data
534
528addhandler check_sanity_eventhandler 535addhandler check_sanity_eventhandler
529python check_sanity_eventhandler() { 536python check_sanity_eventhandler() {
530 if bb.event.getName(e) == "ConfigParsed" and e.data.getVar("BB_WORKERCONTEXT", True) != "1" and e.data.getVar("DISABLE_SANITY_CHECKS", True) != "1": 537 if bb.event.getName(e) == "ConfigParsed" and e.data.getVar("BB_WORKERCONTEXT", True) != "1" and e.data.getVar("DISABLE_SANITY_CHECKS", True) != "1":
531 check_sanity(e) 538 sanity_data = copy_data(e)
539 check_sanity(sanity_data)
532 elif bb.event.getName(e) == "SanityCheck": 540 elif bb.event.getName(e) == "SanityCheck":
533 check_sanity(e) 541 sanity_data = copy_data(e)
542 check_sanity(sanity_data)
534 bb.event.fire(bb.event.SanityCheckPassed(), e.data) 543 bb.event.fire(bb.event.SanityCheckPassed(), e.data)
535 544
536 return 545 return