chiark / gitweb /
update: do not crash on screenshots without texts/graphics
authorHans-Christoph Steiner <hans@eds.org>
Mon, 12 Jun 2017 14:15:07 +0000 (16:15 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Mon, 12 Jun 2017 19:25:54 +0000 (21:25 +0200)
`fdroid update` crashed for apps that only had screenshots but no graphics
or localized texts because destdir was not being set in that case.  This
fixes that and adds a test case.

closes #320
!286

fdroidserver/update.py
tests/metadata/info.guardianproject.checkey/en-US/phoneScreenshots/checkey-phone.png [new file with mode: 0644]
tests/metadata/info.guardianproject.checkey/en-US/phoneScreenshots/checkey.png [new file with mode: 0644]

index f50ecda53ffa10aed31bb21fed2d07c518da82c2..b7119ab7b66f5b19df93fbf4fe689f812706e03a 100644 (file)
@@ -716,6 +716,7 @@ 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 in ('description.txt', 'full_description.txt'):
                     _set_localized_text_entry(apps[packageName], locale, 'description',
@@ -742,7 +743,7 @@ def insert_localized_app_metadata(apps):
                 base, extension = common.get_extension(f)
                 if locale == 'images':
                     locale = segments[-2]
-                destdir = os.path.join('repo', packageName, locale)
+                    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.checkey/en-US/phoneScreenshots/checkey-phone.png b/tests/metadata/info.guardianproject.checkey/en-US/phoneScreenshots/checkey-phone.png
new file mode 100644 (file)
index 0000000..d086064
Binary files /dev/null and b/tests/metadata/info.guardianproject.checkey/en-US/phoneScreenshots/checkey-phone.png differ
diff --git a/tests/metadata/info.guardianproject.checkey/en-US/phoneScreenshots/checkey.png b/tests/metadata/info.guardianproject.checkey/en-US/phoneScreenshots/checkey.png
new file mode 100644 (file)
index 0000000..b28dca7
Binary files /dev/null and b/tests/metadata/info.guardianproject.checkey/en-US/phoneScreenshots/checkey.png differ