chiark / gitweb /
update: fix fastlane scraping, it uses a subdir called 'images'
authorHans-Christoph Steiner <hans@eds.org>
Tue, 16 May 2017 10:25:42 +0000 (12:25 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Thu, 18 May 2017 14:13:17 +0000 (16:13 +0200)
https://commons.wikimedia.org/wiki/File:GetChromium_FeatureGraphic_1024x500.png

.gitignore
fdroidserver/update.py
tests/metadata/info.guardianproject.urzip/en-US/images/featureGraphic.png [new file with mode: 0644]
tests/metadata/info.guardianproject.urzip/en-US/images/icon.png [new file with mode: 0644]
tests/update.TestCase

index 69c27f93d0b111c6832a3599426df8399f59b09c..0ad4ccc7afdfd72804b5ae101c9edeaa43710c12 100644 (file)
@@ -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/
index 4d9777b835fda63f32c91c2abf27ccd470d3190e..2c590ac9766ddd98d5b334e7747b590e5dcedc92 100644 (file)
@@ -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 (file)
index 0000000..cb6720c
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 (file)
index 0000000..21439b7
Binary files /dev/null and b/tests/metadata/info.guardianproject.urzip/en-US/images/icon.png differ
index 4e204ae6b127fc26ace8b1965183a663260e62df..be1a7266e205bc54d75a742130cf16f891348010 100755 (executable)
@@ -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'):