chiark / gitweb /
Fetch CV @string values at checkupdates
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 15 Aug 2013 10:15:44 +0000 (12:15 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 15 Aug 2013 10:15:44 +0000 (12:15 +0200)
fdroidserver/checkupdates.py
fdroidserver/common.py

index 8b9d0dcc918bcc138090df19bd284d5632523d09..452a83db3e065440c6067cf15af3e7f5225e6c61 100644 (file)
@@ -300,7 +300,7 @@ def main():
                 writeit = True
                 logmsg = "Update current version of " + app['id'] + " to " + version
 
-            # Do the Auto Name thing...
+            # Do the Auto Name thing as well as finding the CV real name
             if len(app["Repo Type"]) > 0:
 
                 try:
@@ -325,8 +325,13 @@ def main():
                         app['Auto Name'] = new_name
                         writeit = True
 
+                    if app['Current Version'].startswith('@string/'):
+                        cv = common.version_name(app['Current Version'], app_dir, flavour)
+                        if app['Current Version'] != cv:
+                            app['Current Version'] = cv
+                            writeit = True
                 except Exception:
-                    msg = "Auto Name failed for  %s due to exception: %s" % (app['id'], traceback.format_exc())
+                    msg = "Auto Name or Current Version failed for %s due to exception: %s" % (app['id'], traceback.format_exc())
 
             if options.auto:
                 mode = app['Auto Update Mode']
index 123d50eacab5913b93a258662cc10bc4dc8b5d6d..3ff0a7aac953e0b5d02eaad0e6c3182dbf8a67d2 100644 (file)
@@ -902,9 +902,19 @@ def fetch_real_name(app_dir, flavour):
                 matches = name_search(line)
                 if matches:
                     return retrieve_string(xml_dir, matches.group(1))
-
     return ''
 
+# Retrieve the version name
+def version_name(original, app_dir, flavour):
+    for f in manifest_paths(app_dir, flavour):
+        if not f.endswith(".xml"):
+            continue
+        xml_dir = os.path.join(f[:-19], 'res', 'values')
+        string = retrieve_string(xml_dir, original)
+        if len(string) > 0:
+            return string
+    return original
+
 # Extract some information from the AndroidManifest.xml at the given path.
 # Returns (version, vercode, package), any or all of which might be None.
 # All values returned are strings.