chiark / gitweb /
Calculate added dates correctly when archive in use
authorCiaran Gultnieks <ciaran@ciarang.com>
Wed, 27 Nov 2013 09:35:43 +0000 (09:35 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Wed, 27 Nov 2013 09:35:43 +0000 (09:35 +0000)
This fixes what's new, amongst other things.

fdroidserver/update.py

index 84321a243c1f85cbbdd4b9e31e341b0b9f95938c..c240b4053a4b1146fe00e9b0c565cb7c747eaec8 100644 (file)
@@ -768,10 +768,19 @@ def main():
 
     delete_disabled_builds(apps, apkcache, repodirs)
 
+    # Scan all apks in the main repo
     apks, cc = scan_apks(apps, apkcache, repodirs[0], knownapks)
     if cc:
         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
     # 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
@@ -780,7 +789,7 @@ def main():
         bestver = 0
         added = None
         lastupdated = None
-        for apk in apks:
+        for apk in apks + archapks:
             if apk['id'] == app['id']:
                 if apk['versioncode'] > bestver:
                     bestver = apk['versioncode']
@@ -795,17 +804,19 @@ def main():
         if added:
             app['added'] = added
         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:
             app['lastupdated'] = lastupdated
         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 app['Name'] is None:
                 app['Name'] = app['id']
             app['icon'] = None
-            if app['Disabled'] is None:
+            if options.verbose and app['Disabled'] is None:
                 print "WARNING: Application " + app['id'] + " has no packages"
         else:
             if app['Name'] is None:
@@ -848,12 +859,9 @@ def main():
     # Make the index for the main repo...
     make_index(apps, apks, repodirs[0], False, categories)
 
-    # If there's an archive repo, scan the apks for that and make the index...
-    archapks = None
+    # If there's an archive repo,  make the index for it. We already scanned it
+    # earlier on.
     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)
 
     if config['update_stats']:
@@ -884,9 +892,7 @@ def main():
 
     # Update the wiki...
     if options.wiki:
-        if archapks:
-            apks.extend(archapks)
-        update_wiki(apps, apks)
+        update_wiki(apps, apks + archapks)
 
     print "Finished."