[OE-core] [PATCH RFC] image: Enable fakeroot for the devshell

Richard Purdie richard.purdie at linuxfoundation.org
Mon Feb 18 13:28:08 UTC 2013

The rootfs task runs under fakeroot. This converts the devshell to do the same,
allowing the user easier debugging of problems like permissions for example.

I'm really after to provoke some discussion with this patch. There are a
variety of cases where it would be desirable to run devshell in fakeroot
context. This patch enables it for one, the image generation case but
there are others.

We have several options:

a) Add these in on a case by case basis. Image generation is one which
is clearly makes sense to me.
b) Always enable fakeroot for devshell. The downside is some calls
accessing the user's session won't work properly. You'd have to run
those in the form "PSEUDO_UNLOAD=1 <command>"
c) Add a new fakerootdevshell task which sits along side devshell but
starts devshell with fakeroot privileges.

Adding a new task is relatively expensive in parsing performance and in
runqueue generation. I'm not sure whether there is enough of a case for
two different tasks or that it would user friendly. I'm therefore
seriously considering b) but would be interested in the opinions of
others. The attached patch implements a) as a proof of concept. b) would
be just adding those lines to devshell.bbclass instead.

Regardless of which we pick, we need to document it, cc'ing Scott s he
knows there is a change in this area brewing and needed before release.

[YOCTO #3374]

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
 meta/classes/image.bbclass |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index dd78acb..0d737c3 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -184,6 +184,9 @@ do_rootfs[lockfiles] += "${IMAGE_ROOTFS}.lock"
 do_rootfs[cleandirs] += "${S} ${WORKDIR}/intercept_scripts"
 do_build[nostamp] = "1"
+do_devshell[depends] += "virtual/fakeroot-native:do_populate_sysroot"
+do_devshell[fakeroot] = "1"
 # Must call real_do_rootfs() from inside here, rather than as a separate
 # task, so that we have a single fakeroot context for the whole process.
 do_rootfs[umask] = "022"

More information about the Openembedded-core mailing list