chiark / gitweb /
Add "Update Check Name:Ignore"
authorDaniel Martí <mvdan@mvdan.cc>
Fri, 14 Aug 2015 17:27:16 +0000 (10:27 -0700)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 14 Aug 2015 17:27:16 +0000 (10:27 -0700)
docs/fdroid.texi
fdroidserver/checkupdates.py

index 3c4a2c347ad1c006d531f531d7d2701a097ea933..759656e0c8bbdb7973170d8ec0733022db4272a2 100644 (file)
@@ -1252,6 +1252,10 @@ specify the package name to search for. Useful when apps have a static package
 name but change it programmatically in some app flavors, by e.g. appending
 ".open" or ".free" at the end of the package name.
 
+You can also use @code{Ignore} to ignore package name searching. This should
+only be used in some specific cases, for example if the app's build.gradle
+file does not contain the package name.
+
 @node Update Check Data
 @section Update Check Data
 
index 5d81ee376dc45fc95f8bf198de6e235f694a931c..2a3c45f8cef028d458c59ca52400ad0c4e05d494 100644 (file)
@@ -80,6 +80,15 @@ def check_http(app):
         return (None, msg)
 
 
+def app_matches_packagename(app, package):
+        if not package:
+            return False
+        appid = app['Update Check Name'] or app['id']
+        if appid == "Ignore":
+            return True
+        return appid == package
+
+
 # Check for a new version by looking at the tags in the source repo.
 # Whether this can be used reliably or not depends on
 # the development procedures used by the project's developers. Use it with
@@ -90,7 +99,6 @@ def check_tags(app, pattern):
 
     try:
 
-        appid = app['Update Check Name'] or app['id']
         if app['Repo Type'] == 'srclib':
             build_dir = os.path.join('build', 'srclib', app['Repo'])
             repotype = common.getsrclibvcs(app['Repo'])
@@ -138,7 +146,7 @@ def check_tags(app, pattern):
             paths = common.manifest_paths(build_dir, flavours)
             version, vercode, package = \
                 common.parse_androidmanifests(paths, app['Update Check Ignore'])
-            if not package or package != appid or not version or not vercode:
+            if not app_matches_packagename(app, package) or not version or not vercode:
                 continue
 
             logging.debug("Manifest exists. Found version {0} ({1})"
@@ -173,7 +181,6 @@ def check_repomanifest(app, branch=None):
 
     try:
 
-        appid = app['Update Check Name'] or app['id']
         if app['Repo Type'] == 'srclib':
             build_dir = os.path.join('build', 'srclib', app['Repo'])
             repotype = common.getsrclibvcs(app['Repo'])
@@ -211,9 +218,8 @@ def check_repomanifest(app, branch=None):
             common.parse_androidmanifests(paths, app['Update Check Ignore'])
         if not package:
             return (None, "Couldn't find package ID")
-        if package != appid:
-            return (None, "Package ID mismatch - expected {0}, got {1}"
-                    .format(appid, package))
+        if not app_matches_packagename(app, package):
+            return (None, "Package ID mismatch - got {0}".format(package))
         if not version:
             return (None, "Couldn't find latest version name")
         if not vercode:
@@ -307,7 +313,6 @@ def dirs_with_manifest(startdir):
 # subdir relative to the build dir if found, None otherwise.
 def check_changed_subdir(app):
 
-    appid = app['Update Check Name'] or app['id']
     if app['Repo Type'] == 'srclib':
         build_dir = os.path.join('build', 'srclib', app['Repo'])
     else:
@@ -324,7 +329,7 @@ def check_changed_subdir(app):
         logging.debug("Trying possible dir %s." % d)
         m_paths = common.manifest_paths(d, flavours)
         package = common.parse_androidmanifests(m_paths, app['Update Check Ignore'])[2]
-        if package and package == appid:
+        if app_matches_packagename(app, package):
             logging.debug("Manifest exists in possible dir %s." % d)
             return os.path.relpath(d, build_dir)