[oe-commits] Otavio Salvador : base.bbclass: add support for machine configuration fallback

git version control git at git.openembedded.org
Fri Jul 10 17:26:16 UTC 2009


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 6633c4c95a713bc365f5d87acc4a94621ed50034
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=6633c4c95a713bc365f5d87acc4a94621ed50034

Author: Otavio Salvador <otavio at ossystems.com.br>
Date:   Tue Jun 23 11:55:29 2009 -0300

base.bbclass: add support for machine configuration fallback

To avoid duplicating a lot of configurations for similar machines we
needed to introduce a new concept of machine fallback.

It basically means that when a list is set in MACHINE_FALLBACK
variable, following is done:

 - those machines are added to the override list, after the machine
   itself;

 - if any of these machines matches, the package is dealt as machine
   specific one.

Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>

---

 classes/base.bbclass |    9 +++++----
 conf/bitbake.conf    |   37 ++++++++++++++++++++++---------------
 2 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/classes/base.bbclass b/classes/base.bbclass
index bc50c67..7f2e81f 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -1179,10 +1179,11 @@ def base_after_parse(d):
     override = bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1)
     if override != '0':
         paths = []
-        for p in [ "${PF}", "${P}", "${PN}", "files", "" ]:
-            path = bb.data.expand(os.path.join("${FILE_DIRNAME}", p, "${MACHINE}"), d)
-            if os.path.isdir(path):
-                paths.append(path)
+        for a in [ "${MACHINE}" ] + bb.data.getVar('MACHINE_FALLBACK', d).split():
+            for p in [ "${PF}", "${P}", "${PN}", "files", "" ]:
+                path = bb.data.expand(os.path.join("${FILE_DIRNAME}", p, a), d)
+                if os.path.isdir(path):
+                    paths.append(path)
         if len(paths) != 0:
             for s in srcuri.split():
                 if not s.startswith("file://"):
diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index 8b69564..d26efe8 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -615,21 +615,6 @@ BUILDCFG_VARS_append_arm = " TARGET_FPU"
 BUILDCFG_VARS_append_armeb = " TARGET_FPU"
 BUILDCFG_NEEDEDVARS ?= "TARGET_ARCH TARGET_OS"
 
-###
-### Config file processing
-###
-
-# This means that an envionment variable named '<foo>_arm' overrides an
-# environment variable '<foo>' (when ${TARGET_ARCH} is arm). And the same: an
-# environment variable '<foo>_ramses' overrides both '<foo>' and '<foo>_arm
-# when ${MACHINE} is 'ramses'. And finally '<foo>_local' overrides anything.
-#
-# This works for  functions as well, they are really just environment variables.
-# Default OVERRIDES to make compilation fail fast in case of build system misconfiguration.
-OVERRIDES = "local:${MACHINE}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUILD_OS}:fail-fast:pn-${PN}"
-# Alternative OVERRIDES definition without "fail fast", usually only for native building and Scratchbox toolchains.
-#OVERRIDES = "local:${MACHINE}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUILD_OS}:pn-${PN}"
-
 ##################################################################
 # Include the rest of the config files.
 ##################################################################
@@ -651,6 +636,28 @@ require conf/sanity.conf
 require conf/abi_version.conf
 require conf/enterprise.conf
 
+###
+### Config file processing
+###
+
+# A list of machines that ought to be used when looking for
+# overrides. For example, geodegx and geodelx machines can have geode
+# as a fallback and then avoiding duplicated content between them.
+MACHINE_FALLBACK ?= ""
+
+MACHINE_OVERRIDES = "${@':'.join([bb.data.getVar('MACHINE', d)] + bb.data.getVar('MACHINE_FALLBACK', d).split()) or ':'}"
+
+# This means that an envionment variable named '<foo>_arm' overrides an
+# environment variable '<foo>' (when ${TARGET_ARCH} is arm). And the same: an
+# environment variable '<foo>_ramses' overrides both '<foo>' and '<foo>_arm
+# when ${MACHINE} is 'ramses'. And finally '<foo>_local' overrides anything.
+#
+# This works for  functions as well, they are really just environment variables.
+# Default OVERRIDES to make compilation fail fast in case of build system misconfiguration.
+OVERRIDES ?= "local:${MACHINE_OVERRIDES}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUILD_OS}:fail-fast:pn-${PN}"
+# Alternative OVERRIDES definition without "fail fast", usually only for native building and Scratchbox toolchains.
+#OVERRIDES ?= "local:${MACHINE_OVERRIDES}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUILD_OS}:pn-${PN}"
+
 ##################################################################
 # Weak variables (usually to retain backwards compatibility)
 ##################################################################





More information about the Openembedded-commits mailing list