diff options
author | Robert Griebl <robert.griebl@qt.io> | 2022-04-25 19:43:15 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-04-27 09:20:50 +0000 |
commit | 61d9365a54bf8534bd0e0b4569f545cda16fd253 (patch) | |
tree | d7986c264e328090c8a4fc32939e45f392a7ba9e | |
parent | d4c9759a23f0c19b2145b14aba6e25535be7ef1c (diff) | |
download | qtapplicationmanager-61d9365a54bf8534bd0e0b4569f545cda16fd253.tar.gz |
Don't rely on the system environment to be UTF-8 when building packages
Instead, set a well-known UTF-8 locale ourselves.
Change-Id: I67e4eaa9dbadf690924b091f93cf1d61425ea451
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
(cherry picked from commit 5f053ea7f609a269457ff1cd75aeb924a8a0d60f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rwxr-xr-x | tests/data/create-test-packages.sh | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/tests/data/create-test-packages.sh b/tests/data/create-test-packages.sh index a832d78f..7e69abab 100755 --- a/tests/data/create-test-packages.sh +++ b/tests/data/create-test-packages.sh @@ -40,27 +40,13 @@ isMac=0 # check basic requirement [ ! -d certificates ] && { echo "Please cd to the tests/data directory before running this script"; exit 1; } -# having $LC_ALL set to "C" will screw us big time - especially since QtCreator sets this -# unconditionally in the build environment, overriding a potentially valid $LANG setting. -[ "$LC_ALL" = "C" ] && { echo "WARNING: unsetting \$LC_ALL, since it is set to \"C\" (most likely by a wrapper script or QtCreator)"; unset LC_ALL; } - -# let the c-library resolve all the indirect settings -if ! command -v locale &> /dev/null; then - xLC_CTYPE="${LC_CTYPE:-${LC_ALL:-${LANG}}}" # no locale command available +# set a well-known UTF-8 locale: C.UTF-8 is the obvious choice, but macOS doesn't support it +if [ "$isMac" = "1" ]; then + export LC_ALL=en_US.UTF-8 else - eval "x$(locale | grep LC_CTYPE= | head -n1)" + export LC_ALL=C.UTF-8 fi -# now check for character encoding -case "${xLC_CTYPE}" in -*.UTF8|*.utf8|*.UTF-8) - ;; -*) - echo "The appman-packager needs to be run within an UTF-8 locale variant" - exit 1 - ;; -esac - . utilities.sh usage() |