summaryrefslogtreecommitdiff
path: root/meta/classes
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-02-11 14:13:27 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-11 12:32:55 +0000
commit58adb3904c18acefd0da319e32f66ebca72eeaac (patch)
treebd2103a8225679b01a98395cf4021343e70da0b8 /meta/classes
parentc0867a425166086624bcffa231a1497291f860cb (diff)
downloadopenembedded-core-58adb3904c18acefd0da319e32f66ebca72eeaac.tar.gz
openembedded-core-58adb3904c18acefd0da319e32f66ebca72eeaac.tar.bz2
openembedded-core-58adb3904c18acefd0da319e32f66ebca72eeaac.zip
classes/externalsrc: create symlinks for workdir and logs
Auto-create symlinks in the source directory to the work directory (${WORKDIR}) and logs directory (${T}) so that they are easier for the user to find. This is particularly useful within the extensible SDK where the user is less likely to be familiar enough with the structure of the build system to know where to find these things, but otherwise they are a useful shortcut for anyone. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/externalsrc.bbclass20
1 files changed, 20 insertions, 0 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 9d7ab00e9e..b608bd04e8 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -25,6 +25,7 @@
#
SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch"
+EXTERNALSRC_SYMLINKS ?= "oe-workdir:${WORKDIR} oe-logs:${T}"
python () {
externalsrc = d.getVar('EXTERNALSRC', True)
@@ -82,6 +83,7 @@ python () {
bb.build.deltask(task, d)
d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ")
+ d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ")
# Ensure compilation happens every time
d.setVarFlag('do_compile', 'nostamp', '1')
@@ -101,6 +103,24 @@ python () {
d.setVarFlag('do_configure', 'file-checksums', configstamp + ':True')
}
+python externalsrc_configure_prefunc() {
+ # Create desired symlinks
+ symlinks = (d.getVar('EXTERNALSRC_SYMLINKS', True) or '').split()
+ for symlink in symlinks:
+ symsplit = symlink.split(':', 1)
+ lnkfile = os.path.join(d.getVar('S', True), symsplit[0])
+ target = d.expand(symsplit[1])
+ if len(symsplit) > 1:
+ if os.path.islink(lnkfile):
+ # Link already exists, leave it if it points to the right location already
+ if os.readlink(lnkfile) == target:
+ continue
+ elif os.path.exists(lnkfile):
+ # File/dir exists with same name as link, just leave it alone
+ continue
+ os.symlink(target, lnkfile)
+}
+
python externalsrc_compile_prefunc() {
# Make it obvious that this is happening, since forgetting about it could lead to much confusion
bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN', True), d.getVar('EXTERNALSRC', True)))