Merge pull request #816 from Vsevolod-Livinskij/alloy_update

Alloy.py update
This commit is contained in:
Dmitry Babokin
2014-07-09 15:13:54 +04:00

View File

@@ -72,6 +72,10 @@ def try_do_LLVM(text, command, from_validation):
postfix = " >> " + alloy_build + " 2>> " + alloy_build postfix = " >> " + alloy_build + " 2>> " + alloy_build
if os.system(command + postfix) != 0: if os.system(command + postfix) != 0:
print_debug("ERROR.\n", from_validation, alloy_build) print_debug("ERROR.\n", from_validation, alloy_build)
if options.notify != "":
msg = MIMEMultipart()
attach_mail_file(msg, alloy_build, "alloy_build.log")
send_mail("Unable to build or download something. See logs for more information.", msg)
error("can't " + text, 1) error("can't " + text, 1)
print_debug("DONE.\n", from_validation, alloy_build) print_debug("DONE.\n", from_validation, alloy_build)
@@ -296,6 +300,18 @@ def build_ispc(version_LLVM, make):
p_temp = os.getenv("PATH") p_temp = os.getenv("PATH")
os.environ["PATH"] = os.environ["LLVM_HOME"] + "/bin-" + version_LLVM + "/bin:" + os.environ["PATH"] os.environ["PATH"] = os.environ["LLVM_HOME"] + "/bin-" + version_LLVM + "/bin:" + os.environ["PATH"]
try_do_LLVM("clean ISPC for building", "make clean", True) try_do_LLVM("clean ISPC for building", "make clean", True)
folder = os.environ["LLVM_HOME"] + os.sep + "llvm-"
if options.folder == "":
folder += version_LLVM
if options.debug == True:
folder += "dbg"
p = subprocess.Popen("svnversion " + folder, shell=True, \
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(revision_llvm, err) = p.communicate()
try_do_LLVM("recognize LLVM revision", "svn info " + folder, True)
try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", make, True) try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", make, True)
os.environ["PATH"] = p_temp os.environ["PATH"] = p_temp
else: else:
@@ -360,11 +376,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
os.environ["PATH"] = os.environ["ISPC_HOME"] + ":" + os.environ["PATH"] os.environ["PATH"] = os.environ["ISPC_HOME"] + ":" + os.environ["PATH"]
if options.notify != "": if options.notify != "":
common.remove_if_exists(os.environ["ISPC_HOME"] + os.sep + "notify_log.log") common.remove_if_exists(os.environ["ISPC_HOME"] + os.sep + "notify_log.log")
smtp_server = os.environ["SMTP_ISPC"]
msg = MIMEMultipart() msg = MIMEMultipart()
msg['Subject'] = 'ISPC test system results'
msg['From'] = 'ISPC_test_system'
msg['To'] = options.notify
print_debug("Command: " + ' '.join(sys.argv) + "\n", False, "") print_debug("Command: " + ' '.join(sys.argv) + "\n", False, "")
print_debug("Folder: " + os.environ["ISPC_HOME"] + "\n", False, "") print_debug("Folder: " + os.environ["ISPC_HOME"] + "\n", False, "")
date = datetime.datetime.now() date = datetime.datetime.now()
@@ -602,21 +614,24 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
fp = open(os.environ["ISPC_HOME"] + os.sep + "notify_log.log", 'rb') fp = open(os.environ["ISPC_HOME"] + os.sep + "notify_log.log", 'rb')
f_lines = fp.readlines() f_lines = fp.readlines()
fp.close() fp.close()
line = "" body = ""
if not sys.exc_info()[0] == None: if not sys.exc_info()[0] == None:
line = line + "Last exception: " + str(sys.exc_info()) + '\n' body = body + "Last exception: " + str(sys.exc_info()) + '\n'
for i in range(0,len(f_lines)): for i in range(0,len(f_lines)):
line = line + f_lines[i][:-1] body = body + f_lines[i][:-1]
line = line + ' \n' body = body + ' \n'
text = MIMEText(line, "", "KOI-8")
msg.attach(text)
attach_mail_file(msg, alloy_build, "alloy_build.log") attach_mail_file(msg, alloy_build, "alloy_build.log")
s = smtplib.SMTP(smtp_server) send_mail(body, msg)
print "Sending an e-mail with logs:", options.notify def send_mail(body, msg):
for name in options.notify.split(" "): smtp_server = os.environ["SMTP_ISPC"]
print "Sending to: ", name msg['Subject'] = "ISPC test system results"
s.sendmail('ISPC_test_system', name, msg.as_string()) msg['From'] = "ISPC_test_system"
msg['To'] = options.notify
text = MIMEText(body, "", "KOI-8")
msg.attach(text)
s = smtplib.SMTP(smtp_server)
s.sendmail(options.notify, options.notify.split(" "), msg.as_string())
s.quit() s.quit()
def Main(): def Main():
@@ -703,6 +718,7 @@ import smtplib
import datetime import datetime
import copy import copy
import multiprocessing import multiprocessing
import subprocess
from email.MIMEMultipart import MIMEMultipart from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase from email.MIMEBase import MIMEBase
from email.mime.text import MIMEText from email.mime.text import MIMEText