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

update: fix fastlane scraping, it uses a subdir called 'images'

https://commons.wikimedia.org/wiki/File:GetChromium_FeatureGraphic_1024x500.png
This commit is contained in:
Hans-Christoph Steiner 2017-05-16 12:25:42 +02:00
parent 77a65be9db
commit c348186ad6
5 changed files with 19 additions and 6 deletions

1
.gitignore vendored
View File

@ -39,5 +39,6 @@ makebuildserver.config.py
/tests/archive/index-v1.jar /tests/archive/index-v1.jar
/tests/repo/index.jar /tests/repo/index.jar
/tests/repo/index-v1.jar /tests/repo/index-v1.jar
/tests/repo/info.guardianproject.urzip/
/tests/urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234.apk /tests/urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234.apk
/unsigned/ /unsigned/

View File

@ -676,14 +676,14 @@ def insert_localized_app_metadata(apps):
must be PNG or JPEG files ending with ".png", ".jpg", or ".jpeg" must be PNG or JPEG files ending with ".png", ".jpg", or ".jpeg"
and must be in the following layout: and must be in the following layout:
# TODO replace these docs with link to All_About_Descriptions_Graphics_and_Screenshots # 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/featureGraphic.png
repo/packageName/locale/phoneScreenshots/1.png repo/packageName/locale/phoneScreenshots/1.png
repo/packageName/locale/phoneScreenshots/2.png repo/packageName/locale/phoneScreenshots/2.png
The changelog files must be text files named with the versionCode The changelog files must be text files named with the versionCode
ending with ".txt" and must be in the following layout: 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 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 metadata/ folder and the apps' source repos for standard locations
of graphic and screenshot files. If it finds them, it will copy of graphic and screenshot files. If it finds them, it will copy
them into the repo. The fastlane files follow this pattern: 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.') logging.debug(packageName + ' does not have app metadata, skipping l18n scan.')
continue continue
locale = segments[-1] locale = segments[-1]
destdir = os.path.join('repo', packageName, locale)
for f in files: for f in files:
if f == 'full_description.txt': if f == 'full_description.txt':
_set_localized_text_entry(apps[packageName], locale, 'description', _set_localized_text_entry(apps[packageName], locale, 'description',
@ -737,11 +736,15 @@ def insert_localized_app_metadata(apps):
os.path.join(root, f)) os.path.join(root, f))
continue continue
elif f == str(apps[packageName]['CurrentVersionCode']) + '.txt': 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)) os.path.join(root, f))
continue continue
base, extension = common.get_extension(f) 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: if base in GRAPHIC_NAMES and extension in ALLOWED_EXTENSIONS:
os.makedirs(destdir, mode=0o755, exist_ok=True) os.makedirs(destdir, mode=0o755, exist_ok=True)
logging.debug('copying ' + os.path.join(root, f) + ' ' + destdir) logging.debug('copying ' + os.path.join(root, f) + ' ' + destdir)

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -37,6 +37,8 @@ class UpdateTest(unittest.TestCase):
fdroidserver.update.options = fdroidserver.common.options fdroidserver.update.options = fdroidserver.common.options
os.chdir(os.path.join(localmodule, 'tests')) os.chdir(os.path.join(localmodule, 'tests'))
shutil.rmtree(os.path.join('repo', 'info.guardianproject.urzip'), ignore_errors=True)
apps = dict() apps = dict()
for packageName in ('info.guardianproject.urzip', 'org.videolan.vlc', 'obb.mainpatch.current'): for packageName in ('info.guardianproject.urzip', 'org.videolan.vlc', 'obb.mainpatch.current'):
apps[packageName] = dict() apps[packageName] = dict()
@ -45,17 +47,23 @@ class UpdateTest(unittest.TestCase):
apps['info.guardianproject.urzip']['CurrentVersionCode'] = 100 apps['info.guardianproject.urzip']['CurrentVersionCode'] = 100
fdroidserver.update.insert_localized_app_metadata(apps) 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)) self.assertEqual(3, len(apps))
for packageName, app in apps.items(): for packageName, app in apps.items():
self.assertTrue('localized' in app) self.assertTrue('localized' in app)
self.assertTrue('en-US' in app['localized']) self.assertTrue('en-US' in app['localized'])
self.assertEqual(1, len(app['localized'])) self.assertEqual(1, len(app['localized']))
if packageName == 'info.guardianproject.urzip': 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('full description\n', app['localized']['en-US']['description'])
self.assertEqual('title\n', app['localized']['en-US']['name']) self.assertEqual('title\n', app['localized']['en-US']['name'])
self.assertEqual('short description\n', app['localized']['en-US']['summary']) self.assertEqual('short description\n', app['localized']['en-US']['summary'])
self.assertEqual('video\n', app['localized']['en-US']['video']) 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']) self.assertEqual('100\n', app['localized']['en-US']['whatsNew'])
elif packageName == 'org.videolan.vlc': elif packageName == 'org.videolan.vlc':
self.assertEqual('icon.png', app['localized']['en-US']['icon']) self.assertEqual('icon.png', app['localized']['en-US']['icon'])
@ -244,6 +252,7 @@ class UpdateTest(unittest.TestCase):
fdroidserver.update.options = type('', (), {})() fdroidserver.update.options = type('', (), {})()
fdroidserver.update.options.clean = True fdroidserver.update.options.clean = True
fdroidserver.update.options.rename_apks = False
fdroidserver.update.options.delete_unknown = True fdroidserver.update.options.delete_unknown = True
for icon_dir in fdroidserver.update.get_all_icon_dirs('repo'): for icon_dir in fdroidserver.update.get_all_icon_dirs('repo'):