From 8be4af33d3c96e575e194789d42e38b176b50065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 30 Jun 2019 23:16:04 +0200 Subject: [PATCH] tools/donate-cpu-server: speed up the diff reports using the new diff files --- tools/donate-cpu-server.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/donate-cpu-server.py b/tools/donate-cpu-server.py index cdc863c12..1c9e0bcac 100644 --- a/tools/donate-cpu-server.py +++ b/tools/donate-cpu-server.py @@ -314,12 +314,16 @@ def generate_package_diff_statistics(filename): def diffMessageIdReport(resultPath, messageId): text = messageId + '\n' e = '[' + messageId + ']\n' - for filename in sorted(glob.glob(resultPath + '/*')): + for filename in sorted(glob.glob(resultPath + '/*.diff')): if not os.path.isfile(filename): continue + with open(filename, 'rt') as f: + diff_stats = f.read() + if not messageId in diff_stats: + continue url = None diff = False - for line in open(filename, 'rt'): + for line in open(filename[:-5], 'rt'): if line.startswith('ftp://'): url = line elif line == 'diff:\n': @@ -338,13 +342,19 @@ def diffMessageIdTodayReport(resultPath, messageId): text = messageId + '\n' e = '[' + messageId + ']\n' today = strDateTime()[:10] - for filename in sorted(glob.glob(resultPath + '/*')): + for filename in sorted(glob.glob(resultPath + '/*.diff')): if not os.path.isfile(filename): continue + with open(filename, 'rt') as f: + diff_stats = f.read() + if not messageId in diff_stats: + continue + if not today in diff_stats: + continue url = None diff = False firstLine = True - for line in open(filename, 'rt'): + for line in open(filename[:-5], 'rt'): if firstLine: firstLine = False if not line.startswith(today):