public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 0/3] RFC: cmake-utils.eclass minor updates
@ 2016-01-25 20:29 Justin Lecher
  2016-01-25 20:29 ` [gentoo-dev] [PATCH 1/3] cmake-utils.eclass: Use bash internal testing instead of has() Justin Lecher
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Justin Lecher @ 2016-01-25 20:29 UTC (permalink / raw
  To: gentoo-dev; +Cc: kde, Justin Lecher

Hi,

Some minor updates on the EAPI testing in the eclass.

Justin

Justin Lecher (3):
  cmake-utils.eclass: Use bash internal testing instead of has()
  cmake-utils.eclass: Drop empty line
  cmake-utils.eclass: Define default EAPI to 0

 eclass/cmake-utils.eclass | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

-- 
2.7.0



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

* [gentoo-dev] [PATCH 1/3] cmake-utils.eclass: Use bash internal testing instead of has()
  2016-01-25 20:29 [gentoo-dev] [PATCH 0/3] RFC: cmake-utils.eclass minor updates Justin Lecher
@ 2016-01-25 20:29 ` Justin Lecher
  2016-01-25 20:29 ` [gentoo-dev] [PATCH 2/3] cmake-utils.eclass: Drop empty line Justin Lecher
  2016-01-25 20:29 ` [gentoo-dev] [PATCH 3/3] cmake-utils.eclass: Define default EAPI to 0 Justin Lecher
  2 siblings, 0 replies; 8+ messages in thread
From: Justin Lecher @ 2016-01-25 20:29 UTC (permalink / raw
  To: gentoo-dev; +Cc: kde, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/cmake-utils.eclass | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 9e8e71e..fb7f5ca 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -127,7 +127,7 @@ case ${WANT_CMAKE} in
 	always)
 		;;
 	*)
-		has "${EAPI:-0}" 2 3 4 5 || die "WANT_CMAKE is banned in EAPI 6 and later"
+		[[ ${EAPI} == [2345] ]] || die "WANT_CMAKE is banned in EAPI 6 and later"
 		IUSE+=" ${WANT_CMAKE}"
 		CMAKEDEPEND+="${WANT_CMAKE}? ( "
 		;;
@@ -164,7 +164,7 @@ _cmake_use_me_now() {
 	local arg=$2
 	[[ ! -z $3 ]] && arg=$3
 
-	has "${EAPI:-0}" 2 3 4 5 || die "${FUNCNAME[1]} is banned in EAPI 6 and later: use -D$1${arg}=\"\$(usex $2)\" instead"
+	[[ ${EAPI} == [2345] ]] || die "${FUNCNAME[1]} is banned in EAPI 6 and later: use -D$1${arg}=\"\$(usex $2)\" instead"
 
 	local uper capitalised x
 	[[ -z $2 ]] && die "cmake-utils_use-$1 <USE flag> [<flag name>]"
@@ -186,7 +186,7 @@ _cmake_use_me_now_inverted() {
 	local arg=$2
 	[[ ! -z $3 ]] && arg=$3
 
-	if ! has "${EAPI:-0}" 2 3 4 5 && [[ "${FUNCNAME[1]}" != cmake-utils_use_find_package ]] ; then
+	if [[ ${EAPI} != [2345] ]] && [[ "${FUNCNAME[1]}" != cmake-utils_use_find_package ]] ; then
 		die "${FUNCNAME[1]} is banned in EAPI 6 and later: use -D$1${arg}=\"\$(usex $2)\" insteadss"
 	fi
 
@@ -283,7 +283,7 @@ cmake_comment_add_subdirectory() {
 # Comment out an add_subdirectory call in CMakeLists.txt in the current directory
 # Banned in EAPI 6 and later - use cmake_comment_add_subdirectory instead.
 comment_add_subdirectory() {
-	has "${EAPI:-0}" 2 3 4 5 || die "comment_add_subdirectory is banned in EAPI 6 and later - use cmake_comment_add_subdirectory instead"
+	[[ ${EAPI} == [2345] ]] || die "comment_add_subdirectory is banned in EAPI 6 and later - use cmake_comment_add_subdirectory instead"
 
 	cmake_comment_add_subdirectory "$@"
 }
@@ -315,7 +315,7 @@ cmake-utils_use_enable() { _cmake_use_me_now ENABLE_ "$@" ; }
 # if foo is enabled and -DCMAKE_DISABLE_FIND_PACKAGE_LibFoo=ON if it is disabled.
 # This can be used to make find_package optional.
 cmake-utils_use_find_package() {
-	if ! has "${EAPI:-0}" 2 3 4 5 && [[ "$#" != 2 ]] ; then
+	if [[ ${EAPI} != [2345] ]] && [[ "$#" != 2 ]] ; then
 		die "Usage: cmake-utils_use_find_package <USE flag> <package name>"
 	fi
 
@@ -456,7 +456,7 @@ enable_cmake-utils_src_prepare() {
 
 	pushd "${S}" > /dev/null || die
 
-	if ! has "${EAPI:-0}" 2 3 4 5 ; then
+	if [[ ${EAPI} != [2345] ]]; then
 		default_src_prepare
 		_cmake_cleanup_cmake
 	else
@@ -488,7 +488,7 @@ enable_cmake-utils_src_prepare() {
 enable_cmake-utils_src_configure() {
 	debug-print-function ${FUNCNAME} "$@"
 
-	has "${EAPI:-0}" 2 3 4 5 && _cmake_cleanup_cmake
+	[[ ${EAPI} == [2345] ]] && _cmake_cleanup_cmake
 
 	_cmake_check_build_dir
 
@@ -564,7 +564,7 @@ enable_cmake-utils_src_configure() {
 		fi
 	fi
 
-	has "${EAPI:-0}" 0 1 2 && ! use prefix && local EPREFIX=
+	[[ ${EAPI} == 2 ]] && ! use prefix && local EPREFIX=
 
 	if [[ ${EPREFIX} ]]; then
 		cat >> "${build_rules}" <<- _EOF_ || die
@@ -604,7 +604,7 @@ enable_cmake-utils_src_configure() {
 	local mycmakeargstype=$(declare -p mycmakeargs 2>&-)
 	if [[ "${mycmakeargstype}" != "declare -a mycmakeargs="* ]]; then
 		if [[ -n "${mycmakeargstype}" ]] ; then
-			if has "${EAPI:-0}" 2 3 4 5 ; then
+			if [[ ${EAPI} != [2345] ]]; then
 				eqawarn "Declaring mycmakeargs as a variable is deprecated. Please use an array instead."
 			else
 				die "Declaring mycmakeargs as a variable is banned in EAPI=${EAPI}. Please use an array instead."
-- 
2.7.0



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

* [gentoo-dev] [PATCH 2/3] cmake-utils.eclass: Drop empty line
  2016-01-25 20:29 [gentoo-dev] [PATCH 0/3] RFC: cmake-utils.eclass minor updates Justin Lecher
  2016-01-25 20:29 ` [gentoo-dev] [PATCH 1/3] cmake-utils.eclass: Use bash internal testing instead of has() Justin Lecher
@ 2016-01-25 20:29 ` Justin Lecher
  2016-01-25 20:29 ` [gentoo-dev] [PATCH 3/3] cmake-utils.eclass: Define default EAPI to 0 Justin Lecher
  2 siblings, 0 replies; 8+ messages in thread
From: Justin Lecher @ 2016-01-25 20:29 UTC (permalink / raw
  To: gentoo-dev; +Cc: kde, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/cmake-utils.eclass | 1 -
 1 file changed, 1 deletion(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index fb7f5ca..01de9a5 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -20,7 +20,6 @@
 if [[ -z ${_CMAKE_UTILS_ECLASS} ]]; then
 _CMAKE_UTILS_ECLASS=1
 
-
 # @ECLASS-VARIABLE: BUILD_DIR
 # @DESCRIPTION:
 # Build directory where all cmake processed files should be generated.
-- 
2.7.0



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

* [gentoo-dev] [PATCH 3/3] cmake-utils.eclass: Define default EAPI to 0
  2016-01-25 20:29 [gentoo-dev] [PATCH 0/3] RFC: cmake-utils.eclass minor updates Justin Lecher
  2016-01-25 20:29 ` [gentoo-dev] [PATCH 1/3] cmake-utils.eclass: Use bash internal testing instead of has() Justin Lecher
  2016-01-25 20:29 ` [gentoo-dev] [PATCH 2/3] cmake-utils.eclass: Drop empty line Justin Lecher
@ 2016-01-25 20:29 ` Justin Lecher
  2016-01-26 12:36   ` Davide Pesavento
  2 siblings, 1 reply; 8+ messages in thread
From: Justin Lecher @ 2016-01-25 20:29 UTC (permalink / raw
  To: gentoo-dev; +Cc: kde, Justin Lecher

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 eclass/cmake-utils.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 01de9a5..23339ab 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -112,7 +112,7 @@ _CMAKE_UTILS_ECLASS=1
 # for econf and is needed to pass TRY_RUN results when cross-compiling.
 # Should be set by user in a per-package basis in /etc/portage/package.env.
 
-case ${EAPI} in
+case ${EAPI:-0} in
 	2|3|4|5|6) : ;;
 	*) die "EAPI=${EAPI:-0} is not supported" ;;
 esac
-- 
2.7.0



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

* Re: [gentoo-dev] [PATCH 3/3] cmake-utils.eclass: Define default EAPI to 0
  2016-01-25 20:29 ` [gentoo-dev] [PATCH 3/3] cmake-utils.eclass: Define default EAPI to 0 Justin Lecher
@ 2016-01-26 12:36   ` Davide Pesavento
  2016-01-26 12:50     ` Michał Górny
  0 siblings, 1 reply; 8+ messages in thread
From: Davide Pesavento @ 2016-01-26 12:36 UTC (permalink / raw
  To: gentoo-dev; +Cc: kde, Justin Lecher

On Mon, Jan 25, 2016 at 9:29 PM, Justin Lecher <jlec@gentoo.org> wrote:
> Signed-off-by: Justin Lecher <jlec@gentoo.org>
> ---
>  eclass/cmake-utils.eclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
> index 01de9a5..23339ab 100644
> --- a/eclass/cmake-utils.eclass
> +++ b/eclass/cmake-utils.eclass
> @@ -112,7 +112,7 @@ _CMAKE_UTILS_ECLASS=1
>  # for econf and is needed to pass TRY_RUN results when cross-compiling.
>  # Should be set by user in a per-package basis in /etc/portage/package.env.
>
> -case ${EAPI} in
> +case ${EAPI:-0} in
>         2|3|4|5|6) : ;;
>         *) die "EAPI=${EAPI:-0} is not supported" ;;
>  esac
> --
> 2.7.0
>

Why?


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

* Re: [gentoo-dev] [PATCH 3/3] cmake-utils.eclass: Define default EAPI to 0
  2016-01-26 12:36   ` Davide Pesavento
@ 2016-01-26 12:50     ` Michał Górny
  2016-01-26 14:10       ` Davide Pesavento
  0 siblings, 1 reply; 8+ messages in thread
From: Michał Górny @ 2016-01-26 12:50 UTC (permalink / raw
  To: gentoo-dev, Davide Pesavento; +Cc: kde, Justin Lecher

Dnia 26 stycznia 2016 13:36:00 CET, Davide Pesavento <pesa@gentoo.org> napisał(a):
>On Mon, Jan 25, 2016 at 9:29 PM, Justin Lecher <jlec@gentoo.org> wrote:
>> Signed-off-by: Justin Lecher <jlec@gentoo.org>
>> ---
>>  eclass/cmake-utils.eclass | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
>> index 01de9a5..23339ab 100644
>> --- a/eclass/cmake-utils.eclass
>> +++ b/eclass/cmake-utils.eclass
>> @@ -112,7 +112,7 @@ _CMAKE_UTILS_ECLASS=1
>>  # for econf and is needed to pass TRY_RUN results when
>cross-compiling.
>>  # Should be set by user in a per-package basis in
>/etc/portage/package.env.
>>
>> -case ${EAPI} in
>> +case ${EAPI:-0} in
>>         2|3|4|5|6) : ;;
>>         *) die "EAPI=${EAPI:-0} is not supported" ;;
>>  esac
>> --
>> 2.7.0
>>
>
>Why?

Indeed, why? I think it would be cleaner to simply quote the parameter to case.


-- 
Best regards,
Michał Górny (by phone)


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

* Re: [gentoo-dev] [PATCH 3/3] cmake-utils.eclass: Define default EAPI to 0
  2016-01-26 12:50     ` Michał Górny
@ 2016-01-26 14:10       ` Davide Pesavento
  2016-01-26 14:25         ` Justin Lecher (jlec)
  0 siblings, 1 reply; 8+ messages in thread
From: Davide Pesavento @ 2016-01-26 14:10 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-dev, kde, Justin Lecher

On Tue, Jan 26, 2016 at 1:50 PM, Michał Górny <mgorny@gentoo.org> wrote:
> Dnia 26 stycznia 2016 13:36:00 CET, Davide Pesavento <pesa@gentoo.org> napisał(a):
>>On Mon, Jan 25, 2016 at 9:29 PM, Justin Lecher <jlec@gentoo.org> wrote:
>>> Signed-off-by: Justin Lecher <jlec@gentoo.org>
>>> ---
>>>  eclass/cmake-utils.eclass | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
>>> index 01de9a5..23339ab 100644
>>> --- a/eclass/cmake-utils.eclass
>>> +++ b/eclass/cmake-utils.eclass
>>> @@ -112,7 +112,7 @@ _CMAKE_UTILS_ECLASS=1
>>>  # for econf and is needed to pass TRY_RUN results when
>>cross-compiling.
>>>  # Should be set by user in a per-package basis in
>>/etc/portage/package.env.
>>>
>>> -case ${EAPI} in
>>> +case ${EAPI:-0} in
>>>         2|3|4|5|6) : ;;
>>>         *) die "EAPI=${EAPI:-0} is not supported" ;;
>>>  esac
>>> --
>>> 2.7.0
>>>
>>
>>Why?
>
> Indeed, why? I think it would be cleaner to simply quote the parameter to case.
>

AFAIK even quoting would be unnecessary in this context (assuming bash).


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

* Re: [gentoo-dev] [PATCH 3/3] cmake-utils.eclass: Define default EAPI to 0
  2016-01-26 14:10       ` Davide Pesavento
@ 2016-01-26 14:25         ` Justin Lecher (jlec)
  0 siblings, 0 replies; 8+ messages in thread
From: Justin Lecher (jlec) @ 2016-01-26 14:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: kde

On 26/01/16 15:10, Davide Pesavento wrote:
> On Tue, Jan 26, 2016 at 1:50 PM, Michał Górny <mgorny@gentoo.org> wrote:
>> Dnia 26 stycznia 2016 13:36:00 CET, Davide Pesavento <pesa@gentoo.org> napisał(a):
>>> On Mon, Jan 25, 2016 at 9:29 PM, Justin Lecher <jlec@gentoo.org> wrote:
>>>> Signed-off-by: Justin Lecher <jlec@gentoo.org>
>>>> ---
>>>>  eclass/cmake-utils.eclass | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
>>>> index 01de9a5..23339ab 100644
>>>> --- a/eclass/cmake-utils.eclass
>>>> +++ b/eclass/cmake-utils.eclass
>>>> @@ -112,7 +112,7 @@ _CMAKE_UTILS_ECLASS=1
>>>>  # for econf and is needed to pass TRY_RUN results when
>>> cross-compiling.
>>>>  # Should be set by user in a per-package basis in
>>> /etc/portage/package.env.
>>>>
>>>> -case ${EAPI} in
>>>> +case ${EAPI:-0} in
>>>>         2|3|4|5|6) : ;;
>>>>         *) die "EAPI=${EAPI:-0} is not supported" ;;
>>>>  esac
>>>> --
>>>> 2.7.0
>>>>
>>>
>>> Why?
>>
>> Indeed, why? I think it would be cleaner to simply quote the parameter to case.
>>
> 
> AFAIK even quoting would be unnecessary in this context (assuming bash).
> 

Guys, if you are sure, that it is enough, then I will drop it. I just
thought there has to be something. But I tested it and it's unnecessary.
At least with latest bash.

Justin


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

end of thread, other threads:[~2016-01-26 14:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 20:29 [gentoo-dev] [PATCH 0/3] RFC: cmake-utils.eclass minor updates Justin Lecher
2016-01-25 20:29 ` [gentoo-dev] [PATCH 1/3] cmake-utils.eclass: Use bash internal testing instead of has() Justin Lecher
2016-01-25 20:29 ` [gentoo-dev] [PATCH 2/3] cmake-utils.eclass: Drop empty line Justin Lecher
2016-01-25 20:29 ` [gentoo-dev] [PATCH 3/3] cmake-utils.eclass: Define default EAPI to 0 Justin Lecher
2016-01-26 12:36   ` Davide Pesavento
2016-01-26 12:50     ` Michał Górny
2016-01-26 14:10       ` Davide Pesavento
2016-01-26 14:25         ` Justin Lecher (jlec)

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