diff options
author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2017-07-27 18:54:31 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-30 08:46:20 +0100 |
commit | d2ebee7c3a0c8ab9a09ebad12a2fda51f8d10954 (patch) | |
tree | 907c4b94887ebc64b5be1daefa0deec3ac270f70 /meta/classes | |
parent | e35fe8c06de9e3e9d64c058a56c6f3477e0937ee (diff) | |
download | poky-d2ebee7c3a0c8ab9a09ebad12a2fda51f8d10954.tar.gz |
cml1.bbclass: wait until menuconfig terminal finishes
There are at least two terminals types (gnome and tmux) that when
launched to show the kernel's menuconfig, we lost track of the corresponding
process ID, thus there is no way to see when they finish, yielding identical
timestamps before and after menuconfig thus compile's task
is never tainted. This commit takes the solution from [1] but now in the menuconfig's
context.
[1] http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=c706bfbabbf9f7caf2cf509eb91381fb49aa44cb
[YOCTO #11146]
(From OE-Core rev: 7d02ea283b6587f3f79c5846b64b9ba1d6fe8026)
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/cml1.bbclass | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass index eb8e7907f6..0bab22efed 100644 --- a/meta/classes/cml1.bbclass +++ b/meta/classes/cml1.bbclass | |||
@@ -26,8 +26,28 @@ python do_menuconfig() { | |||
26 | except OSError: | 26 | except OSError: |
27 | mtime = 0 | 27 | mtime = 0 |
28 | 28 | ||
29 | oe_terminal("${SHELL} -c \"make %s; if [ \$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'), | 29 | # We need to know when the command completes but some terminals (including gnome-terminal |
30 | # and tmux) gives us no way to do this. We therefore write the pid to a temporal file | ||
31 | # then monitor the pid until it exits. | ||
32 | import tempfile | ||
33 | pidfile = tempfile.NamedTemporaryFile(delete = False).name | ||
34 | try: | ||
35 | oe_terminal("${SHELL} -c \"echo $$ > %s; make %s; if [ \$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % (pidfile, d.getVar('KCONFIG_CONFIG_COMMAND')), | ||
30 | d.getVar('PN') + ' Configuration', d) | 36 | d.getVar('PN') + ' Configuration', d) |
37 | while os.stat(pidfile).st_size <= 0: | ||
38 | continue | ||
39 | with open(pidfile, "r") as f: | ||
40 | pid = int(f.readline()) | ||
41 | finally: | ||
42 | os.unlink(pidfile) | ||
43 | |||
44 | import time | ||
45 | while True: | ||
46 | try: | ||
47 | os.kill(pid, 0) | ||
48 | time.sleep(0.1) | ||
49 | except OSError: | ||
50 | break | ||
31 | 51 | ||
32 | # FIXME this check can be removed when the minimum bitbake version has been bumped | 52 | # FIXME this check can be removed when the minimum bitbake version has been bumped |
33 | if hasattr(bb.build, 'write_taint'): | 53 | if hasattr(bb.build, 'write_taint'): |