mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
tests/core: Assume C.UTF-8 if locale isn't found
When building with musl there's no locale command, also its default locale is C.UTF-8, so just get C.UTF-8 if we can't find locale. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
This commit is contained in:
parent
fb519f0361
commit
3d48021fb0
@ -37,9 +37,15 @@ assert_not_reached () {
|
||||
# Some tests look for specific English strings. Use a UTF-8 version
|
||||
# of the C (POSIX) locale if we have one, or fall back to en_US.UTF-8
|
||||
# (https://sourceware.org/glibc/wiki/Proposals/C.UTF-8)
|
||||
export LC_ALL=$(locale -a | grep -Ee '\.(UTF-8|utf8)' | grep -iEe '^(C|en_US)' | head -1 || true)
|
||||
if [ -z "${LC_ALL}" ]; then fatal "Can't find suitable UTF-8 locale"; fi
|
||||
|
||||
#
|
||||
# If we can't find the locale command assume we have support for C.UTF-8
|
||||
# (e.g. musl based systems)
|
||||
if type -p locale >/dev/null; then
|
||||
export LC_ALL=$(locale -a | grep -Ee '\.(UTF-8|utf8)' | grep -iEe '^(C|en_US)' | head -1 || true)
|
||||
if [ -z "${LC_ALL}" ]; then fatal "Can't find suitable UTF-8 locale"; fi
|
||||
else
|
||||
export LC_ALL=C.UTF-8
|
||||
fi
|
||||
# A GNU extension, used whenever LC_ALL is not C
|
||||
unset LANGUAGE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user