mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
eliminate app.builds everywhere, it should be app['Builds']
The .txt format was the last place where the lowercase "builds" was used,
this converts references everywhere to be "Builds". This makes it possible
to load metadata YAML files with any YAML parser, then have it possible to
use fdroidserver methods on that data, like metadata.write_metadata().
The test files in tests/metadata/dump/*.yaml were manually edited by cutting
the builds: block and putting it the sort order for Builds: so the contents
should be unchanged.
```
sed -i \
-e 's/app\.builds/app.get('Builds', \[\])/g' \
-e "s/app\.get(Builds, \[\]) =/app\['Builds'] =/g" \
-e "s/app\.get(Builds, \[\]) =/app\['Builds'] =/g" \
-e "s/app\.get(Builds, \[\])/app.get('Builds', \[\])/g" \
-e "s/app\.get('Builds', \[\])\.append/app\['Builds'\].append/g" \
-e "s/app\['builds'\]/app.get('Builds', [])/g" \
*/*.*
```
This commit is contained in:
parent
877779195f
commit
bf25b4ca03
18 changed files with 275 additions and 279 deletions
|
|
@ -157,9 +157,8 @@ def status_update_json(apps, apks):
|
|||
for apk in apks:
|
||||
if apk['packageName'] == appid:
|
||||
apklist.append(apk)
|
||||
builds = app.get('builds', [])
|
||||
validapks = 0
|
||||
for build in builds:
|
||||
for build in app.get('Builds', []):
|
||||
if not build.get('disable'):
|
||||
builtit = False
|
||||
for apk in apklist:
|
||||
|
|
@ -252,7 +251,7 @@ def update_wiki(apps, apks):
|
|||
gotcurrentver = True
|
||||
apklist.append(apk)
|
||||
# Include ones we can't build, as a special case...
|
||||
for build in app.builds:
|
||||
for build in app.get('Builds', []):
|
||||
if build.disable:
|
||||
if build.versionCode == app.CurrentVersionCode:
|
||||
cantupdate = True
|
||||
|
|
@ -411,7 +410,7 @@ def delete_disabled_builds(apps, apkcache, repodirs):
|
|||
:param repodirs: the repo directories to process
|
||||
"""
|
||||
for appid, app in apps.items():
|
||||
for build in app['builds']:
|
||||
for build in app.get('Builds', []):
|
||||
if not build.disable:
|
||||
continue
|
||||
apkfilename = common.get_release_filename(app, build)
|
||||
|
|
@ -742,7 +741,7 @@ def translate_per_build_anti_features(apps, apks):
|
|||
antiFeatures = dict()
|
||||
for packageName, app in apps.items():
|
||||
d = dict()
|
||||
for build in app['builds']:
|
||||
for build in app.get('Builds', []):
|
||||
afl = build.get('antifeatures')
|
||||
if afl:
|
||||
d[int(build.versionCode)] = afl
|
||||
|
|
@ -1022,8 +1021,8 @@ def copy_triple_t_store_metadata(apps):
|
|||
if os.path.exists(p):
|
||||
gradle_subdirs.add(p)
|
||||
flavors = set()
|
||||
if app.builds:
|
||||
flavors = app.builds[0].gradle
|
||||
if app.get('Builds'):
|
||||
flavors = app['Builds'][0].gradle
|
||||
for flavor in flavors:
|
||||
if flavor not in ('yes', 'no'):
|
||||
p = os.path.join('build', packageName, gradle_path, 'src', flavor, 'play')
|
||||
|
|
@ -1148,9 +1147,12 @@ def insert_localized_app_metadata(apps):
|
|||
|
||||
# flavours specified in build receipt
|
||||
build_flavours = ""
|
||||
if apps[packageName] and 'builds' in apps[packageName] and len(apps[packageName].builds) > 0\
|
||||
and 'gradle' in apps[packageName].builds[-1]:
|
||||
build_flavours = apps[packageName].builds[-1].gradle
|
||||
if (
|
||||
apps[packageName]
|
||||
and len(apps[packageName].get('Builds', [])) > 0
|
||||
and 'gradle' in apps[packageName]['Builds'][-1]
|
||||
):
|
||||
build_flavours = apps[packageName]['Builds'][-1]['gradle']
|
||||
|
||||
if len(segments) >= 5 and segments[4] == "fastlane" and segments[3] not in build_flavours:
|
||||
logging.debug("ignoring due to wrong flavour")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue