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,11 +568,15 @@ 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')
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'
+ apkfilename
+ '\nSet clock to that time using:\n'
+ 'sudo date -s "' + str(dt_obj) + '"')
iconfilename = "%s.%s.png" % (