From: Hans-Christoph Steiner Date: Thu, 23 Jun 2016 15:11:49 +0000 (+0200) Subject: FDroidPopen must have a locale to support UTF-8 filenames X-Git-Tag: 0.7.0~40^2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=fdroidserver.git;a=commitdiff_plain;h=1be263e8701087f0ac492a2ef9de33c38d4044ee FDroidPopen must have a locale to support UTF-8 filenames `fdroid update` should be able to handle any valid filename (hopefully aapt doesn't barf on them). To handle that, the environment where the shell commands are run in needs to have a UTF-8 locale set. If LANG is not set, things default to ASCII and UTF-8 filenames fail. This also renames test APK with lots of Unicode chars as a test case. closes #167 --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 732d18d2..2c2bb4e0 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1794,7 +1794,8 @@ def set_FDroidPopen_env(build=None): set up the environment variables for the build environment There is only a weak standard, the variables used by gradle, so also set - up the most commonly used environment variables for SDK and NDK + up the most commonly used environment variables for SDK and NDK. Also, if + there is no locale set, this will set the locale (e.g. LANG) to en_US.UTF-8. ''' global env, orig_path @@ -1806,6 +1807,15 @@ def set_FDroidPopen_env(build=None): for k, v in config['java_paths'].items(): env['JAVA%s_HOME' % k] = v + missinglocale = True + for k, v in env.items(): + if k == 'LANG' and v != 'C': + missinglocale = False + elif k == 'LC_ALL': + missinglocale = False + if missinglocale: + env['LANG'] = 'en_US.UTF-8' + if build is not None: path = build.ndk_path() paths = orig_path.split(os.pathsep) diff --git "a/tests/repo/urzip-\317\200\303\207\303\207\317\200\303\207\303\207\347\216\260\344\273\243\346\261\211\350\257\255\351\200\232\347\224\250\345\255\227-\320\261\321\212\320\273\320\263\320\260\321\200\321\201\320\272\320\270-\330\271\330\261\330\250\331\2121234.apk" "b/tests/repo/urzip-\317\200\303\207\303\207\317\200\303\207\303\207\347\216\260\344\273\243\346\261\211\350\257\255\351\200\232\347\224\250\345\255\227-\320\261\321\212\320\273\320\263\320\260\321\200\321\201\320\272\320\270-\330\271\330\261\330\250\331\2121234.apk" new file mode 100644 index 00000000..0851e066 Binary files /dev/null and "b/tests/repo/urzip-\317\200\303\207\303\207\317\200\303\207\303\207\347\216\260\344\273\243\346\261\211\350\257\255\351\200\232\347\224\250\345\255\227-\320\261\321\212\320\273\320\263\320\260\321\200\321\201\320\272\320\270-\330\271\330\261\330\250\331\2121234.apk" differ diff --git a/tests/repo/urzip.apk b/tests/repo/urzip.apk deleted file mode 100644 index ee5e5cba..00000000 Binary files a/tests/repo/urzip.apk and /dev/null differ diff --git a/tests/run-tests b/tests/run-tests index 62d27aa7..c55319da 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -138,6 +138,20 @@ $fdroid readmeta $fdroid update +#------------------------------------------------------------------------------# +echo_header "copy tests/repo, generate a keystore, and update" + +REPOROOT=`create_test_dir` +cd $REPOROOT +$fdroid init +cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $REPOROOT/ +echo "accepted_formats = ['json', 'txt', 'xml', 'yml']" >> config.py +$fdroid update --verbose +test -e repo/index.xml +test -e repo/index.jar +grep -F '