On Sun, 8 May 2016 11:20:34 -0400 Michael Orlitzky <m...@gentoo.org> wrote:
> On 05/07/2016 04:13 PM, James Le Cuirot wrote: > > > > + if [[ $(tr -s "[:space:]" "\n" <<< "${PLOCALES}" | sort | > > xargs echo) != ${current%[[:space:]]} ]] ; then > > The stuff on the left-hand side just sorts a space-separated list, > right? It might be time to split that into another function. It looks > a lot less insane when it's, > > if [[ $(l10n_sort_spaces "${PLOCALES}") != ${current%[[:space:]]} ]] > > Then the function would just be > > # @FUNCTION: l10n_sort_spaces > # @DESCRIPTION: > # Takes a space-separated list of strings as an argument and sorts > # them. The output is again space-separated. This is accomplished > # by first replacing the spaces with newlines so that "sort" can > # be used, and then collecting the output back onto one line. > function l10n_sort_spaces() { > tr -s "[:space:]" "\n" <<< "${1}" | sort | xargs echo > } > > You should also document why you're doing that nearby, since like you > said, the eclass assumes that PLOCALES is sorted. Someone will wonder > why you're doing it again. I feel an extra function for something we're only doing once is a bit redundant. I was happy to add a short explanation though so I did that. Merged it now. -- James Le Cuirot (chewi) Gentoo Linux Developer
pgpH4R76seazb.pgp
Description: OpenPGP digital signature