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-08 10:20:47 +0000 |
commit | 0c5d2398fca382a0cbdc73adf50e741cef2287bc (patch) | |
tree | 8412a989c55dbcb91a64975442a7f6ddaf791e1c | |
parent | 3745479596d50ced74053b612a2b320361b882cd (diff) | |
download | poky-0c5d2398fca382a0cbdc73adf50e741cef2287bc.tar.gz |
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]
(From OE-Core rev: 9a3b992b7339f7aa892f1dff7d159747630b045d)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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): | |||
204 | 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)) | 204 | 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)) |
205 | 205 | ||
206 | addhandler base_eventhandler | 206 | addhandler base_eventhandler |
207 | base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.runqueue.sceneQueueComplete" | 207 | base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.runqueue.sceneQueueComplete bb.event.RecipeParsed" |
208 | python base_eventhandler() { | 208 | python base_eventhandler() { |
209 | import bb.runqueue | 209 | import bb.runqueue |
210 | 210 | ||
@@ -254,6 +254,24 @@ python base_eventhandler() { | |||
254 | bb.debug(1, "Executing SceneQueue Completion commands: %s" % "\n".join(cmds)) | 254 | bb.debug(1, "Executing SceneQueue Completion commands: %s" % "\n".join(cmds)) |
255 | bb.build.exec_func("completion_function", e.data) | 255 | bb.build.exec_func("completion_function", e.data) |
256 | os.remove(completions) | 256 | os.remove(completions) |
257 | |||
258 | if isinstance(e, bb.event.RecipeParsed): | ||
259 | # | ||
260 | # If we have multiple providers of virtual/X and a PREFERRED_PROVIDER_virtual/X is set | ||
261 | # skip parsing for all the other providers which will mean they get uninstalled from the | ||
262 | # sysroot since they're now "unreachable". This makes switching virtual/kernel work in | ||
263 | # particular. | ||
264 | # | ||
265 | pn = d.getVar('PN', True) | ||
266 | source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False) | ||
267 | if not source_mirror_fetch: | ||
268 | provs = (d.getVar("PROVIDES", True) or "").split() | ||
269 | multiwhitelist = (d.getVar("MULTI_PROVIDER_WHITELIST", True) or "").split() | ||
270 | for p in provs: | ||
271 | if p.startswith("virtual/") and p not in multiwhitelist: | ||
272 | profprov = d.getVar("PREFERRED_PROVIDER_" + p, True) | ||
273 | if profprov and pn != profprov: | ||
274 | raise bb.parse.SkipPackage("PREFERRED_PROVIDER_%s set to %s, not %s" % (p, profprov, pn)) | ||
257 | } | 275 | } |
258 | 276 | ||
259 | CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate" | 277 | CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate" |