]> code.ossystems Code Review - openembedded-core.git/commitdiff
devshell.bbclass: Allow running devshell and fakeroot together
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 18 Feb 2013 13:19:50 +0000 (13:19 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 19 Feb 2013 16:36:54 +0000 (08:36 -0800)
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 <command>"

[YOCTO #3374]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/devshell.bbclass
meta/classes/terminal.bbclass

index ddb6e55303abebfbdb1293a28dca76ace31233e2..a780118a127d04a085cf7d7aee918a2472317c20 100644 (file)
@@ -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")
+} 
index d5a6277896ccb05b3f29d41549a59a3c93e1c401..8cebad4162dff4a7c1cd00b79d100141867d7df7 100644 (file)
@@ -25,6 +25,11 @@ def oe_terminal(command, title, d):
         if value is not None:
             os.environ[export] = str(value)
             env[export] = str(value)
+        if export == "PSEUDO_DISABLED":
+            if "PSEUDO_UNLOAD" in os.environ:
+                del os.environ["PSEUDO_UNLOAD"]
+            if "PSEUDO_UNLOAD" in env:
+                del env["PSEUDO_UNLOAD"]
 
     # Add in all variables from the user's original environment which
     # haven't subsequntly been set/changed