diff options
author | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2013-08-16 11:20:59 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-23 17:29:54 +0100 |
commit | 9f0f799c461fb67e7c03304216253ca9bf899680 (patch) | |
tree | 5e92d15379d79e8f0b28e80806316c484bcba081 /bitbake/lib | |
parent | 4273aa4287ecd36529f2d752c76ab8d09afc33c3 (diff) | |
download | poky-9f0f799c461fb67e7c03304216253ca9bf899680.tar.gz |
bitbake: build.py: create symlink for run.do_xxx scripts
The 'courtesy' symlink for log.do_xxx are quite useful when debugging, so
with this commit, we now get similar 'courtesy' symlink for run.do_xxx
scripts.
We only create symlink for tasks, not individual functions.
The symlink is create right before the actual runfile is created, indeed
we cannot create the symlink right after running the task since a failure
or execption can happen, in which case the symlink wouldn't be created,
and symlink are particularely useful when the task failed!
Another option would be create the symlink after the runfile is created,
and before the script is executed, but that means we need to duplicate the
code in case of Shell vs Python task.
(Bitbake rev: a672b39c5d529ba85d72eee8fef4c4273eaa5397)
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/build.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 6fffbc5da3..91c3a42db6 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -190,6 +190,20 @@ def exec_func(func, d, dirs = None): | |||
190 | runfile = os.path.join(tempdir, runfn) | 190 | runfile = os.path.join(tempdir, runfn) |
191 | bb.utils.mkdirhier(os.path.dirname(runfile)) | 191 | bb.utils.mkdirhier(os.path.dirname(runfile)) |
192 | 192 | ||
193 | # Setup the courtesy link to the runfn, only for tasks | ||
194 | # we create the link 'just' before the run script is created | ||
195 | # if we create it after, and if the run script fails, then the | ||
196 | # link won't be created as an exception would be fired. | ||
197 | if task == func: | ||
198 | runlink = os.path.join(tempdir, 'run.{0}'.format(task)) | ||
199 | if runlink: | ||
200 | bb.utils.remove(runlink) | ||
201 | |||
202 | try: | ||
203 | os.symlink(runfn, runlink) | ||
204 | except OSError: | ||
205 | pass | ||
206 | |||
193 | with bb.utils.fileslocked(lockfiles): | 207 | with bb.utils.fileslocked(lockfiles): |
194 | if ispython: | 208 | if ispython: |
195 | exec_func_python(func, d, runfile, cwd=adir) | 209 | exec_func_python(func, d, runfile, cwd=adir) |