aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>2017-07-27 18:54:31 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-30 08:45:13 +0100
commit7d02ea283b6587f3f79c5846b64b9ba1d6fe8026 (patch)
treea15e6d626a2ed6a5ca21eadd3698bb5714b109aa
parente639f8845f78a0a75b9cab81d9a9f6a2810a313c (diff)
downloadopenembedded-core-contrib-7d02ea283b6587f3f79c5846b64b9ba1d6fe8026.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] Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/cml1.bbclass22
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() {
except OSError:
mtime = 0
- 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'),
+ # We need to know when the command completes but some terminals (including gnome-terminal
+ # and tmux) gives us no way to do this. We therefore write the pid to a temporal file
+ # then monitor the pid until it exits.
+ import tempfile
+ pidfile = tempfile.NamedTemporaryFile(delete = False).name
+ try:
+ 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')),
d.getVar('PN') + ' Configuration', d)
+ while os.stat(pidfile).st_size <= 0:
+ continue
+ with open(pidfile, "r") as f:
+ pid = int(f.readline())
+ finally:
+ os.unlink(pidfile)
+
+ import time
+ while True:
+ try:
+ os.kill(pid, 0)
+ time.sleep(0.1)
+ except OSError:
+ break
# FIXME this check can be removed when the minimum bitbake version has been bumped
if hasattr(bb.build, 'write_taint'):