public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY
@ 2023-03-29 15:39 Sam James
  2023-03-29 15:39 ` [gentoo-dev] [PATCH 2/3] ruby-ng.eclass: don't quote IUSE in has test Sam James
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sam James @ 2023-03-29 15:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

This means we don't get confusing *DEPEND/REQUIRED_USE errors about it being
unparseable and instead just get a straightforward die message indicating
the problem.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index c273a431c5b1..b81038237a6b 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -103,16 +103,21 @@ ruby_implementation_depend() {
 # Return a list of valid implementations in USE_RUBY, skipping the old
 # implementations that are no longer supported.
 _ruby_get_all_impls() {
-	local i
+	local i found_valid_impl
 	for i in ${USE_RUBY}; do
 		case ${i} in
 			# removed implementations
 			ruby19|ruby20|ruby21|ruby22|ruby23|ruby24|ruby25|ruby26|jruby)
 				;;
 			*)
+				found_valid_impl=1
 				echo ${i};;
 		esac
 	done
+
+	if [[ -z ${found_valid_impl} ]] ; then
+		die "No supported implementation in USE_RUBY."
+	fi
 }
 
 # @FUNCTION: ruby_samelib
-- 
2.40.0



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

* [gentoo-dev] [PATCH 2/3] ruby-ng.eclass: don't quote IUSE in has test
  2023-03-29 15:39 [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY Sam James
@ 2023-03-29 15:39 ` Sam James
  2023-03-29 15:39 ` [gentoo-dev] [PATCH 3/3] ruby-fakegem.eclass: don't double-add USE=doc/test Sam James
  2023-03-31  9:28 ` [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY Hans de Graaff
  2 siblings, 0 replies; 6+ messages in thread
From: Sam James @ 2023-03-29 15:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

I was looking at the generated metadata for nokogiri and noticed several
instances of 'test' in IUSE & RESTRICT. Ended up finding that the quoting
of 'IUSE' in has is wrong here.

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-ng.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass
index b81038237a6b..b63dd19e18f2 100644
--- a/eclass/ruby-ng.eclass
+++ b/eclass/ruby-ng.eclass
@@ -234,7 +234,7 @@ ruby_add_rdepend() {
 		6) DEPEND="${DEPEND} test? ( ${dependency} )" ;;
 		*) BDEPEND="${BDEPEND} test? ( ${dependency} )" ;;
 	esac
-	if ! has test "$IUSE"; then
+	if ! has test ${IUSE}; then
 		IUSE+=" test"
 		RESTRICT+=" !test? ( test )"
 	fi
-- 
2.40.0



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

* [gentoo-dev] [PATCH 3/3] ruby-fakegem.eclass: don't double-add USE=doc/test
  2023-03-29 15:39 [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY Sam James
  2023-03-29 15:39 ` [gentoo-dev] [PATCH 2/3] ruby-ng.eclass: don't quote IUSE in has test Sam James
@ 2023-03-29 15:39 ` Sam James
  2023-03-29 15:49   ` Petr Vaněk
  2023-03-31  9:28 ` [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY Hans de Graaff
  2 siblings, 1 reply; 6+ messages in thread
From: Sam James @ 2023-03-29 15:39 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-fakegem.eclass | 42 ++++++++++++++++++++++++++------------
 1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
index b3262dc5cdb4..9af96bec319f 100644
--- a/eclass/ruby-fakegem.eclass
+++ b/eclass/ruby-fakegem.eclass
@@ -150,17 +150,23 @@ RUBY_FAKEGEM_SUFFIX="${RUBY_FAKEGEM_SUFFIX:-}"
 
 case ${RUBY_FAKEGEM_RECIPE_DOC} in
 	rake)
-		IUSE+=" doc"
+		if ! has doc ${IUSE} ; then
+			IUSE+=" docc"
+		fi
 		ruby_add_bdepend "doc? ( dev-ruby/rake )"
 		RUBY_FAKEGEM_DOCDIR="doc"
 		;;
 	rdoc)
-		IUSE+=" doc"
+		if ! has doc ${IUSE} ; then
+			IUSE+=" doc"
+		fi
 		ruby_add_bdepend "doc? ( dev-ruby/rdoc )"
 		RUBY_FAKEGEM_DOCDIR="doc"
 		;;
 	yard)
-		IUSE+="doc"
+		if ! has doc ${IUSE} ; then
+			IUSE+="doc"
+		fi
 		ruby_add_bdepend "doc? ( dev-ruby/yard )"
 		RUBY_FAKEGEM_DOCDIR="doc"
 		;;
@@ -173,30 +179,40 @@ esac
 
 case ${RUBY_FAKEGEM_RECIPE_TEST} in
 	rake)
-		IUSE+=" test"
-		RESTRICT+=" !test? ( test )"
+		if ! has test ${IUSE} ; then
+			IUSE+=" test"
+			RESTRICT+=" !test? ( test )"
+		fi
 		ruby_add_bdepend "test? ( dev-ruby/rake )"
 		;;
 	rspec)
-		IUSE+=" test"
-		RESTRICT+=" !test? ( test )"
+		if ! has test ${IUSE} ; then
+			IUSE+=" test"
+			RESTRICT+=" !test? ( test )"
+		fi
 		# Also require a new enough rspec-core version that installs the
 		# rspec-2 wrapper.
 		ruby_add_bdepend "test? ( dev-ruby/rspec:2 >=dev-ruby/rspec-core-2.14.8-r2 )"
 		;;
 	rspec3)
-		IUSE+=" test"
-		RESTRICT+=" !test? ( test )"
+		if ! has test ${IUSE} ; then
+			IUSE+=" test"
+			RESTRICT+=" !test? ( test )"
+		fi
 		ruby_add_bdepend "test? ( dev-ruby/rspec:3 )"
 		;;
 	cucumber)
-		IUSE+=" test"
-		RESTRICT+=" !test? ( test )"
+                if ! has test ${IUSE} ; then
+			IUSE+=" test"
+			RESTRICT+=" !test? ( test )"
+                fi
 		ruby_add_bdepend "test? ( dev-util/cucumber )"
 		;;
 	sus)
-		IUSE+=" test"
-		RESTRICT+=" !test? ( test )"
+		if ! has test ${IUSE} ; then
+			IUSE+=" test"
+			RESTRICT+=" !test? ( test )"
+		fi
 		ruby_add_bdepend "test? ( dev-ruby/sus )"
 		;;
 	none)
-- 
2.40.0



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

* Re: [gentoo-dev] [PATCH 3/3] ruby-fakegem.eclass: don't double-add USE=doc/test
  2023-03-29 15:39 ` [gentoo-dev] [PATCH 3/3] ruby-fakegem.eclass: don't double-add USE=doc/test Sam James
@ 2023-03-29 15:49   ` Petr Vaněk
  0 siblings, 0 replies; 6+ messages in thread
From: Petr Vaněk @ 2023-03-29 15:49 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

On Wed, Mar 29, 2023 at 04:39:34PM +0100, Sam James wrote:
> Signed-off-by: Sam James <sam@gentoo.org>
> ---
>  eclass/ruby-fakegem.eclass | 42 ++++++++++++++++++++++++++------------
>  1 file changed, 29 insertions(+), 13 deletions(-)
> 
> diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
> index b3262dc5cdb4..9af96bec319f 100644
> --- a/eclass/ruby-fakegem.eclass
> +++ b/eclass/ruby-fakegem.eclass
> @@ -150,17 +150,23 @@ RUBY_FAKEGEM_SUFFIX="${RUBY_FAKEGEM_SUFFIX:-}"
>  
>  case ${RUBY_FAKEGEM_RECIPE_DOC} in
>  	rake)
> -		IUSE+=" doc"
> +		if ! has doc ${IUSE} ; then
> +			IUSE+=" docc"

typo, double c, docc -> doc

> +		fi
>  		ruby_add_bdepend "doc? ( dev-ruby/rake )"
>  		RUBY_FAKEGEM_DOCDIR="doc"
>  		;;
>  	rdoc)
> -		IUSE+=" doc"
> +		if ! has doc ${IUSE} ; then
> +			IUSE+=" doc"
> +		fi
>  		ruby_add_bdepend "doc? ( dev-ruby/rdoc )"
>  		RUBY_FAKEGEM_DOCDIR="doc"
>  		;;
>  	yard)
> -		IUSE+="doc"
> +		if ! has doc ${IUSE} ; then
> +			IUSE+="doc"
> +		fi
>  		ruby_add_bdepend "doc? ( dev-ruby/yard )"
>  		RUBY_FAKEGEM_DOCDIR="doc"
>  		;;
> @@ -173,30 +179,40 @@ esac
>  
>  case ${RUBY_FAKEGEM_RECIPE_TEST} in
>  	rake)
> -		IUSE+=" test"
> -		RESTRICT+=" !test? ( test )"
> +		if ! has test ${IUSE} ; then
> +			IUSE+=" test"
> +			RESTRICT+=" !test? ( test )"
> +		fi
>  		ruby_add_bdepend "test? ( dev-ruby/rake )"
>  		;;
>  	rspec)
> -		IUSE+=" test"
> -		RESTRICT+=" !test? ( test )"
> +		if ! has test ${IUSE} ; then
> +			IUSE+=" test"
> +			RESTRICT+=" !test? ( test )"
> +		fi
>  		# Also require a new enough rspec-core version that installs the
>  		# rspec-2 wrapper.
>  		ruby_add_bdepend "test? ( dev-ruby/rspec:2 >=dev-ruby/rspec-core-2.14.8-r2 )"
>  		;;
>  	rspec3)
> -		IUSE+=" test"
> -		RESTRICT+=" !test? ( test )"
> +		if ! has test ${IUSE} ; then
> +			IUSE+=" test"
> +			RESTRICT+=" !test? ( test )"
> +		fi
>  		ruby_add_bdepend "test? ( dev-ruby/rspec:3 )"
>  		;;
>  	cucumber)
> -		IUSE+=" test"
> -		RESTRICT+=" !test? ( test )"
> +                if ! has test ${IUSE} ; then
> +			IUSE+=" test"
> +			RESTRICT+=" !test? ( test )"
> +                fi
>  		ruby_add_bdepend "test? ( dev-util/cucumber )"
>  		;;
>  	sus)
> -		IUSE+=" test"
> -		RESTRICT+=" !test? ( test )"
> +		if ! has test ${IUSE} ; then
> +			IUSE+=" test"
> +			RESTRICT+=" !test? ( test )"
> +		fi
>  		ruby_add_bdepend "test? ( dev-ruby/sus )"
>  		;;
>  	none)
> -- 
> 2.40.0
> 
> 


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

* Re: [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY
  2023-03-29 15:39 [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY Sam James
  2023-03-29 15:39 ` [gentoo-dev] [PATCH 2/3] ruby-ng.eclass: don't quote IUSE in has test Sam James
  2023-03-29 15:39 ` [gentoo-dev] [PATCH 3/3] ruby-fakegem.eclass: don't double-add USE=doc/test Sam James
@ 2023-03-31  9:28 ` Hans de Graaff
  2023-03-31 20:27   ` Sam James
  2 siblings, 1 reply; 6+ messages in thread
From: Hans de Graaff @ 2023-03-31  9:28 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

On Wed, 2023-03-29 at 16:39 +0100, Sam James wrote:
> This means we don't get confusing *DEPEND/REQUIRED_USE errors about
> it being
> unparseable and instead just get a straightforward die message
> indicating
> the problem.


All three patches look good to me.

Hans

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY
  2023-03-31  9:28 ` [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY Hans de Graaff
@ 2023-03-31 20:27   ` Sam James
  0 siblings, 0 replies; 6+ messages in thread
From: Sam James @ 2023-03-31 20:27 UTC (permalink / raw
  To: gentoo-dev; +Cc: Hans de Graaff

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]


Hans de Graaff <graaff@gentoo.org> writes:

> [[PGP Signed Part:Undecided]]
> On Wed, 2023-03-29 at 16:39 +0100, Sam James wrote:
>> This means we don't get confusing *DEPEND/REQUIRED_USE errors about
>> it being
>> unparseable and instead just get a straightforward die message
>> indicating
>> the problem.
>
>
> All three patches look good to me.

Thanks! I'm going to rework the IUSE test stuff based on the feedback
as it's apparently fragile to do at all.

>
> Hans
>
> [[End of PGP Signed Part]]


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 377 bytes --]

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

end of thread, other threads:[~2023-03-31 20:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-29 15:39 [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY Sam James
2023-03-29 15:39 ` [gentoo-dev] [PATCH 2/3] ruby-ng.eclass: don't quote IUSE in has test Sam James
2023-03-29 15:39 ` [gentoo-dev] [PATCH 3/3] ruby-fakegem.eclass: don't double-add USE=doc/test Sam James
2023-03-29 15:49   ` Petr Vaněk
2023-03-31  9:28 ` [gentoo-dev] [PATCH 1/3] ruby-ng.eclass: improve error when no valid Ruby in USE_RUBY Hans de Graaff
2023-03-31 20:27   ` Sam James

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