Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/stats/bin/logprocessor.py

Issue 29589691: Issue 5757 - Update buildtools dependency, (re)move legacy extensions (Closed)
Patch Set: Created Oct. 26, 2017, 10:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 20 matching lines...) Expand all
31 import subprocess 31 import subprocess
32 import sys 32 import sys
33 import traceback 33 import traceback
34 import urllib 34 import urllib
35 import urlparse 35 import urlparse
36 36
37 import sitescripts.stats.common as common 37 import sitescripts.stats.common as common
38 from sitescripts.utils import get_config, setupStderr 38 from sitescripts.utils import get_config, setupStderr
39 39
40 log_regexp = None 40 log_regexp = None
41 gecko_apps = None 41 KNOWN_APPS = {
tlucas 2017/11/02 10:03:29 I am not sure whether we (still) need all of these
Vasily Kuznetsov 2017/11/30 17:34:00 I suppose they might be needed because of users wi
tlucas 2017/11/30 18:15:26 By removing the code, you also mean "in a separate
Vasily Kuznetsov 2017/11/30 19:10:08 Yes.
42 '{55aba3ac-94d3-41a8-9e25-5c21fe874539}': 'adblockbrowser',
43 '{a79fe89b-6662-4ff4-8e88-09950ad4dfde}': 'conkeror',
44 'dlm@emusic.com': 'emusic',
45 '{a23983c0-fd0e-11dc-95ff-0800200c9a66}': 'fennec',
46 '{aa3c5121-dab2-40e2-81ca-7ea25febc110}': 'fennec2',
47 '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}': 'firefox',
48 '{aa5ca914-c309-495d-91cf-3141bbb04115}': 'midbrowser',
49 'prism@developer.mozilla.org': 'prism',
50 '{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}': 'seamonkey',
51 'songbird@songbirdnest.com': 'songbird',
52 '{3550f703-e582-4d05-9a08-453d09bdfdc6}': 'thunderbird',
53 'toolkit@mozilla.org': 'toolkit',
54 }
42 55
43 56
44 class StatsFile: 57 class StatsFile:
45 def __init__(self, path): 58 def __init__(self, path):
46 self._inner_file = None 59 self._inner_file = None
47 self._processes = [] 60 self._processes = []
48 61
49 parseresult = urlparse.urlparse(path) 62 parseresult = urlparse.urlparse(path)
50 if parseresult.scheme == 'ssh' and parseresult.username and parseresult. hostname and parseresult.path: 63 if parseresult.scheme == 'ssh' and parseresult.username and parseresult. hostname and parseresult.path:
51 command = [ 64 command = [
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 return file.split('/')[-2] 378 return file.split('/')[-2]
366 else: 379 else:
367 return None 380 return None
368 381
369 382
370 def parse_gecko_query(query): 383 def parse_gecko_query(query):
371 params = urlparse.parse_qs(query) 384 params = urlparse.parse_qs(query)
372 385
373 version = params.get('version', ['unknown'])[0] 386 version = params.get('version', ['unknown'])[0]
374 387
375 global gecko_apps
376 if gecko_apps == None:
377 from buildtools.packagerGecko import KNOWN_APPS
378 gecko_apps = {v: k for k, v in KNOWN_APPS.iteritems()}
379 appID = params.get('appID', ['unknown'])[0] 388 appID = params.get('appID', ['unknown'])[0]
380 389
381 application = gecko_apps.get(appID, 'unknown') 390 application = KNOWN_APPS.get(appID, 'unknown')
382 applicationVersion = params.get('appVersion', ['unknown'])[0] 391 applicationVersion = params.get('appVersion', ['unknown'])[0]
383 392
384 # Only leave the major and minor release number for application 393 # Only leave the major and minor release number for application
385 applicationVersion = re.sub(r'^(\d+\.\d+).*', r'\1', applicationVersion) 394 applicationVersion = re.sub(r'^(\d+\.\d+).*', r'\1', applicationVersion)
386 395
387 return version, application, applicationVersion 396 return version, application, applicationVersion
388 397
389 398
390 def parse_chrome_query(query): 399 def parse_chrome_query(query):
391 params = urlparse.parse_qs(query) 400 params = urlparse.parse_qs(query)
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 parser.add_argument('mirror_name', nargs='?', help='Name of the mirror serve r that the file belongs to') 603 parser.add_argument('mirror_name', nargs='?', help='Name of the mirror serve r that the file belongs to')
595 parser.add_argument('server_type', nargs='?', help='Server type like downloa d, update or subscription') 604 parser.add_argument('server_type', nargs='?', help='Server type like downloa d, update or subscription')
596 parser.add_argument('log_file', nargs='?', help='Log file path, can be a loc al file path, http:// or ssh:// URL') 605 parser.add_argument('log_file', nargs='?', help='Log file path, can be a loc al file path, http:// or ssh:// URL')
597 args = parser.parse_args() 606 args = parser.parse_args()
598 607
599 if args.mirror_name and args.server_type and args.log_file: 608 if args.mirror_name and args.server_type and args.log_file:
600 sources = [(args.mirror_name, args.server_type, args.log_file)] 609 sources = [(args.mirror_name, args.server_type, args.log_file)]
601 else: 610 else:
602 sources = get_stats_files() 611 sources = get_stats_files()
603 parse_sources(sources, args.factor, args.verbose) 612 parse_sources(sources, args.factor, args.verbose)
OLDNEW

Powered by Google App Engine
This is Rietveld