1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-17 10:40:12 +02:00

Add ability to ignore updates based on version name matching

This commit is contained in:
Ciaran Gultnieks 2014-05-13 20:04:22 +01:00
parent 751daf0cda
commit 0113f85448
3 changed files with 18 additions and 6 deletions

View File

@ -134,7 +134,8 @@ def check_tags(app, pattern):
# Only process tags where the manifest exists... # Only process tags where the manifest exists...
paths = common.manifest_paths(build_dir, flavour) paths = common.manifest_paths(build_dir, flavour)
version, vercode, package = common.parse_androidmanifests(paths) 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 package or package != appid or not version or not vercode:
continue continue
@ -209,7 +210,8 @@ def check_repomanifest(app, branch=None):
paths = common.manifest_paths(build_dir, flavour) paths = common.manifest_paths(build_dir, flavour)
version, vercode, package = common.parse_androidmanifests(paths) version, vercode, package = common.parse_androidmanifests(paths,
app['Update Check Ignore'])
if not package: if not package:
return (None, "Couldn't find package ID") return (None, "Couldn't find package ID")
if package != appid: if package != appid:
@ -217,6 +219,8 @@ def check_repomanifest(app, branch=None):
if not version: if not version:
return (None, "Couldn't find latest version name") return (None, "Couldn't find latest version name")
if not vercode: if not vercode:
if "Ignore" == version:
return (None, "Latest version is ignored")
return (None, "Couldn't find latest version code") return (None, "Couldn't find latest version code")
vercode = str(int(vercode)) vercode = str(int(vercode))

View File

@ -823,7 +823,7 @@ def remove_debuggable_flags(root_dir):
# Extract some information from the AndroidManifest.xml at the given path. # Extract some information from the AndroidManifest.xml at the given path.
# Returns (version, vercode, package), any or all of which might be None. # Returns (version, vercode, package), any or all of which might be None.
# All values returned are strings. # All values returned are strings.
def parse_androidmanifests(paths): def parse_androidmanifests(paths, ignoreversions=None):
if not paths: if not paths:
return (None, None, None) return (None, None, None)
@ -836,6 +836,8 @@ def parse_androidmanifests(paths):
vnsearch_g = re.compile(r'.*versionName *=* *(["\'])((?:(?=(\\?))\3.)*?)\1.*').search vnsearch_g = re.compile(r'.*versionName *=* *(["\'])((?:(?=(\\?))\3.)*?)\1.*').search
psearch_g = re.compile(r'.*packageName *=* *["\']([^"]+)["\'].*').search psearch_g = re.compile(r'.*packageName *=* *["\']([^"]+)["\'].*').search
ignoresearch = re.compile(ignoreversions).search if ignoreversions else None
max_version = None max_version = None
max_vercode = None max_vercode = None
max_package = None max_package = None
@ -876,9 +878,12 @@ def parse_androidmanifests(paths):
max_package = package max_package = package
if max_vercode is None or (vercode is not None and vercode > max_vercode): if max_vercode is None or (vercode is not None and vercode > max_vercode):
max_version = version if not ignoresearch or not ignoresearch(version):
max_vercode = vercode max_version = version
max_package = package max_vercode = vercode
max_package = package
else:
max_version = "Ignore"
if max_version is None: if max_version is None:
max_version = "Unknown" max_version = "Unknown"

View File

@ -51,6 +51,7 @@ app_defaults = {
'AntiFeatures': None, 'AntiFeatures': None,
'Archive Policy': None, 'Archive Policy': None,
'Update Check Mode': 'None', 'Update Check Mode': 'None',
'Update Check Ignore': None,
'Update Check Name': None, 'Update Check Name': None,
'Update Check Data': None, 'Update Check Data': None,
'Vercode Operation': None, 'Vercode Operation': None,
@ -808,6 +809,8 @@ def write_metadata(dest, app):
writefield('Archive Policy') writefield('Archive Policy')
writefield('Auto Update Mode') writefield('Auto Update Mode')
writefield('Update Check Mode') writefield('Update Check Mode')
if app['Update Check Ignore']:
writefield('Update Check Ignore')
if app['Vercode Operation']: if app['Vercode Operation']:
writefield('Vercode Operation') writefield('Vercode Operation')
if app['Update Check Data']: if app['Update Check Data']: