1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-11 15:13:27 +02:00

Calculate added dates correctly when archive in use

This fixes what's new, amongst other things.
This commit is contained in:
Ciaran Gultnieks 2013-11-27 09:35:43 +00:00
parent 7cc21fe89a
commit ee769bedee

View File

@ -768,10 +768,19 @@ def main():
delete_disabled_builds(apps, apkcache, repodirs) delete_disabled_builds(apps, apkcache, repodirs)
# Scan all apks in the main repo
apks, cc = scan_apks(apps, apkcache, repodirs[0], knownapks) apks, cc = scan_apks(apps, apkcache, repodirs[0], knownapks)
if cc: if cc:
cachechanged = True cachechanged = True
# Scan the archive repo for apks as well
if len(repodirs) > 1:
archapks, cc = scan_apks(apps, apkcache, repodirs[1], knownapks)
if cc:
cachechanged = True
else:
archapks = []
# Some information from the apks needs to be applied up to the application # Some information from the apks needs to be applied up to the application
# level. When doing this, we use the info from the most recent version's apk. # level. When doing this, we use the info from the most recent version's apk.
# We deal with figuring out when the app was added and last updated at the # We deal with figuring out when the app was added and last updated at the
@ -780,7 +789,7 @@ def main():
bestver = 0 bestver = 0
added = None added = None
lastupdated = None lastupdated = None
for apk in apks: for apk in apks + archapks:
if apk['id'] == app['id']: if apk['id'] == app['id']:
if apk['versioncode'] > bestver: if apk['versioncode'] > bestver:
bestver = apk['versioncode'] bestver = apk['versioncode']
@ -795,17 +804,19 @@ def main():
if added: if added:
app['added'] = added app['added'] = added
else: else:
print "WARNING: Don't know when " + app['id'] + " was added" if options.verbose:
print "WARNING: Don't know when " + app['id'] + " was added"
if lastupdated: if lastupdated:
app['lastupdated'] = lastupdated app['lastupdated'] = lastupdated
else: else:
print "WARNING: Don't know when " + app['id'] + " was last updated" if options.verbose:
print "WARNING: Don't know when " + app['id'] + " was last updated"
if bestver == 0: if bestver == 0:
if app['Name'] is None: if app['Name'] is None:
app['Name'] = app['id'] app['Name'] = app['id']
app['icon'] = None app['icon'] = None
if app['Disabled'] is None: if options.verbose and app['Disabled'] is None:
print "WARNING: Application " + app['id'] + " has no packages" print "WARNING: Application " + app['id'] + " has no packages"
else: else:
if app['Name'] is None: if app['Name'] is None:
@ -848,12 +859,9 @@ def main():
# Make the index for the main repo... # Make the index for the main repo...
make_index(apps, apks, repodirs[0], False, categories) make_index(apps, apks, repodirs[0], False, categories)
# If there's an archive repo, scan the apks for that and make the index... # If there's an archive repo, make the index for it. We already scanned it
archapks = None # earlier on.
if len(repodirs) > 1: if len(repodirs) > 1:
archapks, cc = scan_apks(apps, apkcache, repodirs[1], knownapks)
if cc:
cachechanged = True
make_index(apps, archapks, repodirs[1], True, categories) make_index(apps, archapks, repodirs[1], True, categories)
if config['update_stats']: if config['update_stats']:
@ -884,9 +892,7 @@ def main():
# Update the wiki... # Update the wiki...
if options.wiki: if options.wiki:
if archapks: update_wiki(apps, apks + archapks)
apks.extend(archapks)
update_wiki(apps, apks)
print "Finished." print "Finished."