diff --git a/.gitignore b/.gitignore index 69c27f93..0ad4ccc7 100644 --- a/.gitignore +++ b/.gitignore @@ -39,5 +39,6 @@ makebuildserver.config.py /tests/archive/index-v1.jar /tests/repo/index.jar /tests/repo/index-v1.jar +/tests/repo/info.guardianproject.urzip/ /tests/urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234.apk /unsigned/ diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 4d9777b8..2c590ac9 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -676,14 +676,14 @@ def insert_localized_app_metadata(apps): must be PNG or JPEG files ending with ".png", ".jpg", or ".jpeg" and must be in the following layout: # TODO replace these docs with link to All_About_Descriptions_Graphics_and_Screenshots - # TODO mention that the 'localized' section is not in metadata.yml, so key names are like Java vars: camelCase with first letter lowercase. + repo/packageName/locale/featureGraphic.png repo/packageName/locale/phoneScreenshots/1.png repo/packageName/locale/phoneScreenshots/2.png The changelog files must be text files named with the versionCode ending with ".txt" and must be in the following layout: - https://github.com/fastlane/fastlane/blob/1.109.0/supply/README.md#changelogs-whats-new + https://github.com/fastlane/fastlane/blob/2.28.7/supply/README.md#changelogs-whats-new repo/packageName/locale/changelogs/12345.txt @@ -701,7 +701,7 @@ def insert_localized_app_metadata(apps): metadata/ folder and the apps' source repos for standard locations of graphic and screenshot files. If it finds them, it will copy them into the repo. The fastlane files follow this pattern: - https://github.com/fastlane/fastlane/blob/1.109.0/supply/README.md#images-and-screenshots + https://github.com/fastlane/fastlane/blob/2.28.7/supply/README.md#images-and-screenshots """ @@ -718,7 +718,6 @@ def insert_localized_app_metadata(apps): logging.debug(packageName + ' does not have app metadata, skipping l18n scan.') continue locale = segments[-1] - destdir = os.path.join('repo', packageName, locale) for f in files: if f == 'full_description.txt': _set_localized_text_entry(apps[packageName], locale, 'description', @@ -737,11 +736,15 @@ def insert_localized_app_metadata(apps): os.path.join(root, f)) continue elif f == str(apps[packageName]['CurrentVersionCode']) + '.txt': - _set_localized_text_entry(apps[packageName], segments[-2], 'whatsNew', + locale = segments[-2] + _set_localized_text_entry(apps[packageName], locale, 'whatsNew', os.path.join(root, f)) continue base, extension = common.get_extension(f) + if locale == 'images': + locale = segments[-2] + destdir = os.path.join('repo', packageName, locale) if base in GRAPHIC_NAMES and extension in ALLOWED_EXTENSIONS: os.makedirs(destdir, mode=0o755, exist_ok=True) logging.debug('copying ' + os.path.join(root, f) + ' ' + destdir) diff --git a/tests/metadata/info.guardianproject.urzip/en-US/images/featureGraphic.png b/tests/metadata/info.guardianproject.urzip/en-US/images/featureGraphic.png new file mode 100644 index 00000000..cb6720cb Binary files /dev/null and b/tests/metadata/info.guardianproject.urzip/en-US/images/featureGraphic.png differ diff --git a/tests/metadata/info.guardianproject.urzip/en-US/images/icon.png b/tests/metadata/info.guardianproject.urzip/en-US/images/icon.png new file mode 100644 index 00000000..21439b7b Binary files /dev/null and b/tests/metadata/info.guardianproject.urzip/en-US/images/icon.png differ diff --git a/tests/update.TestCase b/tests/update.TestCase index 4e204ae6..be1a7266 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -37,6 +37,8 @@ class UpdateTest(unittest.TestCase): fdroidserver.update.options = fdroidserver.common.options os.chdir(os.path.join(localmodule, 'tests')) + shutil.rmtree(os.path.join('repo', 'info.guardianproject.urzip'), ignore_errors=True) + apps = dict() for packageName in ('info.guardianproject.urzip', 'org.videolan.vlc', 'obb.mainpatch.current'): apps[packageName] = dict() @@ -45,17 +47,23 @@ class UpdateTest(unittest.TestCase): apps['info.guardianproject.urzip']['CurrentVersionCode'] = 100 fdroidserver.update.insert_localized_app_metadata(apps) + appdir = os.path.join('repo', 'info.guardianproject.urzip', 'en-US') + self.assertTrue(os.path.isfile(os.path.join(appdir, 'icon.png'))) + self.assertTrue(os.path.isfile(os.path.join(appdir, 'featureGraphic.png'))) + self.assertEqual(3, len(apps)) for packageName, app in apps.items(): self.assertTrue('localized' in app) self.assertTrue('en-US' in app['localized']) self.assertEqual(1, len(app['localized'])) if packageName == 'info.guardianproject.urzip': - self.assertEqual(5, len(app['localized']['en-US'])) + self.assertEqual(7, len(app['localized']['en-US'])) self.assertEqual('full description\n', app['localized']['en-US']['description']) self.assertEqual('title\n', app['localized']['en-US']['name']) self.assertEqual('short description\n', app['localized']['en-US']['summary']) self.assertEqual('video\n', app['localized']['en-US']['video']) + self.assertEqual('icon.png', app['localized']['en-US']['icon']) + self.assertEqual('featureGraphic.png', app['localized']['en-US']['featureGraphic']) self.assertEqual('100\n', app['localized']['en-US']['whatsNew']) elif packageName == 'org.videolan.vlc': self.assertEqual('icon.png', app['localized']['en-US']['icon']) @@ -244,6 +252,7 @@ class UpdateTest(unittest.TestCase): fdroidserver.update.options = type('', (), {})() fdroidserver.update.options.clean = True + fdroidserver.update.options.rename_apks = False fdroidserver.update.options.delete_unknown = True for icon_dir in fdroidserver.update.get_all_icon_dirs('repo'):