1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-08-16 03:10:09 +02:00

Fix update crash in case of unset dates in APK

This commit is contained in:
Dmitriy Bogdanov 2016-02-18 16:40:51 +04:00
parent 8135760554
commit a8b1472a43

View File

@ -568,12 +568,16 @@ def scan_apks(apps, apkcache, repodir, knownapks):
# has to be more than 24 hours newer because ZIP/APK files do not
# store timezone info
manifest = apkzip.getinfo('AndroidManifest.xml')
dt_obj = datetime(*manifest.date_time)
checkdt = dt_obj - timedelta(1)
if datetime.today() < checkdt:
logging.warn('System clock is older than manifest in: '
+ apkfilename + '\nSet clock to that time using:\n'
+ 'sudo date -s "' + str(dt_obj) + '"')
if manifest.date_time[1] == 0: # month can't be zero
logging.debug('AndroidManifest.xml has no date')
else:
dt_obj = datetime(*manifest.date_time)
checkdt = dt_obj - timedelta(1)
if datetime.today() < checkdt:
logging.warn('System clock is older than manifest in: '
+ apkfilename
+ '\nSet clock to that time using:\n'
+ 'sudo date -s "' + str(dt_obj) + '"')
iconfilename = "%s.%s.png" % (
apk['id'],