diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-11-06 12:37:01 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-07 17:59:17 +0000 |
commit | 9a3b992b7339f7aa892f1dff7d159747630b045d (patch) | |
tree | e803bdb0c68fc102f06f0676cf03ab3527d2879c /meta/classes/base.bbclass | |
parent | 687e5ef86361a16d6c411386939d4ba96a5909ea (diff) | |
download | openembedded-core-9a3b992b7339f7aa892f1dff7d159747630b045d.tar.gz openembedded-core-9a3b992b7339f7aa892f1dff7d159747630b045d.tar.bz2 openembedded-core-9a3b992b7339f7aa892f1dff7d159747630b045d.zip |
base: Improve handling of switching virtual/x providers
If you build virtual/kernel, then change PREFERRED_PROVIDER_virtual/kernel from say
"linux-yocto" to "linux-yocto-dev", you see errors from the sysroot about overlapping
files. The automatic uninstall logic doesn't trigger since the other recipes is
still technically parsed/buildable.
What we can do is look at the value of PREFERRED_PROVIDER_virtual/X and raise SkipRecipe
(skip parsing) if it provides this thing and its not selected. We skip cases no preferred
provider is set, or the value is in MULTI_PROVIDER_WHITELIST.We also inform the user
if they try to build something which conflicts with the configuration:
$ bitbake linux-yocto-tiny
ERROR: Nothing PROVIDES 'linux-yocto-tiny'
ERROR: linux-yocto-tiny was skipped: PREFERRED_PROVIDER_virtual/kernel set to linux-yocto, not linux-yocto-tiny
[YOCTO #4102]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/base.bbclass')
-rw-r--r-- | meta/classes/base.bbclass | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index e6d1599032..0d92948972 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -204,7 +204,7 @@ def buildcfg_neededvars(d): 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 -base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.runqueue.sceneQueueComplete" +base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.runqueue.sceneQueueComplete bb.event.RecipeParsed" python base_eventhandler() { import bb.runqueue @@ -254,6 +254,24 @@ python base_eventhandler() { bb.debug(1, "Executing SceneQueue Completion commands: %s" % "\n".join(cmds)) bb.build.exec_func("completion_function", e.data) os.remove(completions) + + if isinstance(e, bb.event.RecipeParsed): + # + # If we have multiple providers of virtual/X and a PREFERRED_PROVIDER_virtual/X is set + # skip parsing for all the other providers which will mean they get uninstalled from the + # sysroot since they're now "unreachable". This makes switching virtual/kernel work in + # particular. + # + pn = d.getVar('PN', True) + source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False) + if not source_mirror_fetch: + provs = (d.getVar("PROVIDES", True) or "").split() + multiwhitelist = (d.getVar("MULTI_PROVIDER_WHITELIST", True) or "").split() + for p in provs: + if p.startswith("virtual/") and p not in multiwhitelist: + profprov = d.getVar("PREFERRED_PROVIDER_" + p, True) + if profprov and pn != profprov: + raise bb.parse.SkipPackage("PREFERRED_PROVIDER_%s set to %s, not %s" % (p, profprov, pn)) } CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate" |