2013-10-16 18:15:51 +02:00
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2013-10-18 17:35:59 +02:00
|
|
|
|
2013-10-16 18:15:51 +02:00
|
|
|
def readdate(data):
|
2013-10-18 17:35:59 +02:00
|
|
|
datepos = -1
|
|
|
|
if data[:5] == 'DATE ':
|
|
|
|
datepos = 0
|
|
|
|
else:
|
|
|
|
datepos = data.find('\nDATE ')
|
|
|
|
if datepos >= 0:
|
|
|
|
datepos = datepos + 1
|
2013-10-16 18:15:51 +02:00
|
|
|
|
2013-10-18 17:35:59 +02:00
|
|
|
if datepos < 0:
|
|
|
|
return None
|
2013-10-16 18:15:51 +02:00
|
|
|
|
2013-10-18 17:35:59 +02:00
|
|
|
datestr = ''
|
|
|
|
datepos = datepos + 5
|
|
|
|
while True:
|
|
|
|
if datepos >= len(data):
|
|
|
|
return None
|
|
|
|
d = data[datepos]
|
|
|
|
if d >= '0' and d <= '9':
|
|
|
|
datestr = datestr + d
|
|
|
|
elif d == '\n':
|
|
|
|
if len(datestr) == 8:
|
|
|
|
return datestr[:4] + '-' + datestr[4:6] + '-' + datestr[6:]
|
|
|
|
return None
|
|
|
|
elif d != ' ' and d != '-':
|
|
|
|
return None
|
|
|
|
datepos = datepos + 1
|
2013-10-16 18:15:51 +02:00
|
|
|
|
|
|
|
path = '.'
|
|
|
|
if len(sys.argv) == 2:
|
|
|
|
path = sys.argv[1]
|
|
|
|
|
|
|
|
mainpage = open(path + '/daca2.html', 'wt')
|
2013-10-17 15:20:58 +02:00
|
|
|
mainpage.write('<!DOCTYPE html>\n')
|
|
|
|
mainpage.write('<html lang="en"><head><title>DACA2</title></head>\n')
|
2013-10-16 18:15:51 +02:00
|
|
|
mainpage.write('<body>\n')
|
|
|
|
mainpage.write('<h1>DACA2</h1>\n')
|
|
|
|
mainpage.write('<p>Results when running latest Cppcheck on Debian.</p>\n')
|
|
|
|
|
|
|
|
lastupdate = None
|
|
|
|
recent = []
|
|
|
|
|
|
|
|
daca2 = os.path.expanduser('~/daca2/')
|
|
|
|
for lib in range(2):
|
2013-10-18 17:35:59 +02:00
|
|
|
for a in "0123456789abcdefghijklmnopqrstuvwxyz":
|
|
|
|
if lib == 1:
|
|
|
|
a = "lib" + a
|
|
|
|
if os.path.isfile(daca2 + a + '/results.txt'):
|
|
|
|
f = open(daca2 + a + '/results.txt', 'rt')
|
|
|
|
data = f.read()
|
|
|
|
f.close()
|
2013-10-16 18:15:51 +02:00
|
|
|
|
2013-10-18 17:35:59 +02:00
|
|
|
datestr = readdate(data)
|
|
|
|
if datestr:
|
|
|
|
if not lastupdate or datestr > lastupdate:
|
|
|
|
lastupdate = datestr
|
|
|
|
recent = []
|
|
|
|
if datestr == lastupdate:
|
|
|
|
recent.append(a)
|
2013-10-16 18:15:51 +02:00
|
|
|
|
2013-10-18 17:35:59 +02:00
|
|
|
mainpage.write(
|
|
|
|
'<a href="daca2-' + a + '.html">' + a + '</a><br>\n')
|
2013-10-16 18:15:51 +02:00
|
|
|
|
2013-10-18 17:35:59 +02:00
|
|
|
data = data.replace('&', ' ')
|
|
|
|
data = data.replace('<', '<')
|
|
|
|
data = data.replace('>', '>')
|
|
|
|
data = data.replace('\'', ''')
|
|
|
|
data = data.replace('"', '"')
|
|
|
|
data = data.replace('\n', '\n')
|
2013-10-16 18:15:51 +02:00
|
|
|
|
2013-10-18 17:35:59 +02:00
|
|
|
f = open(path + '/daca2-' + a + '.html', 'wt')
|
2013-10-17 15:20:58 +02:00
|
|
|
f.write('<!DOCTYPE html>\n')
|
2013-10-20 18:36:33 +02:00
|
|
|
f.write(
|
|
|
|
'<html lang="en"><head><title>DACA2 - ' + a + '</title></head>\n')
|
2013-10-18 17:35:59 +02:00
|
|
|
f.write('<body>\n')
|
|
|
|
f.write('<h1>DACA2 - ' + a + '</h1>')
|
|
|
|
f.write('<pre>\n' + data + '</pre>\n')
|
|
|
|
f.write('</body>\n')
|
|
|
|
f.write('</html>\n')
|
|
|
|
f.close()
|
2013-10-16 18:15:51 +02:00
|
|
|
|
|
|
|
if lastupdate:
|
2013-10-18 17:35:59 +02:00
|
|
|
mainpage.write('<p>Last update: ' + lastupdate + '</p>')
|
|
|
|
allrecent = ''
|
|
|
|
for r in recent:
|
|
|
|
allrecent = allrecent + ' <a href="daca2-' + r + '.html">' + r + '</a>'
|
|
|
|
mainpage.write('<p>Most recently updated: ' + allrecent + '</p>')
|
2013-10-16 18:15:51 +02:00
|
|
|
|
|
|
|
mainpage.write('</body>\n')
|
|
|
|
mainpage.write('</html>\n')
|