From: Daniel Martí Date: Fri, 14 Aug 2015 17:27:16 +0000 (-0700) Subject: Add "Update Check Name:Ignore" X-Git-Tag: 0.5.0~204 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=bb2598d358f6196ff681a804e74e7d0fa52c795d;p=fdroidserver.git Add "Update Check Name:Ignore" --- diff --git a/docs/fdroid.texi b/docs/fdroid.texi index 3c4a2c34..759656e0 100644 --- a/docs/fdroid.texi +++ b/docs/fdroid.texi @@ -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 diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 5d81ee37..2a3c45f8 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -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)