1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-19 21:30:10 +01:00

change VercodeOperation to TYPE_LIST

This commit is contained in:
linsui 2022-10-27 19:11:37 +08:00
parent 747fa13591
commit 618e2c7d72
11 changed files with 18 additions and 22 deletions

View File

@ -59,6 +59,8 @@ metadata_v0:
-e "s/CurrentVersionCode:.'\([0-9]*\)'/CurrentVersionCode:\1/"
-e "s/ versionCode:.'\([0-9]*\)'/ versionCode:\1/"
-e "s/ timeout:.'\([0-9]*\)'/ timeout:\1/"
-e "/VercodeOperation/s/null/[]/"
-e 's/VercodeOperation:.\([^[]\+\)/VercodeOperation:\n- \1/'
metadata/dump_*/*.yaml
- diff -uw metadata/dump_*

View File

@ -456,12 +456,8 @@ def checkupdates_app(app):
raise FDroidException(_('no version information found'))
if app.VercodeOperation:
if isinstance(app.VercodeOperation, str):
vercodes = [operate_vercode(app.VercodeOperation, vercode)]
else:
vercodes = sorted([
operate_vercode(operation, vercode)
for operation in app.VercodeOperation
operate_vercode(operation, vercode) for operation in app.VercodeOperation
])
else:
vercodes = [vercode]

View File

@ -264,13 +264,8 @@ def check_update_check_data_url(app): # noqa: D403
def check_vercode_operation(app):
if not app.VercodeOperation:
return
ops = (
[app.VercodeOperation]
if isinstance(app.VercodeOperation, str)
else app.VercodeOperation
)
invalid_ops = []
for op in ops:
for op in app.VercodeOperation:
if not common.VERCODE_OPERATION_RE.match(op):
invalid_ops += op
if invalid_ops:

View File

@ -153,7 +153,7 @@ class App(dict):
self.AutoUpdateMode = 'None'
self.UpdateCheckMode = 'None'
self.UpdateCheckIgnore = None
self.VercodeOperation = None
self.VercodeOperation = []
self.UpdateCheckName = None
self.UpdateCheckData = None
self.CurrentVersion = ''
@ -204,6 +204,7 @@ fieldtypes = {
'AntiFeatures': TYPE_LIST,
'AllowedAPKSigningKeys': TYPE_LIST,
'Builds': TYPE_BUILD,
'VercodeOperation': TYPE_LIST,
'CurrentVersionCode': TYPE_INT,
}

View File

@ -222,7 +222,7 @@ class LintTest(unittest.TestCase):
anywarns = False
for good in good_fields:
app.VercodeOperation = good
app.VercodeOperation = [good]
for warn in fdroidserver.lint.check_vercode_operation(app):
anywarns = True
logging.debug(warn)
@ -230,7 +230,7 @@ class LintTest(unittest.TestCase):
for bad in bad_fields:
anywarns = False
app.VercodeOperation = bad
app.VercodeOperation = [bad]
for warn in fdroidserver.lint.check_vercode_operation(app):
anywarns = True
logging.debug(warn)

View File

@ -178,7 +178,7 @@ UpdateCheckData: null
UpdateCheckIgnore: null
UpdateCheckMode: Tags
UpdateCheckName: null
VercodeOperation: null
VercodeOperation: []
WebSite: ''
added: null
comments: {}

View File

@ -1084,7 +1084,7 @@ UpdateCheckData: null
UpdateCheckIgnore: null
UpdateCheckMode: Tags
UpdateCheckName: null
VercodeOperation: null
VercodeOperation: []
WebSite: http://sufficientlysecure.org/index.php/adaway
added: null
comments: {}

View File

@ -360,7 +360,7 @@ UpdateCheckData: null
UpdateCheckIgnore: null
UpdateCheckMode: Tags
UpdateCheckName: null
VercodeOperation: null
VercodeOperation: []
WebSite: http://www.smssecure.org
added: null
comments: {}

View File

@ -2442,7 +2442,8 @@ UpdateCheckData: null
UpdateCheckIgnore: null
UpdateCheckMode: Tags
UpdateCheckName: null
VercodeOperation: '%c + 5'
VercodeOperation:
- '%c + 5'
WebSite: http://www.videolan.org/vlc/download-android.html
added: null
comments: {}

View File

@ -804,6 +804,7 @@ ArchivePolicy: 9 versions
AutoUpdateMode: None
UpdateCheckMode: Tags
# Only use higher vercode ops, if we do build those arches
VercodeOperation: "%c + 5"
VercodeOperation:
- "%c + 5"
CurrentVersion: 1.2.6
CurrentVersionCode: 1030005

View File

@ -1447,7 +1447,7 @@ class UpdateTest(unittest.TestCase):
'UpdateCheckIgnore': '',
'UpdateCheckMode': '',
'UpdateCheckName': '',
'VercodeOperation': '',
'VercodeOperation': None,
'WebSite': '',
},
)