public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/3] strip-linguas.eclass: New eclass, split off from l10n
@ 2021-06-24 17:05 Ulrich Müller
  2021-06-24 17:05 ` [gentoo-dev] [PATCH 2/3] eclass/plocale.eclass: Copied from l10n.eclass Ulrich Müller
  2021-06-24 17:05 ` [gentoo-dev] [PATCH 3/3] " Ulrich Müller
  0 siblings, 2 replies; 5+ messages in thread
From: Ulrich Müller @ 2021-06-24 17:05 UTC (permalink / raw
  To: gentoo-dev; +Cc: Ulrich Müller

Originally strip-linguas() was part of eutils.eclass. It was moved
to l10n.eclass in late 2020, but there are few (in any) ebuilds using
strip-linguas and the other functions from l10n.

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
 eclass/eutils.eclass        |  6 ++--
 eclass/l10n.eclass          | 49 ++-------------------------
 eclass/strip-linguas.eclass | 67 +++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 50 deletions(-)
 create mode 100644 eclass/strip-linguas.eclass

diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 2d90c35d9ade..fed193472218 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -25,10 +25,10 @@ _EUTILS_ECLASS=1
 # implicitly inherited (now split) eclasses
 case ${EAPI:-0} in
 	5|6)
-		inherit desktop edos2unix epatch estack l10n ltprune multilib \
-			preserve-libs toolchain-funcs vcs-clean wrapper
+		inherit desktop edos2unix epatch estack ltprune multilib \
+			preserve-libs strip-linguas toolchain-funcs vcs-clean wrapper
 		;;
-	7) inherit edos2unix l10n wrapper ;;
+	7) inherit edos2unix strip-linguas wrapper ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
index 5cf3931b7bf5..cd859429d8c7 100644
--- a/eclass/l10n.eclass
+++ b/eclass/l10n.eclass
@@ -20,6 +20,8 @@ case ${EAPI:-0} in
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+inherit strip-linguas
+
 if [[ -z ${_L10N_ECLASS} ]]; then
 _L10N_ECLASS=1
 
@@ -130,51 +132,4 @@ l10n_get_locales() {
 	printf "%s" "${locs}"
 }
 
-# @FUNCTION: strip-linguas
-# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
-# @DESCRIPTION:
-# Make sure that LINGUAS only contains languages that a package can
-# support.  The first form allows you to specify a list of LINGUAS.
-# The -i builds a list of po files found in all the directories and uses
-# the intersection of the lists.  The -u builds a list of po files found
-# in all the directories and uses the union of the lists.
-strip-linguas() {
-	local ls newls nols
-	if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
-		local op=$1; shift
-		ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift
-		local d f
-		for d in "$@" ; do
-			if [[ ${op} == "-u" ]] ; then
-				newls=${ls}
-			else
-				newls=""
-			fi
-			for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do
-				if [[ ${op} == "-i" ]] ; then
-					has ${f} ${ls} && newls="${newls} ${f}"
-				else
-					has ${f} ${ls} || newls="${newls} ${f}"
-				fi
-			done
-			ls=${newls}
-		done
-	else
-		ls="$@"
-	fi
-
-	nols=""
-	newls=""
-	for f in ${LINGUAS} ; do
-		if has ${f} ${ls} ; then
-			newls="${newls} ${f}"
-		else
-			nols="${nols} ${f}"
-		fi
-	done
-	[[ -n ${nols} ]] \
-		&& einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols}
-	export LINGUAS=${newls:1}
-}
-
 fi
diff --git a/eclass/strip-linguas.eclass b/eclass/strip-linguas.eclass
new file mode 100644
index 000000000000..718341b4a626
--- /dev/null
+++ b/eclass/strip-linguas.eclass
@@ -0,0 +1,67 @@
+# Copyright 2004-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: strip-linguas.eclass
+# @MAINTAINER:
+# Ulrich Müller <ulm@gentoo.org>
+# @AUTHOR:
+# Mike Frysinger <vapier@gentoo.org>
+# @SUPPORTED_EAPIS: 5 6 7 8
+# @BLURB: convenience function for LINGUAS support
+
+case ${EAPI} in
+	5|6|7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_STRIP_LINGUAS_ECLASS} ]]; then
+_STRIP_LINGUAS_ECLASS=1
+
+# @FUNCTION: strip-linguas
+# @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
+# @DESCRIPTION:
+# Make sure that LINGUAS only contains languages that a package can
+# support.  The first form allows you to specify a list of LINGUAS.
+# The -i builds a list of po files found in all the directories and uses
+# the intersection of the lists.  The -u builds a list of po files found
+# in all the directories and uses the union of the lists.
+strip-linguas() {
+	local d f ls newls nols
+
+	if [[ $1 == "-i" ]] || [[ $1 == "-u" ]]; then
+		local op=$1; shift
+		ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift
+		for d; do
+			if [[ ${op} == "-u" ]]; then
+				newls=${ls}
+			else
+				newls=""
+			fi
+			for f in $(find "${d}" -name '*.po' -exec basename {} .po ';'); do
+				if [[ ${op} == "-i" ]]; then
+					has ${f} ${ls} && newls+=" ${f}"
+				else
+					has ${f} ${ls} || newls+=" ${f}"
+				fi
+			done
+			ls=${newls}
+		done
+	else
+		ls="$@"
+	fi
+
+	nols=""
+	newls=""
+	for f in ${LINGUAS}; do
+		if has ${f} ${ls}; then
+			newls+=" ${f}"
+		else
+			nols+=" ${f}"
+		fi
+	done
+	[[ -n ${nols} ]] \
+		&& einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols}
+	export LINGUAS=${newls:1}
+}
+
+fi
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH 2/3] eclass/plocale.eclass: Copied from l10n.eclass
  2021-06-24 17:05 [gentoo-dev] [PATCH 1/3] strip-linguas.eclass: New eclass, split off from l10n Ulrich Müller
@ 2021-06-24 17:05 ` Ulrich Müller
  2021-06-28  6:47   ` [gentoo-dev] [PATCH v2 1/2] plocale.eclass: " Ulrich Müller
  2021-06-28  6:47   ` [gentoo-dev] [PATCH v2 2/2] l10n.eclass: Mark as deprecated Ulrich Müller
  2021-06-24 17:05 ` [gentoo-dev] [PATCH 3/3] " Ulrich Müller
  1 sibling, 2 replies; 5+ messages in thread
From: Ulrich Müller @ 2021-06-24 17:05 UTC (permalink / raw
  To: gentoo-dev; +Cc: Ulrich Müller

Ever since the L10N USE_EXPAND variable was introduced, the name of
this eclass was somewhat confusing, because it operates on LINGUAS and
is unrelated to L10N. Take the EAPI 8 bump as an opportunity to rename
the eclass.

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
 eclass/{l10n.eclass => plocale.eclass} | 78 +++++++++++++-------------
 1 file changed, 38 insertions(+), 40 deletions(-)
 copy eclass/{l10n.eclass => plocale.eclass} (61%)

diff --git a/eclass/l10n.eclass b/eclass/plocale.eclass
similarity index 61%
copy from eclass/l10n.eclass
copy to eclass/plocale.eclass
index cd859429d8c7..81f147a655ed 100644
--- a/eclass/l10n.eclass
+++ b/eclass/plocale.eclass
@@ -1,29 +1,27 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 2012-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-# @ECLASS: l10n.eclass
+# @ECLASS: plocale.eclass
 # @MAINTAINER:
 # Ulrich Müller <ulm@gentoo.org>
 # @AUTHOR:
 # Ben de Groot <yngwin@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 6 7 8
 # @BLURB: convenience functions to handle localizations
 # @DESCRIPTION:
-# The l10n (localization) eclass offers a number of functions to more
+# The plocale (localization) eclass offers a number of functions to more
 # conveniently handle localizations (translations) offered by packages.
 # These are meant to prevent code duplication for such boring tasks as
 # determining the cross-section between the user's set LINGUAS and what
 # is offered by the package.
 
-case ${EAPI:-0} in
-	[567]) ;;
+case ${EAPI} in
+	6|7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-inherit strip-linguas
-
-if [[ -z ${_L10N_ECLASS} ]]; then
-_L10N_ECLASS=1
+if [[ -z ${_PLOCALE_ECLASS} ]]; then
+_PLOCALE_ECLASS=1
 
 # @ECLASS-VARIABLE: PLOCALES
 # @DEFAULT_UNSET
@@ -37,81 +35,81 @@ _L10N_ECLASS=1
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # In some cases the package fails when none of the offered PLOCALES are
-# selected by the user. In that case this variable should be set to a
+# selected by the user.  In that case this variable should be set to a
 # default locale (usually 'en' or 'en_US') as backup.
 #
 # Example: PLOCALE_BACKUP="en_US"
 
-# @FUNCTION: l10n_for_each_locale_do
+# @FUNCTION: plocale_for_each_locale
 # @USAGE: <function>
 # @DESCRIPTION:
-# Convenience function for processing localizations. The parameter should
-# be a function (defined in the consuming eclass or ebuild) which takes
-# an individual localization as (last) parameter.
+# Convenience function for processing all enabled localizations.
+# The parameter should be a function (defined in the consuming eclass
+# or ebuild) which takes an individual locale as its (last) parameter.
 #
-# Example: l10n_for_each_locale_do install_locale
-l10n_for_each_locale_do() {
+# Example: plocale_for_each_locale install_locale
+plocale_for_each_locale() {
 	local locs x
-	locs=$(l10n_get_locales)
+	locs=$(plocale_get_locales)
 	for x in ${locs}; do
-		"${@}" ${x} || die "failed to process enabled ${x} locale"
+		"$@" ${x} || die "failed to process enabled ${x} locale"
 	done
 }
 
-# @FUNCTION: l10n_for_each_disabled_locale_do
+# @FUNCTION: plocale_for_each_disabled_locale
 # @USAGE: <function>
 # @DESCRIPTION:
-# Complementary to l10n_for_each_locale_do, this function will process
-# locales that are disabled. This could be used for example to remove
+# Complementary to plocale_for_each_locale, this function will process
+# 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_disabled_locale_do() {
+plocale_for_each_disabled_locale() {
 	local locs x
-	locs=$(l10n_get_locales disabled)
+	locs=$(plocale_get_locales disabled)
 	for x in ${locs}; do
-		"${@}" ${x} || die "failed to process disabled ${x} locale"
+		"$@" ${x} || die "failed to process disabled ${x} locale"
 	done
 }
 
-# @FUNCTION: l10n_find_plocales_changes
+# @FUNCTION: plocale_find_changes
 # @USAGE: <translations dir> <filename pre pattern> <filename post pattern>
 # @DESCRIPTION:
 # Ebuild maintenance helper function to find changes in package offered
-# locales when doing a version bump. This could be added for example to
-# src_prepare
+# locales when doing a version bump.  This could be added for example
+# to src_prepare.
 #
-# Example: l10n_find_plocales_changes "${S}/src/translations" "${PN}_" '.ts'
-l10n_find_plocales_changes() {
-	[[ $# -ne 3 ]] && die "Exactly 3 arguments are needed!"
+# Example: plocale_find_changes "${S}/src/translations" "${PN}_" '.ts'
+plocale_find_changes() {
+	[[ $# -eq 3 ]] || die "Exactly 3 arguments are needed!"
 	ebegin "Looking in ${1} for new locales"
 	pushd "${1}" >/dev/null || die "Cannot access ${1}"
-	local current= x=
-	for x in ${2}*${3} ; do
+	local current="" x
+	for x in ${2}*${3}; do
 		x=${x#"${2}"}
 		x=${x%"${3}"}
 		current+="${x} "
 	done
-	popd >/dev/null
+	popd >/dev/null || die
 	# RHS will be sorted with single spaces so ensure the LHS is too
 	# before attempting to compare them for equality. See bug #513242.
 	# 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:"
+	[[ "$(printf '%s\n' ${PLOCALES} | LC_ALL=C sort)" \
+		== "$(printf '%s\n' ${current} | LC_ALL=C sort)" ]]
+	if ! eend $? "There are changes in locales!"; then
+		eerror "This ebuild should be updated to:"
 		eerror "PLOCALES=\"${current%[[:space:]]}\""
 		return 1
-	else
-		eend 0
 	fi
 }
 
-# @FUNCTION: l10n_get_locales
+# @FUNCTION: plocale_get_locales
 # @USAGE: [disabled]
 # @DESCRIPTION:
 # Determine which LINGUAS the user has enabled that are offered 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 locales instead of the enabled ones.
-l10n_get_locales() {
+plocale_get_locales() {
 	local loc locs
 	if [[ -z ${LINGUAS+set} ]]; then
 		# enable all if unset
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH 3/3] l10n.eclass: Mark as deprecated
  2021-06-24 17:05 [gentoo-dev] [PATCH 1/3] strip-linguas.eclass: New eclass, split off from l10n Ulrich Müller
  2021-06-24 17:05 ` [gentoo-dev] [PATCH 2/3] eclass/plocale.eclass: Copied from l10n.eclass Ulrich Müller
@ 2021-06-24 17:05 ` Ulrich Müller
  1 sibling, 0 replies; 5+ messages in thread
From: Ulrich Müller @ 2021-06-24 17:05 UTC (permalink / raw
  To: gentoo-dev; +Cc: Ulrich Müller

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
 eclass/l10n.eclass      | 1 +
 metadata/qa-policy.conf | 1 +
 2 files changed, 2 insertions(+)

diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
index cd859429d8c7..2b24831c63db 100644
--- a/eclass/l10n.eclass
+++ b/eclass/l10n.eclass
@@ -8,6 +8,7 @@
 # Ben de Groot <yngwin@gentoo.org>
 # @SUPPORTED_EAPIS: 5 6 7
 # @BLURB: convenience functions to handle localizations
+# @DEPRECATED: plocale.eclass
 # @DESCRIPTION:
 # The l10n (localization) eclass offers a number of functions to more
 # conveniently handle localizations (translations) offered by packages.
diff --git a/metadata/qa-policy.conf b/metadata/qa-policy.conf
index cc0e7311d790..cc9d0674f3bf 100644
--- a/metadata/qa-policy.conf
+++ b/metadata/qa-policy.conf
@@ -71,6 +71,7 @@ cmake-utils = cmake
 darcs = (none)
 epatch = (eapply since EAPI 6)
 eutils = (split into several eclasses)
+l10n = plocale
 ltprune = (inline find ... -delete)
 mono = mono-env
 user = (GLEP 81 acct-* packages)
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH v2 1/2] plocale.eclass: Copied from l10n.eclass
  2021-06-24 17:05 ` [gentoo-dev] [PATCH 2/3] eclass/plocale.eclass: Copied from l10n.eclass Ulrich Müller
@ 2021-06-28  6:47   ` Ulrich Müller
  2021-06-28  6:47   ` [gentoo-dev] [PATCH v2 2/2] l10n.eclass: Mark as deprecated Ulrich Müller
  1 sibling, 0 replies; 5+ messages in thread
From: Ulrich Müller @ 2021-06-28  6:47 UTC (permalink / raw
  To: gentoo-dev; +Cc: Ulrich Müller

Ever since the L10N USE_EXPAND variable was introduced, the name of
this eclass was somewhat confusing, because it operates on LINGUAS and
is unrelated to L10N. Take the EAPI 8 bump as an opportunity to rename
the eclass.

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
v2: Expanded eclass documentation

 eclass/plocale.eclass | 169 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 169 insertions(+)
 create mode 100644 eclass/plocale.eclass

diff --git a/eclass/plocale.eclass b/eclass/plocale.eclass
new file mode 100644
index 000000000000..3a7b78e93ff2
--- /dev/null
+++ b/eclass/plocale.eclass
@@ -0,0 +1,169 @@
+# Copyright 2012-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: plocale.eclass
+# @MAINTAINER:
+# Ulrich Müller <ulm@gentoo.org>
+# @AUTHOR:
+# Ben de Groot <yngwin@gentoo.org>
+# @SUPPORTED_EAPIS: 6 7 8
+# @BLURB: convenience functions to handle localizations
+# @DESCRIPTION:
+# The plocale (localization) eclass offers a number of functions to more
+# conveniently handle localizations (translations) offered by packages.
+# These are meant to prevent code duplication for such boring tasks as
+# determining the cross-section between the user's set LINGUAS and what
+# is offered by the package.
+#
+# Typical usage in an ebuild looks like this:
+#
+# @CODE
+#   PLOCALES="de en fr pt_BR zh_CN"
+#   PLOCALE_BACKUP="en"
+# @CODE
+#
+# There, PLOCALES is the list of locales that the package supports.
+# PLOCALE_BACKUP is optional and specifies a single locale, which is
+# used as a fallback if none of the PLOCALES matches the user's
+# LINGUAS selection.
+#
+# The eclass functions then operate on the intersection of the package's
+# PLOCALES with the user's LINGUAS setting.  (As a special case, if the
+# LINGUAS variable is unset then all items in PLOCALES will be used,
+# emulating the behaviour of gettext.)
+#
+# In the following simple example, locale specific README files
+# (e.g. README.de, README.en) are added to the DOCS variable:
+#
+# @CODE
+#   my_add_to_docs() {
+#       DOCS+=( ${1}.${2} )
+#   }
+#   plocale_for_each_locale my_add_to_docs README
+# @CODE
+#
+# A complementary function plocale_for_each_disabled_locale exists as
+# well, which operates on the set difference of PLOCALES and LINGUAS,
+# i.e. on the locales that the user hasn't enabled.  For example, it can
+# be used to remove unnecessary locale files.
+#
+# Finally, plocale_find_changes is purely a helper function for ebuild
+# maintenance.  It can be used to scan a directory for available
+# translations and check if the ebuild's PLOCALES are still up to date.
+
+case ${EAPI} in
+	6|7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_PLOCALE_ECLASS} ]]; then
+_PLOCALE_ECLASS=1
+
+# @ECLASS-VARIABLE: PLOCALES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Variable listing the locales for which localizations are offered by
+# the package.
+#
+# Example: PLOCALES="cy de el_GR en_US pt_BR vi zh_CN"
+
+# @ECLASS-VARIABLE: PLOCALE_BACKUP
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# In some cases the package fails when none of the offered PLOCALES are
+# selected by the user.  In that case this variable should be set to a
+# default locale (usually 'en' or 'en_US') as backup.
+#
+# Example: PLOCALE_BACKUP="en_US"
+
+# @FUNCTION: plocale_for_each_locale
+# @USAGE: <function> [<args>...]
+# @DESCRIPTION:
+# Convenience function for processing all enabled localizations.
+# The parameter should be a function (defined in the consuming eclass
+# or ebuild) which takes an individual locale as its (last) parameter.
+#
+# Example: plocale_for_each_locale install_locale
+plocale_for_each_locale() {
+	local locs x
+	locs=$(plocale_get_locales)
+	for x in ${locs}; do
+		"$@" ${x} || die "failed to process enabled ${x} locale"
+	done
+}
+
+# @FUNCTION: plocale_for_each_disabled_locale
+# @USAGE: <function> [<args>...]
+# @DESCRIPTION:
+# Complementary to plocale_for_each_locale, this function will process
+# locales that are disabled.  This could be used for example to remove
+# locales from a Makefile, to prevent them from being built needlessly.
+plocale_for_each_disabled_locale() {
+	local locs x
+	locs=$(plocale_get_locales disabled)
+	for x in ${locs}; do
+		"$@" ${x} || die "failed to process disabled ${x} locale"
+	done
+}
+
+# @FUNCTION: plocale_find_changes
+# @USAGE: <translations dir> <filename pre pattern> <filename post pattern>
+# @DESCRIPTION:
+# Ebuild maintenance helper function to find changes in package offered
+# locales when doing a version bump.  This could be added for example
+# to src_prepare.
+#
+# Example: plocale_find_changes "${S}/src/translations" "${PN}_" '.ts'
+plocale_find_changes() {
+	[[ $# -eq 3 ]] || die "Exactly 3 arguments are needed!"
+	ebegin "Looking in ${1} for new locales"
+	pushd "${1}" >/dev/null || die "Cannot access ${1}"
+	local current="" x
+	for x in ${2}*${3}; do
+		x=${x#"${2}"}
+		x=${x%"${3}"}
+		current+="${x} "
+	done
+	popd >/dev/null || die
+	# RHS will be sorted with single spaces so ensure the LHS is too
+	# before attempting to compare them for equality. See bug #513242.
+	# Run them both through the same sorting algorithm so we don't have
+	# to worry about them being the same.
+	[[ "$(printf '%s\n' ${PLOCALES} | LC_ALL=C sort)" \
+		== "$(printf '%s\n' ${current} | LC_ALL=C sort)" ]]
+	if ! eend $? "There are changes in locales!"; then
+		eerror "This ebuild should be updated to:"
+		eerror "PLOCALES=\"${current%[[:space:]]}\""
+		return 1
+	fi
+}
+
+# @FUNCTION: plocale_get_locales
+# @USAGE: [disabled]
+# @DESCRIPTION:
+# Determine which LINGUAS the user has enabled that are offered 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 locales instead of the enabled ones.
+plocale_get_locales() {
+	local loc locs
+	if [[ -z ${LINGUAS+set} ]]; then
+		# enable all if unset
+		locs=${PLOCALES}
+	else
+		for loc in ${LINGUAS}; do
+			has ${loc} ${PLOCALES} && locs+="${loc} "
+		done
+	fi
+	[[ -z ${locs} ]] && locs=${PLOCALE_BACKUP}
+	if [[ ${1} == disabled ]]; then
+		local disabled_locs
+		for loc in ${PLOCALES}; do
+			has ${loc} ${locs} || disabled_locs+="${loc} "
+		done
+		locs=${disabled_locs}
+	fi
+	printf "%s" "${locs}"
+}
+
+fi
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH v2 2/2] l10n.eclass: Mark as deprecated
  2021-06-24 17:05 ` [gentoo-dev] [PATCH 2/3] eclass/plocale.eclass: Copied from l10n.eclass Ulrich Müller
  2021-06-28  6:47   ` [gentoo-dev] [PATCH v2 1/2] plocale.eclass: " Ulrich Müller
@ 2021-06-28  6:47   ` Ulrich Müller
  1 sibling, 0 replies; 5+ messages in thread
From: Ulrich Müller @ 2021-06-28  6:47 UTC (permalink / raw
  To: gentoo-dev; +Cc: Ulrich Müller

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
 eclass/l10n.eclass      | 1 +
 metadata/qa-policy.conf | 1 +
 2 files changed, 2 insertions(+)

diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
index b1dff96ded12..f53cb3d0898b 100644
--- a/eclass/l10n.eclass
+++ b/eclass/l10n.eclass
@@ -8,6 +8,7 @@
 # Ben de Groot <yngwin@gentoo.org>
 # @SUPPORTED_EAPIS: 5 6 7
 # @BLURB: convenience functions to handle localizations
+# @DEPRECATED: plocale.eclass
 # @DESCRIPTION:
 # The l10n (localization) eclass offers a number of functions to more
 # conveniently handle localizations (translations) offered by packages.
diff --git a/metadata/qa-policy.conf b/metadata/qa-policy.conf
index cc0e7311d790..cc9d0674f3bf 100644
--- a/metadata/qa-policy.conf
+++ b/metadata/qa-policy.conf
@@ -71,6 +71,7 @@ cmake-utils = cmake
 darcs = (none)
 epatch = (eapply since EAPI 6)
 eutils = (split into several eclasses)
+l10n = plocale
 ltprune = (inline find ... -delete)
 mono = mono-env
 user = (GLEP 81 acct-* packages)
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-28  6:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-24 17:05 [gentoo-dev] [PATCH 1/3] strip-linguas.eclass: New eclass, split off from l10n Ulrich Müller
2021-06-24 17:05 ` [gentoo-dev] [PATCH 2/3] eclass/plocale.eclass: Copied from l10n.eclass Ulrich Müller
2021-06-28  6:47   ` [gentoo-dev] [PATCH v2 1/2] plocale.eclass: " Ulrich Müller
2021-06-28  6:47   ` [gentoo-dev] [PATCH v2 2/2] l10n.eclass: Mark as deprecated Ulrich Müller
2021-06-24 17:05 ` [gentoo-dev] [PATCH 3/3] " Ulrich Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox