From 6ac1aafa49e091067665874d66ad865d6c9a3373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 3 Jun 2017 14:03:16 +0200 Subject: [PATCH] daca2-report: better handling when no packages found --- tools/daca2-report.py | 96 ++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 51 deletions(-) diff --git a/tools/daca2-report.py b/tools/daca2-report.py index 656e86413..472eed23e 100644 --- a/tools/daca2-report.py +++ b/tools/daca2-report.py @@ -2,7 +2,6 @@ import os import sys import subprocess - def readdate(data): datepos = -1 if data[:5] == 'DATE ': @@ -77,63 +76,58 @@ for lib in [False, True]: for a in "0123456789abcdefghijklmnopqrstuvwxyz": if lib == True: a = "lib" + a - if os.path.isfile(daca2 + a + '/results.txt'): - f = open(daca2 + a + '/results.txt', 'rt') - data = f.read() - f.close() + if not os.path.isfile(daca2 + a + '/results.txt'): + continue - datestr = readdate(data) + f = open(daca2 + a + '/results.txt', 'rt') + data = f.read() + f.close() - if os.path.isfile(daca2 + 'results-' + a + '.txt'): - f2 = open(daca2 + 'results-' + a + '.txt') - data2 = f2.read() - f2.close() + if data.find('ftp://')<0: + continue - datestr2 = readdate(data2) - if not datestr or datestr < datestr2: - data = data2 - datestr = datestr2 + datestr = readdate(data) - if datestr: - if not lastupdate or datestr > lastupdate: - lastupdate = datestr - recent = [] - if datestr == lastupdate: - recent.append(a) - else: - datestr = '' + if datestr: + if not lastupdate or datestr > lastupdate: + lastupdate = datestr + recent = [] + if datestr == lastupdate: + recent.append(a) + else: + datestr = '' - mainpage.write( - '' + - '' + a + '' + - '' + datestr + '' + - '' + str(data.count(': error:')) + '' + - '' + str(data.count(': warning:')) + '' + - '' + str(data.count(': performance:')) + '' + - '' + str(data.count(': portability:')) + '' + - '' + str(data.count(': style:')) + '' + - '' + str(data.count('Crash?')) + '' + - '' + str(data.count('with varid 0.')) + '' + - '\n') + mainpage.write( + '' + + '' + a + '' + + '' + datestr + '' + + '' + str(data.count(': error:')) + '' + + '' + str(data.count(': warning:')) + '' + + '' + str(data.count(': performance:')) + '' + + '' + str(data.count(': portability:')) + '' + + '' + str(data.count(': style:')) + '' + + '' + str(data.count('Crash?')) + '' + + '' + str(data.count('with varid 0.')) + '' + + '\n') - data = data.replace('&', '&') - data = data.replace('<', '<') - data = data.replace('>', '>') - data = data.replace('\n', '\n') + data = data.replace('&', '&') + data = data.replace('<', '<') + data = data.replace('>', '>') + data = data.replace('\n', '\n') - f = open(path + 'daca2-' + a + '.html', 'wt') - f.write('\n') - f.write('\n') - f.write('\n') - f.write('\n') - f.write('DACA2 - ' + a + '\n') - f.write('\n') - f.write('\n') - f.write('

DACA2 - ' + a + '

') - f.write('
\n' + data + '
\n') - f.write('\n') - f.write('\n') - f.close() + f = open(path + 'daca2-' + a + '.html', 'wt') + f.write('\n') + f.write('\n') + f.write('\n') + f.write('\n') + f.write('DACA2 - ' + a + '\n') + f.write('\n') + f.write('\n') + f.write('

DACA2 - ' + a + '

') + f.write('
\n' + data + '
\n') + f.write('\n') + f.write('\n') + f.close() mainpage.write('\n')