From 0a2662a48eaf0487db043c348e2834bb9cdd0466 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 18 Feb 2013 13:19:50 +0000 Subject: devshell.bbclass: Allow running devshell and fakeroot together Currently its hard to run a devshell complete with fakeroot context. This patch allows the fakeroot flag on the task to do this, as with any other task. Since we may need to start X terminal applications, we need to only start the fakeroot session on the final command, hence the hoops this code jumps through. As always with fakeroot, you can break out and run a command without the fake permissions with syntax like "PSEUDO_UNLOAD=1 " [YOCTO #3374] Signed-off-by: Richard Purdie Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- meta/classes/devshell.bbclass | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'meta/classes/devshell.bbclass') diff --git a/meta/classes/devshell.bbclass b/meta/classes/devshell.bbclass index ddb6e55303..a780118a12 100644 --- a/meta/classes/devshell.bbclass +++ b/meta/classes/devshell.bbclass @@ -1,10 +1,27 @@ inherit terminal +DEVSHELL = "${SHELL}" + python do_devshell () { - oe_terminal(d.getVar('SHELL', True), 'OpenEmbedded Developer Shell', d) + 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"): + 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") +} -- cgit v1.2.3