Add script to convert html download stats to CSV
[deliverable/tracecompass.git] / releng / scripts / html_rcp_download_stats_to_csv.py
1 ###############################################################################
2 # Copyright (c) 2016 Ericsson
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Eclipse Public License v1.0
6 # which accompanies this distribution, and is available at
7 # http://www.eclipse.org/legal/epl-v10.html
8 ###############################################################################
9
10 #args: filename
11
12 # Parses the HTML of download stats and converts it to CSV
13 #
14 # Example usage:
15 # 1. Login to eclipse.org with your acount and open this page:
16 #https://dev.eclipse.org/committers/committertools/stats.php?filename=/tracecompass/releases/%trace-compass%
17 # 2. Save this page as HTML
18 # 3. python html_rcp_download_stats_to_csv.py page.html > out.csv
19
20 # Example html content
21 # <td><a href="javascript:fnViewDaily('/tracecompass/releases/1.0.0/rcp/trace-compass-1.0.0-20150610-1449-linux.gtk.x86_64.tar.gz',%20'daily');">/tracecompass/releases/1.0.0/rcp/trace-compass-1.0.0-20150610-1449-linux.gtk.x86_64.tar.gz</a></td>
22 # <td align="right">3</td>
23 # ...
24 # <td><a href="javascript:fnViewDaily('/tracecompass/releases/1.0.0/rcp/trace-compass-1.0.0-20150610-1449-win32.win32.x86_64.zip',%20'daily');">/tracecompass/releases/1.0.0/rcp/trace-compass-1.0.0-20150610-1449-win32.win32.x86_64.zip</a></td>
25 # <td align="right">5</td>
26
27
28 import sys, re
29 fileContent = open(sys.argv[1]).read()
30 matchObject = re.finditer(".*releases/(\d+.\d+.\d+)/.*trace-compass-\d+\.\d+\.\d+-\d+-\d+-(.*)\..*\.(.*)\.(tar|zip).*\..*\n.*right\">(\d+).*", fileContent)
31 for m in matchObject:
32 print(m.group(1) + "," + m.group(2) + "," + m.group(3) + "," + m.group(5))
33
This page took 0.032177 seconds and 5 git commands to generate.