1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

script:autobuild: Make sure we can send a failure mail

We should not run into an exception if the file doesn't exist.

Traceback (most recent call last):
  File "script/autobuild.py", line 1781, in <module>
    email_failure(-1, 'rebase', 'rebase', 'rebase',
  File "script/autobuild.py", line 1677, in email_failure
    f = open("%s/%s.stdout" % (gitroot, failed_tag), 'r')
FileNotFoundError: [Errno 2] No such file or directory:
  'samba-autobuild/rebase.stdout'

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jan 30 10:00:27 UTC 2023 on atb-devel-224
This commit is contained in:
Andreas Schneider 2023-01-25 17:08:58 +01:00 committed by Andrew Bartlett
parent 41aa379abb
commit f6712c7098

View File

@ -1673,14 +1673,16 @@ The top commit for the tree that was built was:
''' % (log_base, failed_tag, log_base, failed_tag, log_base, top_commit_msg) ''' % (log_base, failed_tag, log_base, failed_tag, log_base, top_commit_msg)
if add_log_tail: log_stdout = "%s/%s.stdout" % (gitroot, failed_tag)
f = open("%s/%s.stdout" % (gitroot, failed_tag), 'r') if add_log_tail and os.access(log_stdout, os.R_OK):
f = open(log_stdout, 'r')
lines = f.readlines() lines = f.readlines()
log_tail = "".join(lines[-50:]) log_tail = "".join(lines[-50:])
num_lines = len(lines) num_lines = len(lines)
if num_lines < 50: log_stderr = "%s/%s.stderr" % (gitroot, failed_tag)
if num_lines < 50 and os.access(log_stderr, os.R_OK):
# Also include stderr (compile failures) if < 50 lines of stdout # Also include stderr (compile failures) if < 50 lines of stdout
f = open("%s/%s.stderr" % (gitroot, failed_tag), 'r') f = open(log_stderr, 'r')
log_tail += "".join(f.readlines()[-(50 - num_lines):]) log_tail += "".join(f.readlines()[-(50 - num_lines):])
text += ''' text += '''