diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-02-11 14:13:27 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-11 12:33:02 +0000 |
commit | e36cb6c718587111af80bb41843b29f5c043095d (patch) | |
tree | 1ac5e8ed561670a656aa19e1471312e6264717dd /meta/classes/externalsrc.bbclass | |
parent | 20034c3f7affe335bf9d75abf97cbf8e5c288c65 (diff) | |
download | poky-e36cb6c718587111af80bb41843b29f5c043095d.tar.gz |
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.
(From OE-Core rev: 58adb3904c18acefd0da319e32f66ebca72eeaac)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r-- | meta/classes/externalsrc.bbclass | 20 |
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 @@ | |||
25 | # | 25 | # |
26 | 26 | ||
27 | SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" | 27 | SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" |
28 | EXTERNALSRC_SYMLINKS ?= "oe-workdir:${WORKDIR} oe-logs:${T}" | ||
28 | 29 | ||
29 | python () { | 30 | python () { |
30 | externalsrc = d.getVar('EXTERNALSRC', True) | 31 | externalsrc = d.getVar('EXTERNALSRC', True) |
@@ -82,6 +83,7 @@ python () { | |||
82 | bb.build.deltask(task, d) | 83 | bb.build.deltask(task, d) |
83 | 84 | ||
84 | d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ") | 85 | d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ") |
86 | d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ") | ||
85 | 87 | ||
86 | # Ensure compilation happens every time | 88 | # Ensure compilation happens every time |
87 | d.setVarFlag('do_compile', 'nostamp', '1') | 89 | d.setVarFlag('do_compile', 'nostamp', '1') |
@@ -101,6 +103,24 @@ python () { | |||
101 | d.setVarFlag('do_configure', 'file-checksums', configstamp + ':True') | 103 | d.setVarFlag('do_configure', 'file-checksums', configstamp + ':True') |
102 | } | 104 | } |
103 | 105 | ||
106 | python externalsrc_configure_prefunc() { | ||
107 | # Create desired symlinks | ||
108 | symlinks = (d.getVar('EXTERNALSRC_SYMLINKS', True) or '').split() | ||
109 | for symlink in symlinks: | ||
110 | symsplit = symlink.split(':', 1) | ||
111 | lnkfile = os.path.join(d.getVar('S', True), symsplit[0]) | ||
112 | target = d.expand(symsplit[1]) | ||
113 | if len(symsplit) > 1: | ||
114 | if os.path.islink(lnkfile): | ||
115 | # Link already exists, leave it if it points to the right location already | ||
116 | if os.readlink(lnkfile) == target: | ||
117 | continue | ||
118 | elif os.path.exists(lnkfile): | ||
119 | # File/dir exists with same name as link, just leave it alone | ||
120 | continue | ||
121 | os.symlink(target, lnkfile) | ||
122 | } | ||
123 | |||
104 | python externalsrc_compile_prefunc() { | 124 | python externalsrc_compile_prefunc() { |
105 | # Make it obvious that this is happening, since forgetting about it could lead to much confusion | 125 | # Make it obvious that this is happening, since forgetting about it could lead to much confusion |
106 | bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN', True), d.getVar('EXTERNALSRC', True))) | 126 | bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN', True), d.getVar('EXTERNALSRC', True))) |