summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-08-11 16:45:06 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-17 10:35:41 +0100
commit64ffbd4869fecc053cd158c2c70cf6575c31245e (patch)
tree8218eef9cb609940877e70b66d4cae2be2192586 /meta/classes
parentcea1632471ca6671425ffc753246e6b8fea0d19d (diff)
downloadpoky-64ffbd4869fecc053cd158c2c70cf6575c31245e.tar.gz
classes/populate_sdk_ext: add some pre-install checks
Check a number of things as early as possible in the eSDK installer script so that the user gets an error up front rather than waiting for the build system to be extracted and then have the error produced: * Check for missing utilities specified in SANITY_REQUIRED_UTILITIES (along with gcc and g++), taking into account that some of these are satisfied by buildtools which ships as part of the SDK. We use the newly added capability to list an SDK's contents to allow us to see exactly which binaries are inside the buildtools installer. * Check that Python is available (since the buildtools installer's relocate script is written in Python). * Check that locale value set by the script is actually available * Check that the install path is not on NFS This does duplicate some of the checks in sanity.bbclass but it's difficult to avoid that given that here they have to be written in shell and there they are written in Python, as well as the fact that we only need to run some of the checks here and not all (i.e. the ones that relate to the host system or install path, and not those that check the configuration or metadata). Given those issues and the fact that the amount of code is fairly small I elected to just re-implement the checks here. Fixes [YOCTO #8657]. (From OE-Core rev: 6e6999a920b913ad9fdd2751100219c07cd14e54) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/populate_sdk_ext.bbclass60
1 files changed, 58 insertions, 2 deletions
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index 2464acb68d..f1ae7c1236 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -459,6 +459,36 @@ def get_current_buildtools(d):
459 btfiles.sort(key=os.path.getctime) 459 btfiles.sort(key=os.path.getctime)
460 return os.path.basename(btfiles[-1]) 460 return os.path.basename(btfiles[-1])
461 461
462def get_sdk_required_utilities(buildtools_fn, d):
463 """Find required utilities that aren't provided by the buildtools"""
464 sanity_required_utilities = (d.getVar('SANITY_REQUIRED_UTILITIES', True) or '').split()
465 sanity_required_utilities.append(d.expand('${BUILD_PREFIX}gcc'))
466 sanity_required_utilities.append(d.expand('${BUILD_PREFIX}g++'))
467 buildtools_installer = os.path.join(d.getVar('SDK_DEPLOY', True), buildtools_fn)
468 filelist, _ = bb.process.run('%s -l' % buildtools_installer)
469 localdata = bb.data.createCopy(d)
470 localdata.setVar('SDKPATH', '.')
471 sdkpathnative = localdata.getVar('SDKPATHNATIVE', True)
472 sdkbindirs = [localdata.getVar('bindir_nativesdk', True),
473 localdata.getVar('sbindir_nativesdk', True),
474 localdata.getVar('base_bindir_nativesdk', True),
475 localdata.getVar('base_sbindir_nativesdk', True)]
476 for line in filelist.splitlines():
477 splitline = line.split()
478 if len(splitline) > 5:
479 fn = splitline[5]
480 if not fn.startswith('./'):
481 fn = './%s' % fn
482 if fn.startswith(sdkpathnative):
483 relpth = '/' + os.path.relpath(fn, sdkpathnative)
484 for bindir in sdkbindirs:
485 if relpth.startswith(bindir):
486 relpth = os.path.relpath(relpth, bindir)
487 if relpth in sanity_required_utilities:
488 sanity_required_utilities.remove(relpth)
489 break
490 return ' '.join(sanity_required_utilities)
491
462install_tools() { 492install_tools() {
463 install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk} 493 install -d ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}
464 lnr ${SDK_OUTPUT}/${SDKPATH}/${scriptrelpath}/devtool ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/devtool 494 lnr ${SDK_OUTPUT}/${SDKPATH}/${scriptrelpath}/devtool ${SDK_OUTPUT}/${SDKPATHNATIVE}${bindir_nativesdk}/devtool
@@ -472,13 +502,38 @@ install_tools() {
472} 502}
473do_populate_sdk_ext[file-checksums] += "${COREBASE}/meta/files/ext-sdk-prepare.py:True" 503do_populate_sdk_ext[file-checksums] += "${COREBASE}/meta/files/ext-sdk-prepare.py:True"
474 504
475# Since bitbake won't run as root it doesn't make sense to try and install
476# the extensible sdk as root.
477sdk_ext_preinst() { 505sdk_ext_preinst() {
506 # Since bitbake won't run as root it doesn't make sense to try and install
507 # the extensible sdk as root.
478 if [ "`id -u`" = "0" ]; then 508 if [ "`id -u`" = "0" ]; then
479 echo "ERROR: The extensible sdk cannot be installed as root." 509 echo "ERROR: The extensible sdk cannot be installed as root."
480 exit 1 510 exit 1
481 fi 511 fi
512 if ! command -v locale > /dev/null; then
513 echo "ERROR: The installer requires the locale command, please install it first"
514 exit 1
515 fi
516 # Check setting of LC_ALL set above
517 canonicalised_locale=`echo $LC_ALL | sed 's/UTF-8/utf8/'`
518 if ! locale -a | grep -q $canonicalised_locale ; then
519 echo "ERROR: the installer requires the $LC_ALL locale to be installed (but not selected), please install it first"
520 exit 1
521 fi
522 # The relocation script used by buildtools installer requires python
523 if ! command -v python > /dev/null; then
524 echo "ERROR: The installer requires python, please install it first"
525 exit 1
526 fi
527 missing_utils=""
528 for util in ${SDK_REQUIRED_UTILITIES}; do
529 if ! command -v $util > /dev/null; then
530 missing_utils="$missing_utils $util"
531 fi
532 done
533 if [ -n "$missing_utils" ] ; then
534 echo "ERROR: the SDK requires the following missing utilities, please install them: $missing_utils"
535 exit 1
536 fi
482 SDK_EXTENSIBLE="1" 537 SDK_EXTENSIBLE="1"
483 if [ "$publish" = "1" ] ; then 538 if [ "$publish" = "1" ] ; then
484 EXTRA_TAR_OPTIONS="$EXTRA_TAR_OPTIONS --exclude=ext-sdk-prepare.py" 539 EXTRA_TAR_OPTIONS="$EXTRA_TAR_OPTIONS --exclude=ext-sdk-prepare.py"
@@ -542,6 +597,7 @@ fakeroot python do_populate_sdk_ext() {
542 597
543 d.setVar('SDK_INSTALL_TARGETS', get_sdk_install_targets(d)) 598 d.setVar('SDK_INSTALL_TARGETS', get_sdk_install_targets(d))
544 buildtools_fn = get_current_buildtools(d) 599 buildtools_fn = get_current_buildtools(d)
600 d.setVar('SDK_REQUIRED_UTILITIES', get_sdk_required_utilities(buildtools_fn, d))
545 d.setVar('SDK_BUILDTOOLS_INSTALLER', buildtools_fn) 601 d.setVar('SDK_BUILDTOOLS_INSTALLER', buildtools_fn)
546 602
547 bb.build.exec_func("do_populate_sdk", d) 603 bb.build.exec_func("do_populate_sdk", d)