Mailing List Archive

[PATCH] lua*.eclass: standardize the guard variables
Change the _R0 suffix on these variable names to _ECLASS.
Signed-off-by: William Hubbs <williamh@gentoo.org>
---
eclass/lua-single.eclass | 8 ++++----
eclass/lua-utils.eclass | 8 ++++----
eclass/lua.eclass | 8 ++++----
3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/eclass/lua-single.eclass b/eclass/lua-single.eclass
index ab4fdb3c75a..8b3692b2f18 100644
--- a/eclass/lua-single.eclass
+++ b/eclass/lua-single.eclass
@@ -68,9 +68,9 @@ case ${EAPI} in
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac

-if [[ ! ${_LUA_SINGLE_R0} ]]; then
+if [[ ! ${_LUA_SINGLE_ECLASS} ]]; then

-if [[ ${_LUA_R0} ]]; then
+if [[ ${_LUA_ECLASS} ]]; then
die 'lua-single.eclass cannot be used with lua.eclass.'
fi

@@ -275,7 +275,7 @@ _lua_single_set_globals() {
_lua_single_set_globals
unset -f _lua_single_set_globals

-if [[ ! ${_LUA_SINGLE_R0} ]]; then
+if [[ ! ${_LUA_SINGLE_ECLASS} ]]; then

# @FUNCTION: _lua_gen_usedep
# @USAGE: [<pattern>...]
@@ -531,5 +531,5 @@ lua-single_pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && lua_setup
}

-_LUA_SINGLE_R0=1
+_LUA_SINGLE_ECLASS=1
fi
diff --git a/eclass/lua-utils.eclass b/eclass/lua-utils.eclass
index 278bbca58a3..52ba290e544 100644
--- a/eclass/lua-utils.eclass
+++ b/eclass/lua-utils.eclass
@@ -23,7 +23,7 @@ case ${EAPI} in
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac

-if [[ ! ${_LUA_UTILS_R0} ]]; then
+if [[ ! ${_LUA_UTILS_ECLASS} ]]; then

inherit toolchain-funcs

@@ -376,7 +376,7 @@ lua_enable_tests() {
busted)
test_directory="${2:-spec}"
test_pkg="dev-lua/busted"
- if [[ ! ${_LUA_SINGLE_R0} ]]; then
+ if [[ ! ${_LUA_SINGLE_ECLASS} ]]; then
eval "lua_src_test() {
busted --lua=\"\${ELUA}\" --output=\"plainTerminal\" \"${test_directory}\" || die \"Tests fail with \${ELUA}\"
}"
@@ -395,7 +395,7 @@ lua_enable_tests() {

local test_deps=${RDEPEND}
if [[ -n ${test_pkg} ]]; then
- if [[ ! ${_LUA_SINGLE_R0} ]]; then
+ if [[ ! ${_LUA_SINGLE_ECLASS} ]]; then
test_deps+=" ${test_pkg}[${LUA_USEDEP}]"
else
test_deps+=" $(lua_gen_cond_dep "
@@ -528,5 +528,5 @@ lua_get_version() {
echo "${LUA_VERSION}"
}

-_LUA_UTILS_R0=1
+_LUA_UTILS_ECLASS=1
fi
diff --git a/eclass/lua.eclass b/eclass/lua.eclass
index e9a5c117560..d6fe7201779 100644
--- a/eclass/lua.eclass
+++ b/eclass/lua.eclass
@@ -56,9 +56,9 @@ case ${EAPI} in
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac

-if [[ ! ${_LUA_R0} ]]; then
+if [[ ! ${_LUA_ECLASS} ]]; then

-if [[ ${_LUA_SINGLE_R0} ]]; then
+if [[ ${_LUA_SINGLE_ECLASS} ]]; then
die 'lua.eclass cannot be used with lua-single.eclass.'
fi

@@ -196,7 +196,7 @@ fi
# lua_targets_lua5-1(-)?,lua_targets_lua5-2(-)?
# @CODE

-if [[ ! ${_LUA_R0} ]]; then
+if [[ ! ${_LUA_ECLASS} ]]; then

# @FUNCTION: _lua_validate_useflags
# @INTERNAL
@@ -313,7 +313,7 @@ lua_foreach_impl() {
multibuild_foreach_variant _lua_multibuild_wrapper "${@}"
}

-_LUA_R0=1
+_LUA_ECLASS=1
fi

# @FUNCTION: _lua_set_globals
--
2.31.1
Re: [PATCH] lua*.eclass: standardize the guard variables [ In reply to ]
> On 6 Jul 2021, at 22:59, William Hubbs <williamh@gentoo.org> wrote:
>
> Change the _R0 suffix on these variable names to _ECLASS.
> Signed-off-by: William Hubbs <williamh@gentoo.org>

Seems good, thanks William!

> [snip]

best,
sam
Re: [PATCH] lua*.eclass: standardize the guard variables [ In reply to ]
>>>>> On Tue, 06 Jul 2021, William Hubbs wrote:

> -_LUA_SINGLE_R0=1
> +_LUA_SINGLE_ECLASS=1
> fi

These should be assigned immediately after the test near the top of the
eclass, before any inherit statement. Otherwise, circular inheritance
won't be prevented.

Ulrich
Re: [PATCH] lua*.eclass: standardize the guard variables [ In reply to ]
On 2021-07-06 22:59, William Hubbs wrote:

> Change the _R0 suffix on these variable names to _ECLASS.

Any non-cosmetic reasons for doing this?

--
Marecki
[PATCH] lua*.eclass: standardize the guard variables [ In reply to ]
Change the _R0 suffix on these variable names to _ECLASS.
Signed-off-by: William Hubbs <williamh@gentoo.org>
---
eclass/lua-single.eclass | 10 +++-------
eclass/lua-utils.eclass | 8 ++++----
eclass/lua.eclass | 12 +++++-------
3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/eclass/lua-single.eclass b/eclass/lua-single.eclass
index ab4fdb3c75a..5e1ee936c12 100644
--- a/eclass/lua-single.eclass
+++ b/eclass/lua-single.eclass
@@ -68,16 +68,15 @@ case ${EAPI} in
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac

-if [[ ! ${_LUA_SINGLE_R0} ]]; then
+if [[ ! ${_LUA_SINGLE_ECLASS} ]]; then
+_LUA_SINGLE_ECLASS=1

-if [[ ${_LUA_R0} ]]; then
+if [[ ${_LUA_ECLASS} ]]; then
die 'lua-single.eclass cannot be used with lua.eclass.'
fi

inherit lua-utils

-fi
-
EXPORT_FUNCTIONS pkg_setup

# @ECLASS-VARIABLE: LUA_COMPAT
@@ -275,8 +274,6 @@ _lua_single_set_globals() {
_lua_single_set_globals
unset -f _lua_single_set_globals

-if [[ ! ${_LUA_SINGLE_R0} ]]; then
-
# @FUNCTION: _lua_gen_usedep
# @USAGE: [<pattern>...]
# @INTERNAL
@@ -531,5 +528,4 @@ lua-single_pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && lua_setup
}

-_LUA_SINGLE_R0=1
fi
diff --git a/eclass/lua-utils.eclass b/eclass/lua-utils.eclass
index 278bbca58a3..52ba290e544 100644
--- a/eclass/lua-utils.eclass
+++ b/eclass/lua-utils.eclass
@@ -23,7 +23,7 @@ case ${EAPI} in
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac

-if [[ ! ${_LUA_UTILS_R0} ]]; then
+if [[ ! ${_LUA_UTILS_ECLASS} ]]; then

inherit toolchain-funcs

@@ -376,7 +376,7 @@ lua_enable_tests() {
busted)
test_directory="${2:-spec}"
test_pkg="dev-lua/busted"
- if [[ ! ${_LUA_SINGLE_R0} ]]; then
+ if [[ ! ${_LUA_SINGLE_ECLASS} ]]; then
eval "lua_src_test() {
busted --lua=\"\${ELUA}\" --output=\"plainTerminal\" \"${test_directory}\" || die \"Tests fail with \${ELUA}\"
}"
@@ -395,7 +395,7 @@ lua_enable_tests() {

local test_deps=${RDEPEND}
if [[ -n ${test_pkg} ]]; then
- if [[ ! ${_LUA_SINGLE_R0} ]]; then
+ if [[ ! ${_LUA_SINGLE_ECLASS} ]]; then
test_deps+=" ${test_pkg}[${LUA_USEDEP}]"
else
test_deps+=" $(lua_gen_cond_dep "
@@ -528,5 +528,5 @@ lua_get_version() {
echo "${LUA_VERSION}"
}

-_LUA_UTILS_R0=1
+_LUA_UTILS_ECLASS=1
fi
diff --git a/eclass/lua.eclass b/eclass/lua.eclass
index e9a5c117560..3b0816f9834 100644
--- a/eclass/lua.eclass
+++ b/eclass/lua.eclass
@@ -56,9 +56,10 @@ case ${EAPI} in
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac

-if [[ ! ${_LUA_R0} ]]; then
+if [[ ! ${_LUA_ECLASS} ]]; then
+_LUA_ECLASS=1

-if [[ ${_LUA_SINGLE_R0} ]]; then
+if [[ ${_LUA_SINGLE_ECLASS} ]]; then
die 'lua.eclass cannot be used with lua-single.eclass.'
fi

@@ -196,8 +197,6 @@ fi
# lua_targets_lua5-1(-)?,lua_targets_lua5-2(-)?
# @CODE

-if [[ ! ${_LUA_R0} ]]; then
-
# @FUNCTION: _lua_validate_useflags
# @INTERNAL
# @DESCRIPTION:
@@ -313,9 +312,6 @@ lua_foreach_impl() {
multibuild_foreach_variant _lua_multibuild_wrapper "${@}"
}

-_LUA_R0=1
-fi
-
# @FUNCTION: _lua_set_globals
# @INTERNAL
# @DESCRIPTION:
@@ -374,3 +370,5 @@ _lua_set_globals() {

_lua_set_globals
unset -f _lua_set_globals
+
+fi
--
2.31.1
Re: [PATCH] lua*.eclass: standardize the guard variables [ In reply to ]
On 2021-07-10 22:55, William Hubbs wrote:

> Change the _R0 suffix on these variable names to _ECLASS.

Since my question in response to the previous round of this has yet to
be answered, I repeat: are there any non-cosmetic reasons for doing this?

--
Marecki
Re: [PATCH] lua*.eclass: standardize the guard variables [ In reply to ]
On Mon, Jul 12, 2021 at 11:24:42AM +0100, Marek Szuba wrote:
> On 2021-07-10 22:55, William Hubbs wrote:
>
> > Change the _R0 suffix on these variable names to _ECLASS.
>
> Since my question in response to the previous round of this has yet to
> be answered, I repeat: are there any non-cosmetic reasons for doing this?

Consistency with the rest of the tree. If you do a "git grep _R0" on the
eclass directory, the lua eclasses are the only ones that have this in
the names of the guard variables, and the eclasses themselves aren't
named lua-r0.eclass etc.

What will break if I do this?

William
Re: [PATCH] lua*.eclass: standardize the guard variables [ In reply to ]
On 2021-07-13 18:35, William Hubbs wrote:

>> are there any non-cosmetic reasons for doing this?
>>
> Consistency with the rest of the tree. If you do a "git grep _R0" on the
> eclass directory, the lua eclasses are the only ones that have this in
> the names of the guard variables, and the eclasses themselves aren't
> named lua-r0.eclass etc.
>
> What will break if I do this?

Nothing should, given that eclass guard variables should have no
interactions with anything other than respective eclasses themselves. Of
course that means this change *is* purely cosmetic... especially
considering that while _FOO_ECLASS is currently the most common format
in the tree it is by no means the only one, and that revision 0 is
technically speaking a real thing that we just happen to treat as
default and omit from names for brevity.

I've got no preference either way as long as guard variables can easily
be searched for in eclass code, so if you haven't got anything more
important to work on in Gentoo go ahead.

--
Marecki