diff options
author | James Le Cuirot <chewi@gentoo.org> | 2016-05-07 20:51:47 +0100 |
---|---|---|
committer | James Le Cuirot <chewi@gentoo.org> | 2016-05-08 21:30:39 +0100 |
commit | becf07543e1dcc97fc5c3d099c0d393f77997b32 (patch) | |
tree | 60a54ff0da343ed0201843fea6b92428eb2a771c | |
parent | games-roguelike/angband: version bump (bug #582468) (diff) | |
download | gentoo-becf07543e1dcc97fc5c3d099c0d393f77997b32.tar.gz gentoo-becf07543e1dcc97fc5c3d099c0d393f77997b32.tar.bz2 gentoo-becf07543e1dcc97fc5c3d099c0d393f77997b32.zip |
l10n.eclass: Sort and normalize PLOCALES in l10n_find_plocales_change
l10n_find_plocales_change assumes that PLOCALES is sorted
alphanumerically with a single space between each entry and no
surrounding whitespace. This is not a bad assumption but it isn't
documented and it's inconvenient in at least one particular case.
MakeMKV uses non-standard locale names and I intend to map these using
an associative array, which is possible as of EAPI 6. This allows me
to do the following, though only with the above change as associative
arrays are not ordered.
declare -A MY_LOCALES
MY_LOCALES=( [zh]=chi [da]=dan … )
PLOCALES="${!MY_LOCALES[@]}"
inherit l10n
src_prepare() {
PLOCALES="${MY_LOCALES[@]}" l10n_find_plocales_changes …
}
src_install() {
for locale in $(l10n_get_locales); do
doins makemkv_${MY_LOCALES[${locale}]}.mo.gz
done
}
Fixes bug #513242.
-rw-r--r-- | eclass/l10n.eclass | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass index a7a6a26bb65a..0f29d563b294 100644 --- a/eclass/l10n.eclass +++ b/eclass/l10n.eclass @@ -86,7 +86,9 @@ l10n_find_plocales_changes() { current+="${x} " done popd >/dev/null - if [[ ${PLOCALES} != ${current%[[:space:]]} ]] ; then + # RHS will be sorted with single spaces so ensure the LHS is too + # before attempting to compare them for equality. See bug #513242. + if [[ $(tr -s "[:space:]" "\n" <<< "${PLOCALES}" | sort | xargs echo) != ${current%[[:space:]]} ]] ; then einfo "There are changes in locales! This ebuild should be updated to:" einfo "PLOCALES=\"${current%[[:space:]]}\"" else |