donate-cpu: use 1.86 as base version

This commit is contained in:
Daniel Marjamäki 2018-12-08 11:39:44 +01:00
parent a16f694254
commit 49e500d6bf
2 changed files with 15 additions and 10 deletions

View File

@ -11,6 +11,8 @@ from threading import Thread
import subprocess import subprocess
import sys import sys
OLD_VERSION = '1.86'
def strDateTime(): def strDateTime():
d = datetime.date.strftime(datetime.datetime.now().date(), '%Y-%m-%d') d = datetime.date.strftime(datetime.datetime.now().date(), '%Y-%m-%d')
t = datetime.time.strftime(datetime.datetime.now().time(), '%H:%M') t = datetime.time.strftime(datetime.datetime.now().time(), '%H:%M')
@ -51,7 +53,7 @@ def fmt(a,b,c,d,e):
def latestReport(latestResults): def latestReport(latestResults):
html = '<html><head><title>Latest daca@home results</title></head><body>\n' html = '<html><head><title>Latest daca@home results</title></head><body>\n'
html += '<h1>Latest daca@home results</h1>' html += '<h1>Latest daca@home results</h1>'
html += '<pre>\n<b>' + fmt('Package','Date Time ','1.85','Head','Diff') + '</b>\n' html += '<pre>\n<b>' + fmt('Package','Date Time ',OLD_VERSION,'Head','Diff') + '</b>\n'
# Write report for latest results # Write report for latest results
for filename in latestResults: for filename in latestResults:
@ -73,7 +75,7 @@ def latestReport(latestResults):
count = line.split(' ')[1:] count = line.split(' ')[1:]
elif line.startswith('head '): elif line.startswith('head '):
added += 1 added += 1
elif line.startswith('1.85 '): elif line.startswith(OLD_VERSION + ' '):
lost += 1 lost += 1
diff = '' diff = ''
if lost > 0: if lost > 0:
@ -90,7 +92,7 @@ def crashReport():
html = '<html><head><title>Crash report</title></head><body>\n' html = '<html><head><title>Crash report</title></head><body>\n'
html += '<h1>Crash report</h1>\n' html += '<h1>Crash report</h1>\n'
html += '<pre>\n' html += '<pre>\n'
html += '<b>Package 1.85 Head</b>\n' html += '<b>Package ' + OLD_VERSION + ' Head</b>\n'
for filename in sorted(glob.glob(os.path.expanduser('~/daca@home/donated-results/*'))): for filename in sorted(glob.glob(os.path.expanduser('~/daca@home/donated-results/*'))):
if not os.path.isfile(filename): if not os.path.isfile(filename):
continue continue
@ -121,7 +123,7 @@ def crashReport():
def diffReportFromDict(out, today): def diffReportFromDict(out, today):
html = '<pre>\n' html = '<pre>\n'
html += '<b>MessageID 1.85 Head</b>\n' html += '<b>MessageID ' + OLD_VERSION + ' Head</b>\n'
sum0 = 0 sum0 = 0
sum1 = 0 sum1 = 0
for messageId in sorted(out.keys()): for messageId in sorted(out.keys()):
@ -177,7 +179,7 @@ def diffReport(resultsPath):
if not line.endswith(']'): if not line.endswith(']'):
continue continue
index = None index = None
if line.startswith('1.85 '): if line.startswith(OLD_VERSION + ' '):
index = 0 index = 0
elif line.startswith('head '): elif line.startswith('head '):
index = 1 index = 1
@ -253,7 +255,7 @@ def diffMessageIdTodayReport(resultPath, messageId):
def timeReport(resultPath): def timeReport(resultPath):
text = 'Time report\n\n' text = 'Time report\n\n'
text += 'Package 1.85 Head\n' text += 'Package ' + OLD_VERSION + ' Head\n'
totalTime184 = 0.0 totalTime184 = 0.0
totalTimeHead = 0.0 totalTimeHead = 0.0
@ -381,8 +383,9 @@ def server(server_address_port, packages, packageIndex, resultPath):
newThread = HttpClientThread(connection, cmd, resultPath, latestResults) newThread = HttpClientThread(connection, cmd, resultPath, latestResults)
newThread.start() newThread.start()
elif cmd=='GetCppcheckVersions\n': elif cmd=='GetCppcheckVersions\n':
print('[' + strDateTime() + '] GetCppcheckVersions: head 1.85') reply = 'head ' + OLD_VERSION
connection.send('head 1.85') print('[' + strDateTime() + '] GetCppcheckVersions: ' + reply)
connection.send(reply)
connection.close() connection.close()
elif cmd=='get\n': elif cmd=='get\n':
pkg = packages[packageIndex].strip() pkg = packages[packageIndex].strip()

View File

@ -89,7 +89,6 @@ def compile(cppcheckPath, jobs):
def getCppcheckVersions(): def getCppcheckVersions():
print('Connecting to server to get Cppcheck versions..') print('Connecting to server to get Cppcheck versions..')
package = None
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('cppcheck.osuosl.org', 8000) server_address = ('cppcheck.osuosl.org', 8000)
try: try:
@ -97,7 +96,7 @@ def getCppcheckVersions():
sock.send(b'GetCppcheckVersions\n') sock.send(b'GetCppcheckVersions\n')
versions = sock.recv(256) versions = sock.recv(256)
except socket.error: except socket.error:
return ['head', '1.85'] return None
sock.close() sock.close()
return versions.decode('utf-8').split() return versions.decode('utf-8').split()
@ -362,6 +361,9 @@ while True:
print('Failed to clone Cppcheck, retry later') print('Failed to clone Cppcheck, retry later')
sys.exit(1) sys.exit(1)
cppcheckVersions = getCppcheckVersions() cppcheckVersions = getCppcheckVersions()
if cppcheckVersions is None:
print('Failed to communicate with server, retry later')
sys.exit(1)
for ver in cppcheckVersions: for ver in cppcheckVersions:
if ver == 'head': if ver == 'head':
if compile(cppcheckPath, jobs) == False: if compile(cppcheckPath, jobs) == False: