From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.77) (envelope-from ) id 1Srsdc-0006wF-PF for garchives@archives.gentoo.org; Thu, 19 Jul 2012 15:27:37 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B0598E06B3; Thu, 19 Jul 2012 15:27:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 71B81E06B3 for ; Thu, 19 Jul 2012 15:27:29 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B25391B4060 for ; Thu, 19 Jul 2012 15:27:28 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 7DA56E5434 for ; Thu, 19 Jul 2012 15:27:27 +0000 (UTC) From: "Ben de Groot" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ben de Groot" Message-ID: <1342711616.4e58a2225f0da02c3141f08095016436cf6933fb.yngwin@gentoo> Subject: [gentoo-commits] proj/qt:master commit in: eclass/ X-VCS-Repository: proj/qt X-VCS-Files: eclass/l10n.eclass X-VCS-Directories: eclass/ X-VCS-Committer: yngwin X-VCS-Committer-Name: Ben de Groot X-VCS-Revision: 4e58a2225f0da02c3141f08095016436cf6933fb X-VCS-Branch: master Date: Thu, 19 Jul 2012 15:27:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 9f38f2f0-4cde-4b05-b9cb-ef057187894b X-Archives-Hash: 05cc79e1eca6846cc933a8478f19ab88 commit: 4e58a2225f0da02c3141f08095016436cf6933fb Author: Ben de Groot gmail com> AuthorDate: Thu Jul 19 15:26:56 2012 +0000 Commit: Ben de Groot gentoo org> CommitDate: Thu Jul 19 15:26:56 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/qt.git;a=3Dco= mmit;h=3D4e58a222 Update l10n.eclass --- eclass/l10n.eclass | 72 ++++++++++++++++++++++++++++++----------------= ----- 1 files changed, 42 insertions(+), 30 deletions(-) diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass index 5c13c00..ffe8a9b 100644 --- a/eclass/l10n.eclass +++ b/eclass/l10n.eclass @@ -33,7 +33,11 @@ # Example: PLOCALE_BACKUP=3D"en_US" =20 # Add linguas useflags -[[ -n "${PLOCALES}" ]] && IUSE+=3D" $(printf 'linguas_%s ' ${PLOCALES})" +if [[ -n "${PLOCALES}" ]]; then + for u in ${PLOCALES}; do + IUSE+=3D" linguas_${u}" + done +fi =20 # @FUNCTION: l10n_for_each_locale_do # @USAGE: @@ -44,30 +48,27 @@ # # Example: l10n_for_each_locale_do install_locale l10n_for_each_locale_do() { - local xlocs=3D - xlocs=3D$(l10n_get_linguas_crosssection) - if [[ -n "${xlocs}" ]]; then - local x - for x in ${xlocs}; do - ${@} ${x} || die "failed to process ${x} locale" + local locs x + locs=3D$(l10n_get_locales) + if [[ -n "${locs}" ]]; then + for x in ${locs}; do + ${@} ${x} || die "failed to process enabled ${x} locale" done fi } =20 -# @FUNCTION: l10n_for_each_unselected_locale_do +# @FUNCTION: l10n_for_each_disabled_locale_do # @USAGE: # @DESCRIPTION: # Complementary to l10n_for_each_locale_do, this function will process -# locales that are not selected. This could be used for example to remov= e +# locales that are disabled. This could be used for example to remove # locales from a Makefile, to prevent them from being built needlessly. -l10n_for_each_unselected_locale_do() { - local o=3D x=3D - o=3D$(join -v 1 <(echo "${PLOCALES// /$'\n'}") <(echo "${LINGUAS// /$'\= n'}") ) - o=3D${o//$'\n'/' '} - einfo "Unselected locales are: ${o}" - if [[ -n "${o}" ]]; then - for x in ${o}; do - ${@} ${x} || die "failed to process unselected ${x} locale" +l10n_for_each_disabled_locale_do() { + local locs x + locs=3D$(l10n_get_locales disabled) + if [[ -n "${locs}" ]]; then + for x in ${locs}; do + ${@} ${x} || die "failed to process disabled ${x} locale" done fi } @@ -94,22 +95,33 @@ l10n_find_plocales_changes() { if [[ ${PLOCALES} !=3D ${current%[[:space:]]} ]] ; then einfo "There are changes in locales! This ebuild should be updated to:= " einfo "PLOCALES=3D\"${current%[[:space:]]}\"" + else + einfo "Done" fi } =20 -# @FUNCTION: l10n_get_linguas_crosssection +# @FUNCTION: l10n_get_locales +# @USAGE: [disabled] # @DESCRIPTION: -# Determine the cross-section of user-set LINGUAS and the locales which -# the package offers (listed in PLOCALES), and return them. In case no -# locales are selected, fall back on PLOCALE_BACKUP. This function is -# normally used internally in this eclass, not by l10n.eclass consumers. -l10n_get_linguas_crosssection() { - local lang=3D loc=3D xloc=3D - for lang in ${LINGUAS}; do - for loc in ${PLOCALES}; do - [[ ${lang} =3D=3D ${loc} ]] && xloc+=3D"${loc} " - done +# Determine which LINGUAS USE flags the user has enabled that are offere= d +# by the package, as listed in PLOCALES, and return them. In case no +# locales are selected, fall back on PLOCALE_BACKUP. When the disabled +# argument is given, return the disabled useflags instead of the enabled +# ones. This function is normally used internally in this eclass, not by +# l10n.eclass consumers. +l10n_get_locales() { + local disabled_locales enabled_locales loc locs + for loc in ${PLOCALES}; do + if use linguas_${loc}; then + enabled_locales+=3D"${loc} " + else + disabled_locales+=3D"${loc} " + fi done - xloc=3D${xloc:-$PLOCALE_BACKUP} - printf "%s" "${xloc}" + if [[ ${1} =3D=3D disabled ]]; then + locs=3D${disabled_locales} + else + locs=3D${enabled_locales:-$PLOCALE_BACKUP} + fi + printf "%s" "${locs}" }