generic-poky/meta/classes/devshell.bbclass
Richard Purdie 5963d24ec5 devshell: Don't corrupt the fakeroot variables
The devshell anonymous python fragment overwrites variables in the
datastore with their expanded versions. If this runs before the code
in allarch.bbclass which changes TARGET_OS, we can end up with different
directories in the fakeroot environment variables, some expanded with
the original TARGET_OS value.

The devshell code only needs to run before the task itself so we change
to trigger it to run at task execution time only using a flag.

[YOCTO #4795]

(From OE-Core rev: 56baf177cdf074929a090cc66a8b89d346a5d79c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-06 23:04:49 +01:00

34 lines
1.1 KiB
Text

inherit terminal
DEVSHELL = "${SHELL}"
python do_devshell () {
if d.getVarFlag("do_devshell", "manualfakeroot"):
d.prependVar("DEVSHELL", "pseudo ")
fakeenv = d.getVar("FAKEROOTENV", True).split()
for f in fakeenv:
k = f.split("=")
d.setVar(k[0], k[1])
d.appendVar("OE_TERMINAL_EXPORTS", " " + k[0])
d.delVarFlag("do_devshell", "fakeroot")
oe_terminal(d.getVar('DEVSHELL', True), 'OpenEmbedded Developer Shell', d)
}
addtask devshell after do_patch
do_devshell[dirs] = "${S}"
do_devshell[nostamp] = "1"
# devshell and fakeroot/pseudo need careful handling since only the final
# command should run under fakeroot emulation, any X connection should
# be done as the normal user. We therfore carefully construct the envionment
# manually
python () {
if d.getVarFlag("do_devshell", "fakeroot"):
# We need to signal our code that we want fakeroot however we
# can't manipulate the environment and variables here yet (see YOCTO #4795)
d.setVarFlag("do_devshell", "manualfakeroot", "1")
d.delVarFlag("do_devshell", "fakeroot")
}