bitbake: Show base multiconfig environment
PATCH 1/1 bitbake: Show base multiconfig environment
Adds support to the 'bitbake -e' command so that it can display the base environment for a multiconfig. It was previously possible to get the base environment for the main environment by running "bitbake -e", but there was no support for getting the base environment for a multiconfig without specifying a recipe. A user can now print the base environment for the multiconfig "foo" by running:
$ bitbake -e multiconfig:foo
--- bitbake/lib/bb/cooker.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-)
bitbake/lib/bb/cooker.py +21 -10
@@ -495,6 +495,7 @@ class BBCooker: """ fn = None envdata = None + mc = '' if not pkgs_to_build: pkgs_to_build = []
@@ -503,6 +504,12 @@ class BBCooker: self.enableDataTracking() self.reset() + def mc_base(p): + if p.startswith('multiconfig:'): + s = p.split(':') + if len(s) == 2: + return s[1] + return None if buildfile: # Parse the configuration here. We need to do it explicitly here since
@@ -513,18 +520,16 @@ class BBCooker: fn = self.matchFile(fn) fn = bb.cache.realfn2virtual(fn, cls, mc) elif len(pkgs_to_build) == 1: - ignore = self.data.getVar("ASSUME_PROVIDED") or "" - if pkgs_to_build[0] in set(ignore.split()): - bb.fatal("%s is in ASSUME_PROVIDED" % pkgs_to_build[0]) + mc = mc_base(pkgs_to_build[0]) + if not mc: + ignore = self.data.getVar("ASSUME_PROVIDED") or "" + if pkgs_to_build[0] in set(ignore.split()): + bb.fatal("%s is in ASSUME_PROVIDED" % pkgs_to_build[0]) - taskdata, runlist = self.buildTaskData(pkgs_to_build, None, self.configuration.abort, allowincomplete=True) + taskdata, runlist = self.buildTaskData(pkgs_to_build, None, self.configuration.abort, allowincomplete=True) - mc = runlist[0][0] - fn = runlist[0][3] - else: - envdata = self.data - data.expandKeys(envdata) - parse.ast.runAnonFuncs(envdata) + mc = runlist[0][0] + fn = runlist[0][3] if fn: try:
@@ -533,6 +538,12 @@ class BBCooker: except Exception as e: parselog.exception("Unable to read %s", fn) raise + else: + if not mc in self.databuilder.mcdata: + bb.fatal('Not multiconfig named "%s" found' % mc) + envdata = self.databuilder.mcdata[mc] + data.expandKeys(envdata) + parse.ast.runAnonFuncs(envdata) # Display history with closing(StringIO()) as env:
Signature · 1 line
2.21.0
Ping
Quoted 79 lines · Joshua Watt
Adds support to the 'bitbake -e' command so that it can display the base environment for a multiconfig. It was previously possible to get the base environment for the main environment by running "bitbake -e", but there was no support for getting the base environment for a multiconfig without specifying a recipe. A user can now print the base environment for the multiconfig "foo" by running:
$ bitbake -e multiconfig:fooSigned-off-by Joshua Watt <[email protected]>--- bitbake/lib/bb/cooker.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-)bitbake/lib/bb/cooker.py +21
-10@@ -495,6 +495,7 @@ class BBCooker: """ fn = None envdata = None + mc = '' if not pkgs_to_build: pkgs_to_build = []@@ -503,6 +504,12 @@ class BBCooker: self.enableDataTracking() self.reset() + def mc_base(p): + if p.startswith('multiconfig:'): + s = p.split(':') + if len(s) == 2: + return s[1] + return None if buildfile: # Parse the configuration here. We need to do it explicitly here since@@ -513,18 +520,16 @@ class BBCooker: fn = self.matchFile(fn) fn = bb.cache.realfn2virtual(fn, cls, mc) elif len(pkgs_to_build) == 1: - ignore = self.data.getVar("ASSUME_PROVIDED") or "" - if pkgs_to_build[0] in set(ignore.split()): - bb.fatal("%s is in ASSUME_PROVIDED" % pkgs_to_build[0]) + mc = mc_base(pkgs_to_build[0]) + if not mc: + ignore = self.data.getVar("ASSUME_PROVIDED") or "" + if pkgs_to_build[0] in set(ignore.split()): + bb.fatal("%s is in ASSUME_PROVIDED" % pkgs_to_build[0]) - taskdata, runlist = self.buildTaskData(pkgs_to_build, None, self.configuration.abort, allowincomplete=True) + taskdata, runlist = self.buildTaskData(pkgs_to_build, None, self.configuration.abort, allowincomplete=True) - mc = runlist[0][0] - fn = runlist[0][3] - else: - envdata = self.data - data.expandKeys(envdata) - parse.ast.runAnonFuncs(envdata) + mc = runlist[0][0] + fn = runlist[0][3] if fn: try:@@ -533,6 +538,12 @@ class BBCooker: except Exception as e: parselog.exception("Unable to read %s", fn) raise + else: + if not mc in self.databuilder.mcdata: + bb.fatal('Not multiconfig named "%s" found' % mc) + envdata = self.databuilder.mcdata[mc] + data.expandKeys(envdata) + parse.ast.runAnonFuncs(envdata) # Display history with closing(StringIO()) as env: