Browse Source

external-common.bbclass: fix external_run when not enabled

This returns immediately with 'UNKNOWN' if the external toolchain isn't
enabled, and also immediately adjusts sys.path regardless of OE_IMPORTS
handling to avoid the over-reliance upon that mechanism.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Christopher Larson 6 years ago
parent
commit
da9cfa7d38
2 changed files with 7 additions and 1 deletions
  1. 6 1
      classes/external-common.bbclass
  2. 1 0
      conf/layer.conf

+ 6 - 1
classes/external-common.bbclass

@@ -28,7 +28,12 @@ FILES_MIRRORS = "\
 
 def external_run(d, *args):
     """Convenience wrapper"""
-    oe_import(d)
+    if (not d.getVar('TCMODE', True).startswith('external') or
+            not d.getVar('EXTERNAL_TOOLCHAIN', True)):
+        return 'UNKNOWN'
+
+    sys.path.append(os.path.join(d.getVar('LAYERDIR_external-toolchain', True), 'lib'))
+    import oe.external
     return oe.external.run(d, *args)
 
 def external_get_kernel_version(p):

+ 1 - 0
conf/layer.conf

@@ -6,6 +6,7 @@ BBFILE_PRIORITY_external-toolchain = "1"
 BBFILE_PATTERN_external-toolchain = "^${LAYERDIR}/"
 
 LAYERDEPENDS_external-toolchain = "core"
+LAYERDIR_external-toolchain = "${LAYERDIR}"
 
 BBFILES += "${@' '.join('${LAYERDIR}/%s/recipes*/*/*.%s' % (layer, ext) \
                for layer in '${BBFILE_COLLECTIONS}'.split() for ext in ['bb', 'bbappend'])}"