1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 11:00:10 +01:00

Tracking of dates apks are added to the repo

This commit is contained in:
Ciaran Gultnieks 2012-01-19 23:03:35 +00:00
parent 23a83e1b1e
commit 15ce8303f9
2 changed files with 15 additions and 7 deletions

View File

@ -19,7 +19,7 @@
import glob, os, sys, re import glob, os, sys, re
import shutil import shutil
import subprocess import subprocess
import time
def getvcs(vcstype, remote, local): def getvcs(vcstype, remote, local):
if vcstype == 'git': if vcstype == 'git':
@ -791,7 +791,10 @@ class KnownApks:
if os.path.exists(self.path): if os.path.exists(self.path):
for line in file( self.path): for line in file( self.path):
t = line.rstrip().split(' ') t = line.rstrip().split(' ')
self.apks[t[0]] = t[1] if len(t) == 2:
self.apks[t[0]] = (t[1], None)
else:
self.apks[t[0]] = (t[1], time.strptime(t[2], '%Y-%m-%d'))
self.changed = False self.changed = False
def writeifchanged(self): def writeifchanged(self):
@ -801,14 +804,18 @@ class KnownApks:
f = open(self.path, 'w') f = open(self.path, 'w')
lst = [] lst = []
for apk, app in self.apks.iteritems(): for apk, app in self.apks.iteritems():
lst.append(apk + ' ' + app) appid, added = app
line = apk + ' ' + appid
if added:
line += ' ' + time.strftime('%Y-%m-%d', added)
lst.append(line)
for line in sorted(lst): for line in sorted(lst):
f.write(line + '\n') f.write(line + '\n')
f.close() f.close()
def recordapk(self, apk, app): def recordapk(self, apk, app):
if not apk in self.apks: if not apk in self.apks:
self.apks[apk] = app self.apks[apk] = (app, time.gmtime(time.time()))
self.changed = True self.changed = True
def getapp(self, apkname): def getapp(self, apkname):

View File

@ -112,10 +112,11 @@ for logfile in glob.glob(os.path.join(logsdir,'access-*.log')):
_, apkname = os.path.split(uri) _, apkname = os.path.split(uri)
app = knownapks.getapp(apkname) app = knownapks.getapp(apkname)
if app: if app:
if app in apps: appid, _ = app
apps[app] += 1 if appid in apps:
apps[appid] += 1
else: else:
apps[app] = 1 apps[appid] = 1
else: else:
if not apkname in unknownapks: if not apkname in unknownapks:
unknownapks.append(apkname) unknownapks.append(apkname)