mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 02:50:12 +01:00
Merge branch 'use_date_from_apk_in_known_apks' into 'master'
Pass a date from APK to KnownApks.recordapk() ... if --use-date-from-apks option is used. Essentially, it just expands influence of `--use-date-from-apks` option to `stats/known_apks.txt`. See merge request !141
This commit is contained in:
commit
21404e8622
@ -1570,9 +1570,11 @@ class KnownApks:
|
||||
|
||||
# Record an apk (if it's new, otherwise does nothing)
|
||||
# Returns the date it was added.
|
||||
def recordapk(self, apk, app):
|
||||
def recordapk(self, apk, app, default_date=None):
|
||||
if apk not in self.apks:
|
||||
self.apks[apk] = (app, time.gmtime(time.time()))
|
||||
if default_date is None:
|
||||
default_date = time.gmtime(time.time())
|
||||
self.apks[apk] = (app, default_date)
|
||||
self.changed = True
|
||||
_, added = self.apks[apk]
|
||||
return added
|
||||
|
@ -784,13 +784,14 @@ def scan_apks(apps, apkcache, repodir, knownapks, use_date_from_apk=False):
|
||||
shutil.copyfile(baseline,
|
||||
os.path.join(get_icon_dir(repodir, '0'), iconfilename))
|
||||
|
||||
# Record in known apks, getting the added date at the same time..
|
||||
added = knownapks.recordapk(apk['apkname'], apk['id'])
|
||||
if added:
|
||||
if use_date_from_apk and manifest.date_time[1] != 0:
|
||||
added = datetime(*manifest.date_time).timetuple()
|
||||
logging.debug("Using date from APK")
|
||||
if use_date_from_apk and manifest.date_time[1] != 0:
|
||||
default_date_param = datetime(*manifest.date_time).utctimetuple()
|
||||
else:
|
||||
default_date_param = None
|
||||
|
||||
# Record in known apks, getting the added date at the same time..
|
||||
added = knownapks.recordapk(apk['apkname'], apk['id'], default_date=default_date_param)
|
||||
if added:
|
||||
apk['added'] = added
|
||||
|
||||
apkcache[apkfilename] = apk
|
||||
|
Loading…
Reference in New Issue
Block a user