summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-05-16 14:19:09 -0400
committerMike Frysinger <vapier@gentoo.org>2016-05-16 14:20:08 -0400
commit7addc4523c8cfaecf24a944ef2c1a2ebdaa423c3 (patch)
tree07701c432d896d8b6330ad6b4667e7c055e19d95 /eclass
parent622b17e89a75cf8dfe469f9cd198e27966e9a1f3 (diff)
downloadgentoo-7addc4523c8cfaecf24a944ef2c1a2ebdaa423c3.tar.gz
gentoo-7addc4523c8cfaecf24a944ef2c1a2ebdaa423c3.tar.xz
l10n.eclass: l10n_find_plocales_changes: make it more friendly
- Use ebegin/eend to show process messages instead of two einfos. - Fix sorting logic to work in all locales. - Return 1 when things are out of sync so callers can abort if they want.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/l10n.eclass13
1 files changed, 8 insertions, 5 deletions
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
index 383fa6154cc..74c7a805327 100644
--- a/eclass/l10n.eclass
+++ b/eclass/l10n.eclass
@@ -77,7 +77,7 @@ l10n_for_each_disabled_locale_do() {
# Example: l10n_find_plocales_changes "${S}/src/translations" "${PN}_" '.ts'
l10n_find_plocales_changes() {
[[ $# -ne 3 ]] && die "Exactly 3 arguments are needed!"
- einfo "Looking in ${1} for new locales ..."
+ ebegin "Looking in ${1} for new locales"
pushd "${1}" >/dev/null || die "Cannot access ${1}"
local current= x=
for x in ${2}*${3} ; do
@@ -88,11 +88,14 @@ l10n_find_plocales_changes() {
popd >/dev/null
# 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:]]}\""
+ # Run them both through the same sorting algorithm so we don't have
+ # to worry about them being the same.
+ if [[ "$(printf '%s\n' ${PLOCALES} | LC_ALL=C sort)" != "$(printf '%s\n' ${current} | LC_ALL=C sort)" ]] ; then
+ eend 1 "There are changes in locales! This ebuild should be updated to:"
+ eerror "PLOCALES=\"${current%[[:space:]]}\""
+ return 1
else
- einfo "Done"
+ eend 0
fi
}