diff options
Diffstat (limited to 'bitbake/lib/toaster/contrib/tts/recv.py')
-rwxr-xr-x | bitbake/lib/toaster/contrib/tts/recv.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/contrib/tts/recv.py b/bitbake/lib/toaster/contrib/tts/recv.py index 168294acab..2faf8d08c7 100755 --- a/bitbake/lib/toaster/contrib/tts/recv.py +++ b/bitbake/lib/toaster/contrib/tts/recv.py | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | from __future__ import print_function | 27 | from __future__ import print_function |
28 | import sys, os, config, shellutils | 28 | import sys, os, config, shellutils |
29 | from shellutils import ShellCmdException | ||
30 | 29 | ||
31 | from email.parser import Parser | 30 | from email.parser import Parser |
32 | 31 | ||
@@ -34,9 +33,13 @@ def recv_mail(datastring): | |||
34 | headers = Parser().parsestr(datastring) | 33 | headers = Parser().parsestr(datastring) |
35 | return headers['subject'] | 34 | return headers['subject'] |
36 | 35 | ||
36 | def main(): | ||
37 | lock_file = shellutils.lockfile(shellutils.mk_lock_filename(), retry=True) | ||
37 | 38 | ||
38 | if __name__ == "__main__": | 39 | if lock_file is None: |
39 | lf = shellutils.lockfile(shellutils.mk_lock_filename(), retry = True) | 40 | if config.DEBUG: |
41 | print("Concurrent script in progress, exiting") | ||
42 | sys.exit(1) | ||
40 | 43 | ||
41 | subject = recv_mail(sys.stdin.read()) | 44 | subject = recv_mail(sys.stdin.read()) |
42 | 45 | ||
@@ -47,5 +50,7 @@ if __name__ == "__main__": | |||
47 | line = "%s|%s\n" % (task_name, config.TASKS.PENDING) | 50 | line = "%s|%s\n" % (task_name, config.TASKS.PENDING) |
48 | fout.write(line) | 51 | fout.write(line) |
49 | 52 | ||
50 | shellutils.unlockfile(lf) | 53 | shellutils.unlockfile(lock_file) |
51 | 54 | ||
55 | if __name__ == "__main__": | ||
56 | main() | ||