I think bitbake should set a variable which is just re.escape(LAYERDIR), for us to use in BBFILE_PATTERN, i.e. LAYERDIR_ESCAPED or LAYERDIR_RE or so. Doing it purely in layer.conf could be problematic since the re module isn't imported. This would avoid issues with regex special characters in paths causing breakage, at least at this level. Other parts of the build can hit problems in certain cases, but we should at least handle this correctly ourselves.
(In reply to comment #0) > I think bitbake should set a variable which is just re.escape(LAYERDIR), for > us to use in BBFILE_PATTERN, i.e. LAYERDIR_ESCAPED or LAYERDIR_RE or so. > Doing it purely in layer.conf could be problematic since the re module isn't > imported. This would avoid issues with regex special characters in paths > causing breakage, at least at this level. Other parts of the build can hit > problems in certain cases, but we should at least handle this correctly > ourselves. Another option would be for bitbake to be a bit smarter about its LAYERDIR expansions. Assume that a LAYERDIR ref in BBFILE_PATTERN has to be escaped, whereas any other expansions don't, but that's likely too implicit / too much magic :)
https://github.com/kergoth/poky/commit/14d521b is the implementation I proposed in comment #1, and https://github.com/kergoth/poky/commit/d24c6d5 the one from comment #2. Thoughts? I dislike how implicit the latter is, but trying to get every layer to modify their layer.conf seems like a losing proposition, and they'd need to add LAYERDIR_RE ?= "${LAYERDIR}" to be compatible with previous bitbake versions, so I'm inclined to say we should go with the latter instead.
Having discussed this with Richard, we're on the same page on this, we should go with route #1 and just deal with the migration rather than adding more magic. I'll submit the patch for 2.2.
Fixed in bitbake 72900522778b6ff08b135bf8bb97dff3f1a20bd9.