[checkupdates] UpdateCheckData use tag by default

Use the tag as version, if no version file was specified:

UpdateCheckData: app/build.gradle|versionCode\s(\d+)||

Extract version from tag, if a regex was specified:

UpdateCheckData: app/build.gradle|versionCode\s(\d+)||Android-([\d.]+)

Use the tag for both if no file was specified:

UpdateCheckData: |\+(\d+)||Android-([\d.]+)
This commit is contained in:
Jochen Sprickerhof 2021-06-09 10:08:33 +02:00
parent b7a4883c09
commit bdec7d8652
2 changed files with 71 additions and 21 deletions

View file

@ -161,19 +161,22 @@ def check_tags(app, pattern):
if app.UpdateCheckData:
filecode, codeex, filever, verex = app.UpdateCheckData.split('|')
vercode = None
filecode = build_dir / filecode
if not filecode.is_file():
logging.debug("UpdateCheckData file {0} not found in tag {1}".format(filecode, tag))
continue
filecontent = filecode.read_text()
if filecode:
filecode = build_dir / filecode
if not filecode.is_file():
logging.debug("UpdateCheckData file {0} not found in tag {1}".format(filecode, tag))
continue
filecontent = filecode.read_text()
else:
filecontent = tag
m = re.search(codeex, filecontent)
if m:
vercode = m.group(1).strip()
if not m:
continue
vercode = m.group(1).strip()
version = "??"
if filever:
if filever != '.':
filever = build_dir / filever
@ -181,19 +184,22 @@ def check_tags(app, pattern):
filecontent = filever.read_text()
else:
logging.debug("UpdateCheckData file {0} not found in tag {1}".format(filever, tag))
else:
filecontent = tag
version = tag
if verex:
m = re.search(verex, filecontent)
if m:
version = m.group(1)
if vercode:
logging.debug("UpdateCheckData found version {0} ({1})"
.format(version, vercode))
i_vercode = common.version_code_string_to_int(vercode)
if i_vercode > common.version_code_string_to_int(hcode):
htag = tag
hcode = str(i_vercode)
hver = version
logging.debug("UpdateCheckData found version {0} ({1})"
.format(version, vercode))
i_vercode = common.version_code_string_to_int(vercode)
if i_vercode > common.version_code_string_to_int(hcode):
htag = tag
hcode = str(i_vercode)
hver = version
else:
for subdir in possible_subdirs(app):
root_dir = build_dir / subdir