]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake.conf: shift build config summary control to here
authorChristopher Larson <kergoth@gmail.com>
Fri, 27 Apr 2012 04:32:31 +0000 (23:32 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 3 May 2012 14:00:24 +0000 (15:00 +0100)
Signed-off-by: Christopher Larson <kergoth@gmail.com>
meta/classes/base.bbclass
meta/conf/bitbake.conf

index a984eae5bc45c0973727d6cf0f0cab2321890132..07ef9a231691dfd405bef4eb86a133b15b60e893 100644 (file)
@@ -225,6 +225,27 @@ def get_layers_branch_rev(d):
        return layers_branch_rev
 
 
+BUILDCFG_FUNCS ??= "buildcfg_vars get_layers_branch_rev buildcfg_neededvars"
+BUILDCFG_FUNCS[type] = "list"
+
+def buildcfg_vars(d):
+       statusvars = oe.data.typed_value('BUILDCFG_VARS', d)
+       for var in statusvars:
+               value = d.getVar(var, True)
+               if value is not None:
+                       yield '%-17s = "%s"' % (var, value)
+
+def buildcfg_neededvars(d):
+       needed_vars = oe.data.typed_value("BUILDCFG_NEEDEDVARS", d)
+       pesteruser = []
+       for v in needed_vars:
+               val = d.getVar(v, True)
+               if not val or val == 'INVALID':
+                       pesteruser.append(v)
+
+       if pesteruser:
+               bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser))
+
 addhandler base_eventhandler
 python base_eventhandler() {
        from bb.event import getName
@@ -232,22 +253,19 @@ python base_eventhandler() {
        name = getName(e)
 
        if name.startswith("BuildStarted"):
-               e.data.setVar( 'BB_VERSION', bb.__version__)
-               statusvars = ['BB_VERSION', 'TARGET_ARCH', 'TARGET_OS', 'MACHINE', 'DISTRO', 'DISTRO_VERSION','TUNE_FEATURES', 'TARGET_FPU']
-               statuslines = ["%-17s = \"%s\"" % (i, e.data.getVar(i, True) or '') for i in statusvars]
-
-               statuslines += get_layers_branch_rev(e.data)
-               statusmsg = "\nOE Build Configuration:\n%s\n" % '\n'.join(statuslines)
-               bb.plain(statusmsg)
-
-               needed_vars = [ "TARGET_ARCH", "TARGET_OS" ]
-               pesteruser = []
-               for v in needed_vars:
-                       val = e.data.getVar(v, True)
-                       if not val or val == 'INVALID':
-                               pesteruser.append(v)
-               if pesteruser:
-                       bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser))
+               e.data.setVar('BB_VERSION', bb.__version__)
+               statuslines = []
+               for func in oe.data.typed_value('BUILDCFG_FUNCS', e.data):
+                       g = globals()
+                       if func not in g:
+                               bb.warn("Build configuration function '%s' does not exist" % func)
+                       else:
+                               flines = g[func](e.data)
+                               if flines:
+                                       statuslines.extend(flines)
+
+               statusheader = e.data.getVar('BUILDCFG_HEADER', True)
+               bb.plain('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines)))
 
         if name == "ConfigParsed":
                 generate_git_config(e)
index 9f4e4d4449de32b4865bfdd4872f6df2060b6e79..dc68690a39bc9f327f4659d9f31ed3908141a4bc 100644 (file)
@@ -609,6 +609,13 @@ export PATCH_GET="0"
 # Not sure about the rest of this yet.
 ##################################################################
 
+# Pre-build configuration output
+BUILDCFG_HEADER = "Build Configuration:"
+BUILDCFG_VARS = "BB_VERSION TARGET_ARCH TARGET_OS MACHINE DISTRO DISTRO_VERSION TUNE_FEATURES TARGET_FPU"
+BUILDCFG_VARS[type] = "list"
+BUILDCFG_NEEDEDVARS = "TARGET_ARCH TARGET_OS"
+BUILDCFG_NEEDEDVARS[type] = "list"
+
 # Other
 
 export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}/${libdir}/pkgconfig"