public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] ruby-utils.eclass: Simplify _ruby_implementation_depend
@ 2023-07-14  8:34 Sam James
  2023-07-14  8:37 ` [gentoo-dev] " Sam James
  0 siblings, 1 reply; 4+ messages in thread
From: Sam James @ 2023-07-14  8:34 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, konsolebox, Sam James

From: konsolebox <konsolebox@gmail.com>

Closes: https://bugs.gentoo.org/909529
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-utils.eclass | 52 ++--------------------------------------
 1 file changed, 2 insertions(+), 50 deletions(-)

diff --git a/eclass/ruby-utils.eclass b/eclass/ruby-utils.eclass
index c4b6f1502f8a9..8a2b7720c951a 100644
--- a/eclass/ruby-utils.eclass
+++ b/eclass/ruby-utils.eclass
@@ -44,57 +44,9 @@ _ruby_implementation_depend() {
 	local rubyslot=
 
 	case $1 in
-		ruby18)
+		ruby1[89]|ruby2[0-7]|ruby3[0-2])
 			rubypn="dev-lang/ruby"
-			rubyslot=":1.8"
-			;;
-		ruby19)
-			rubypn="dev-lang/ruby"
-			rubyslot=":1.9"
-			;;
-		ruby20)
-			rubypn="dev-lang/ruby"
-			rubyslot=":2.0"
-			;;
-		ruby21)
-			rubypn="dev-lang/ruby"
-			rubyslot=":2.1"
-			;;
-		ruby22)
-			rubypn="dev-lang/ruby"
-			rubyslot=":2.2"
-			;;
-		ruby23)
-			rubypn="dev-lang/ruby"
-			rubyslot=":2.3"
-			;;
-		ruby24)
-			rubypn="dev-lang/ruby"
-			rubyslot=":2.4"
-			;;
-		ruby25)
-			rubypn="dev-lang/ruby"
-			rubyslot=":2.5"
-			;;
-		ruby26)
-			rubypn="dev-lang/ruby"
-			rubyslot=":2.6"
-			;;
-		ruby27)
-			rubypn="dev-lang/ruby"
-			rubyslot=":2.7"
-			;;
-		ruby30)
-			rubypn="dev-lang/ruby"
-			rubyslot=":3.0"
-			;;
-		ruby31)
-			rubypn="dev-lang/ruby"
-			rubyslot=":3.1"
-			;;
-		ruby32)
-			rubypn="dev-lang/ruby"
-			rubyslot=":3.2"
+			rubyslot=":${1:4:1}.${1:5}"
 			;;
 		ree18)
 			rubypn="dev-lang/ruby-enterprise"
-- 
2.41.0



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

* [gentoo-dev] Re: [PATCH] ruby-utils.eclass: Simplify _ruby_implementation_depend
  2023-07-14  8:34 [gentoo-dev] [PATCH] ruby-utils.eclass: Simplify _ruby_implementation_depend Sam James
@ 2023-07-14  8:37 ` Sam James
  2023-07-14 16:16   ` Hans de Graaff
  2023-07-14 16:19   ` Arthur Zamarin
  0 siblings, 2 replies; 4+ messages in thread
From: Sam James @ 2023-07-14  8:37 UTC (permalink / raw
  To: Sam James; +Cc: gentoo-dev, ruby, konsolebox

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


Sam James <sam@gentoo.org> writes:

> From: konsolebox <konsolebox@gmail.com>
>
> Closes: https://bugs.gentoo.org/909529
> Signed-off-by: Sam James <sam@gentoo.org>

ftr, while I find the case really repetitive, I'm not sure if this
crosses the line into unreadable bash or not, so I feel on the fence.

But I wanted it reviewed on ML in any case, rather than us forgetting
it on BZ.


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

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

* Re: [gentoo-dev] Re: [PATCH] ruby-utils.eclass: Simplify _ruby_implementation_depend
  2023-07-14  8:37 ` [gentoo-dev] " Sam James
@ 2023-07-14 16:16   ` Hans de Graaff
  2023-07-14 16:19   ` Arthur Zamarin
  1 sibling, 0 replies; 4+ messages in thread
From: Hans de Graaff @ 2023-07-14 16:16 UTC (permalink / raw
  To: gentoo-dev

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

On Thu, 1970-01-01 at 00:00 +0000, Sam James wrote:
> 
> Sam James <sam@gentoo.org> writes:
> 
> > From: konsolebox <konsolebox@gmail.com>
> > 
> > Closes: https://bugs.gentoo.org/909529
> > Signed-off-by: Sam James <sam@gentoo.org>
> 
> ftr, while I find the case really repetitive, I'm not sure if this
> crosses the line into unreadable bash or not, so I feel on the fence.

I don't have a strong preference either way. We only need to change
this once a year anyway.

Perhaps not having the large case statement makes the whole file a bit
more readable at the expense of a more difficult expression.

Hans

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

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

* Re: [gentoo-dev] Re: [PATCH] ruby-utils.eclass: Simplify _ruby_implementation_depend
  2023-07-14  8:37 ` [gentoo-dev] " Sam James
  2023-07-14 16:16   ` Hans de Graaff
@ 2023-07-14 16:19   ` Arthur Zamarin
  1 sibling, 0 replies; 4+ messages in thread
From: Arthur Zamarin @ 2023-07-14 16:19 UTC (permalink / raw
  To: gentoo-dev, Sam James


[-- Attachment #1.1: Type: text/plain, Size: 887 bytes --]

On 14/07/2023 11.37, Sam James wrote:
> 
> Sam James <sam@gentoo.org> writes:
> 
>> From: konsolebox <konsolebox@gmail.com>
>>
>> Closes: https://bugs.gentoo.org/909529
>> Signed-off-by: Sam James <sam@gentoo.org>
> 
> ftr, while I find the case really repetitive, I'm not sure if this
> crosses the line into unreadable bash or not, so I feel on the fence.
> 
> But I wanted it reviewed on ML in any case, rather than us forgetting
> it on BZ.
> 

I agree the code isn't easy to read, but it isn't too hard. I do want to
suggest you add a simple comment on the same line bringing an example
value for the rubyslot. With an example comment, it becomes trivial to
understand (and if someone needs to change it, he know beforehand what
format to expect).

-- 
Arthur Zamarin
arthurzam@gentoo.org
Gentoo Linux developer (Python, pkgcore stack, Arch Teams, GURU)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2023-07-14 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-14  8:34 [gentoo-dev] [PATCH] ruby-utils.eclass: Simplify _ruby_implementation_depend Sam James
2023-07-14  8:37 ` [gentoo-dev] " Sam James
2023-07-14 16:16   ` Hans de Graaff
2023-07-14 16:19   ` Arthur Zamarin

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