daca2-report: better handling when no packages found

This commit is contained in:
Daniel Marjamäki 2017-06-03 14:03:16 +02:00
parent 73ac088688
commit 6ac1aafa49
1 changed files with 45 additions and 51 deletions

View File

@ -2,7 +2,6 @@ import os
import sys import sys
import subprocess import subprocess
def readdate(data): def readdate(data):
datepos = -1 datepos = -1
if data[:5] == 'DATE ': if data[:5] == 'DATE ':
@ -77,23 +76,18 @@ for lib in [False, True]:
for a in "0123456789abcdefghijklmnopqrstuvwxyz": for a in "0123456789abcdefghijklmnopqrstuvwxyz":
if lib == True: if lib == True:
a = "lib" + a a = "lib" + a
if os.path.isfile(daca2 + a + '/results.txt'): if not os.path.isfile(daca2 + a + '/results.txt'):
continue
f = open(daca2 + a + '/results.txt', 'rt') f = open(daca2 + a + '/results.txt', 'rt')
data = f.read() data = f.read()
f.close() f.close()
if data.find('ftp://')<0:
continue
datestr = readdate(data) datestr = readdate(data)
if os.path.isfile(daca2 + 'results-' + a + '.txt'):
f2 = open(daca2 + 'results-' + a + '.txt')
data2 = f2.read()
f2.close()
datestr2 = readdate(data2)
if not datestr or datestr < datestr2:
data = data2
datestr = datestr2
if datestr: if datestr:
if not lastupdate or datestr > lastupdate: if not lastupdate or datestr > lastupdate:
lastupdate = datestr lastupdate = datestr