1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 05:29:32 +00:00

bitbake: bitbake: build.py: create separate function for shell trap creation code

Currently, the shell trap code was created in exec_func_shell(). Split
the function so that we can create the code separately.

Also, some whitespaces were automatically deleted by my editor. Since
this is not necessarily a bad thing, leave these changes too.

(Bitbake rev: c712e622d20c61a07c9c172b60e9dc6beae14197)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Laurentiu Palcu
2014-02-03 13:33:07 +02:00
committed by Richard Purdie
parent 5232ba83fd
commit 095bb006c3
+17 -14
View File
@@ -254,19 +254,8 @@ def exec_func_python(func, d, runfile, cwd=None):
except OSError: except OSError:
pass pass
def exec_func_shell(func, d, runfile, cwd=None): def shell_trap_code():
"""Execute a shell function from the metadata return '''#!/bin/sh\n
Note on directory behavior. The 'dirs' varflag should contain a list
of the directories you need created prior to execution. The last
item in the list is where we will chdir/cd to.
"""
# Don't let the emitted shell script override PWD
d.delVarFlag('PWD', 'export')
with open(runfile, 'w') as script:
script.write('''#!/bin/sh\n
# Emit a useful diagnostic if something fails: # Emit a useful diagnostic if something fails:
bb_exit_handler() { bb_exit_handler() {
ret=$? ret=$?
@@ -282,7 +271,21 @@ bb_exit_handler() {
} }
trap 'bb_exit_handler' 0 trap 'bb_exit_handler' 0
set -e set -e
''') '''
def exec_func_shell(func, d, runfile, cwd=None):
"""Execute a shell function from the metadata
Note on directory behavior. The 'dirs' varflag should contain a list
of the directories you need created prior to execution. The last
item in the list is where we will chdir/cd to.
"""
# Don't let the emitted shell script override PWD
d.delVarFlag('PWD', 'export')
with open(runfile, 'w') as script:
script.write(shell_trap_code())
bb.data.emit_func(func, script, d) bb.data.emit_func(func, script, d)