Partly revert c7f2cbd to make stats work again

This commit is contained in:
Ciaran Gultnieks 2014-02-04 07:34:40 +00:00
parent 49ec09a78b
commit b8e48f32f7

View file

@ -27,9 +27,8 @@ from optparse import OptionParser
import paramiko import paramiko
import socket import socket
import logging import logging
import common, metadata import common, metadata
from common import FDroidPopen import subprocess
def carbon_send(key, value): def carbon_send(key, value):
s = socket.socket() s = socket.socket()
@ -121,13 +120,14 @@ def main():
logsearch = re.compile(logexpr).search logsearch = re.compile(logexpr).search
for logfile in glob.glob(os.path.join(logsdir,'access-*.log.gz')): for logfile in glob.glob(os.path.join(logsdir,'access-*.log.gz')):
logging.info('...' + logfile) logging.info('...' + logfile)
p = FDroidPopen(["zcat", logfile]) if options.verbose:
print '...' + logfile
p = subprocess.Popen(["zcat", logfile], stdout = subprocess.PIPE)
matches = (logsearch(line) for line in p.stdout) matches = (logsearch(line) for line in p.stdout)
for match in matches: for match in matches:
if match and match.group('statuscode') == '200': if match and match.group('statuscode') == '200':
uri = match.group('uri') uri = match.group('uri')
if not uri.endswith('.apk'): if uri.endswith('.apk'):
continue
_, apkname = os.path.split(uri) _, apkname = os.path.split(uri)
app = knownapks.getapp(apkname) app = knownapks.getapp(apkname)
if app: if app: