From 180a6c93af018eb290fecb2dcda5a8d55d72e59b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 7 May 2019 10:30:21 +0200 Subject: [PATCH] gitlab-ci: check that localized metadata is properly named --- .gitlab-ci.yml | 1 + tools/check-localized-metadata.py | 37 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 tools/check-localized-metadata.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 57100160d8..77a803cee8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/tools/check-localized-metadata.py b/tools/check-localized-metadata.py new file mode 100755 index 0000000000..e64d767cdf --- /dev/null +++ b/tools/check-localized-metadata.py @@ -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)