gitlab-ci: check that localized metadata is properly named

This commit is contained in:
Hans-Christoph Steiner 2019-05-07 10:30:21 +02:00
parent 01fc251255
commit 180a6c93af
No known key found for this signature in database
GPG Key ID: 3E177817BA1B9BFA
2 changed files with 38 additions and 0 deletions

View File

@ -36,6 +36,7 @@ lint:
- echo "these images have EXIF that must be stripped:"
- git --no-pager diff --stat
- git --no-pager diff --name-only --exit-code || export EXITVALUE=1
- ./tools/check-localized-metadata.py || export EXITVALUE=1
- ./tools/check-keyalias-collision.py || export EXITVALUE=1
- exit $EXITVALUE

View File

@ -0,0 +1,37 @@
#!/usr/bin/env python3
import glob
import os
import re
import sys
os.chdir(os.path.dirname(__file__) + '/../')
count = 0
locales = dict()
for f in sorted(glob.glob('metadata/*/*/*.txt')):
name, _ = os.path.splitext(os.path.basename(f))
if name == 'full_description':
print(f, 'should use fdroid name', re.sub('full_description', 'description', f))
count += 1
elif name == 'short_description':
print(f, 'should use fdroid name', re.sub('short_description', 'summary', f))
count += 1
elif name == 'title':
print(f, 'should use fdroid name', re.sub('title', 'name', f))
count += 1
elif name not in ('summary', 'description', 'name'):
print(f, 'has invalid filename', name)
packageName, locale = f.split('/')[1:3]
if packageName not in locales:
locales[packageName] = []
locales[packageName].append(locale)
for k, v in locales.items():
if 'en-US' not in v:
print(k, 'is missing source locale en-US!')
count += 1
sys.exit(count)