devshell: symlink $TOPDIR to $WORKDIR/topdir
PATCH 1/1 devshell: symlink $TOPDIR to $WORKDIR/topdir
From: Christopher Larson <[email protected]>
It's quite common to need to copy files out of the devshell back to your layers, but most of the variables referring to such paths are not exported (and in some cases, should not be, as it'll affect buildsystems we run, e.g. TOPDIR/BUILDDIR). To resolve this while still making it easier to get files out of the devshell, create a ${WORKDIR}/topdir symlink to ${TOPDIR}, removing it after exiting the devshell.
[YOCTO #7670]
--- meta/classes/devshell.bbclass | 3 +++ 1 file changed, 3 insertions(+)
meta/classes/devshell.bbclass +3 -0
@@ -12,7 +12,10 @@ python do_devshell () { d.appendVar("OE_TERMINAL_EXPORTS", " " + k[0]) d.delVarFlag("do_devshell", "fakeroot") + topdir_link = os.path.join(d.getVar('WORKDIR', True), 'topdir') + os.symlink(d.getVar('TOPDIR', True), topdir_link) oe_terminal(d.getVar('DEVSHELL', True), 'OpenEmbedded Developer Shell', d) + os.unlink(topdir_link) } addtask devshell after do_patch
Signature · 1 line
2.2.1
Quoted 11 lines · Christopher Larson
From: Christopher Larson <[email protected]>
It's quite common to need to copy files out of the devshell back to your layers, but most of the variables referring to such paths are not exported (and in some cases, should not be, as it'll affect buildsystems we run, e.g.
TOPDIR/BUILDDIR). To resolve this while still making it easier to get files out of the devshell, create a ${WORKDIR}/topdir symlink to ${TOPDIR}, removing
it after exiting the devshell.
Quoted 4 lines
[YOCTO #7670]
Signed-off-by Christopher Larson <[email protected]>
This should probably have been an RFC, thinking about it, as I'm not entirely happy with this implementation, but I can't think of a good alternative, lacking a way to set unexported shell variables in the shell spawned by the terminal, and there's no real way to do that, since we don't know the shell the user is using. I think this is a decent alternative, if not a pretty one. Thoughts welcome.
Signature · 5 lines
Christopher Larson kergoth at gmail dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Senior Software Engineer, Mentor Graphics