Donate CPU: Updated scripts
This commit is contained in:
parent
6ec6f70f2d
commit
629639f6ae
|
@ -14,7 +14,7 @@ def strDateTime():
|
||||||
t = datetime.time.strftime(datetime.datetime.now().time(), '%H:%M')
|
t = datetime.time.strftime(datetime.datetime.now().time(), '%H:%M')
|
||||||
return d + ' ' + t
|
return d + ' ' + t
|
||||||
|
|
||||||
def fmt(a,b,c,d):
|
def fmt(a,b,c,d,e):
|
||||||
ret = a + ' '
|
ret = a + ' '
|
||||||
while len(ret)<10:
|
while len(ret)<10:
|
||||||
ret += ' '
|
ret += ' '
|
||||||
|
@ -29,6 +29,7 @@ def fmt(a,b,c,d):
|
||||||
while len(ret) < 37-len(d):
|
while len(ret) < 37-len(d):
|
||||||
ret += ' '
|
ret += ' '
|
||||||
ret += d
|
ret += d
|
||||||
|
ret += ' ' + e
|
||||||
if a != 'Package':
|
if a != 'Package':
|
||||||
pos = ret.find(' ')
|
pos = ret.find(' ')
|
||||||
ret = '<a href="' + a + '">' + a + '</a>' + ret[pos:]
|
ret = '<a href="' + a + '">' + a + '</a>' + ret[pos:]
|
||||||
|
@ -36,27 +37,36 @@ def fmt(a,b,c,d):
|
||||||
|
|
||||||
|
|
||||||
def latestReport(latestResults):
|
def latestReport(latestResults):
|
||||||
html = '<html><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 ','head','1.84') + '</b>\n'
|
html += '<pre>\n<b>' + fmt('Package','Date Time ','head','1.84','Diff') + '</b>\n'
|
||||||
|
|
||||||
# Write report for latest results
|
# Write report for latest results
|
||||||
for filename in latestResults:
|
for filename in latestResults:
|
||||||
package = filename[filename.rfind('/')+1:]
|
package = filename[filename.rfind('/')+1:]
|
||||||
|
|
||||||
datestr = ''
|
datestr = ''
|
||||||
cppcheck = 'cppcheck/cppcheck'
|
count = ['0','0']
|
||||||
count = {'cppcheck/cppcheck':0, '1.84/cppcheck':0}
|
lost = 0
|
||||||
|
added = 0
|
||||||
for line in open(filename,'rt'):
|
for line in open(filename,'rt'):
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line.startswith('2018-'):
|
if line.startswith('2018-'):
|
||||||
datestr = line
|
datestr = line
|
||||||
elif line.startswith('cppcheck:'):
|
#elif line.startswith('cppcheck:'):
|
||||||
cppcheck = line[9:]
|
# cppcheck = line[9:]
|
||||||
elif re.match(r'.*:[0-9]+:[0-9]+: [a-z]+: .*\]$', line):
|
elif line.startswith('count: '):
|
||||||
count[cppcheck] += 1
|
count = line.split(' ')[1:]
|
||||||
|
elif line.startswith('1.84 '):
|
||||||
html += fmt(package, datestr, str(count['cppcheck/cppcheck']), str(count['1.84/cppcheck'])) + '\n'
|
lost += 1
|
||||||
|
elif line.startswith('head '):
|
||||||
|
added += 1
|
||||||
|
diff = ''
|
||||||
|
if lost > 0:
|
||||||
|
diff += '-' + str(lost)
|
||||||
|
if added > 0:
|
||||||
|
diff += '-' + str(added)
|
||||||
|
html += fmt(package, datestr, count[0], count[1], diff) + '\n'
|
||||||
|
|
||||||
html += '</pre></body></html>\n'
|
html += '</pre></body></html>\n'
|
||||||
return html
|
return html
|
||||||
|
@ -190,7 +200,7 @@ if __name__ == "__main__":
|
||||||
if pos < 10:
|
if pos < 10:
|
||||||
continue
|
continue
|
||||||
url = data[:pos]
|
url = data[:pos]
|
||||||
print('[' + strDateTime() + '] write:'+url)
|
print('[' + strDateTime() + '] write:' + url)
|
||||||
|
|
||||||
# save data
|
# save data
|
||||||
res = re.match(r'ftp://.*pool/main/[^/]+/([^/]+)/[^/]*tar.gz',url)
|
res = re.match(r'ftp://.*pool/main/[^/]+/([^/]+)/[^/]*tar.gz',url)
|
||||||
|
@ -198,7 +208,7 @@ if __name__ == "__main__":
|
||||||
print('results added for package ' + res.group(1))
|
print('results added for package ' + res.group(1))
|
||||||
filename = resultPath + '/' + res.group(1)
|
filename = resultPath + '/' + res.group(1)
|
||||||
f = open(filename, 'wt')
|
f = open(filename, 'wt')
|
||||||
f.write(strDateTime() + '\n' + data[pos+1:])
|
f.write(strDateTime() + '\n' + data)
|
||||||
f.close()
|
f.close()
|
||||||
# track latest added results..
|
# track latest added results..
|
||||||
if len(latestResults) >= 20:
|
if len(latestResults) >= 20:
|
||||||
|
|
|
@ -213,6 +213,9 @@ while True:
|
||||||
c,errout = scanPackage(workpath, cppcheck)
|
c,errout = scanPackage(workpath, cppcheck)
|
||||||
output += ' ' + str(c)
|
output += ' ' + str(c)
|
||||||
resultsToDiff.append(errout)
|
resultsToDiff.append(errout)
|
||||||
|
if len(resultsToDiff[0]) + len(resultsToDiff[1]) == 0:
|
||||||
|
print('No results')
|
||||||
|
continue
|
||||||
output += '\ndiff:\n' + diffResults(workpath, 'head', resultsToDiff[0], '1.84', resultsToDiff[1])
|
output += '\ndiff:\n' + diffResults(workpath, 'head', resultsToDiff[0], '1.84', resultsToDiff[1])
|
||||||
uploadResults(package, output)
|
uploadResults(package, output)
|
||||||
print('Results have been uploaded')
|
print('Results have been uploaded')
|
||||||
|
|
Loading…
Reference in New Issue