public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] ruby-single.eclass: depend on virtual/rubygems[ruby_targets_rubyNN(-)] for each impl
@ 2023-04-04  0:02 Sam James
  2023-04-08 10:31 ` Hans de Graaff
  0 siblings, 1 reply; 3+ messages in thread
From: Sam James @ 2023-04-04  0:02 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby, Sam James

Noticed when looking at bug 771744 which seems hard to trigger deliberately -
the webkit-gtk ebuild already tries to check the chosen Ruby has rubygems available.

Anyway, when looking at that, I noticed it's possible for Portage to queue
the following, even if it's not what's happening in this case:
- dev-lang/ruby:2.7 is already installed
- virtual/rubygems[ruby_targets_ruby27] is already installed (PDEPEND of ruby)
and then, in a fresh emerge:
- dev-lang/ruby:3.0 is installed
- app-misc/foo (with only USE_RUBY="ruby30") using ruby-single.eclass is queued
  and fails because the installed Ruby isn't fully usable yet, because
  the eclass only guarantees dev-lang/ruby:3.0 and virtual/rubygems is installed,
  not necessarily rubygems for that interpreter.
- virtual/rubygems[ruby_targets_ruby30] is built (PDEPEND of ruby)

This isn't a subsittute for a ruby-any.eclass and/or a pkg_setup which helps
enforcement, but that's another thing to handle.

Followup to d078ec2a151d16b7ed045f1889bb5b97c4b9e6af ("Add virtual/rubygems to dependencies[...]").

Bug: https://bugs.gentoo.org/771744
Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/ruby-single.eclass | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/eclass/ruby-single.eclass b/eclass/ruby-single.eclass
index 035675c4810a0..5f6cf9e46dcee 100644
--- a/eclass/ruby-single.eclass
+++ b/eclass/ruby-single.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: ruby-single.eclass
@@ -72,10 +72,13 @@ _ruby_single_implementations_depend() {
 	local depend
 	for _ruby_implementation in ${RUBY_TARGETS_PREFERENCE}; do
 		if [[ ${USE_RUBY} =~ ${_ruby_implementation} ]]; then
-			depend="${depend} $(_ruby_implementation_depend $_ruby_implementation)"
+			depend+=" ("
+			depend+=" $(_ruby_implementation_depend $_ruby_implementation)"
+			depend+=" virtual/rubygems[ruby_targets_${_ruby_implementation}(-)]"
+			depend+=" )"
 		fi
 	done
-	echo "|| ( ${depend} ) virtual/rubygems"
+	echo "|| ( ${depend} )"
 }
 
 _ruby_single_set_globals() {
-- 
2.40.0



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

* Re: [gentoo-dev] [PATCH] ruby-single.eclass: depend on virtual/rubygems[ruby_targets_rubyNN(-)] for each impl
  2023-04-04  0:02 [gentoo-dev] [PATCH] ruby-single.eclass: depend on virtual/rubygems[ruby_targets_rubyNN(-)] for each impl Sam James
@ 2023-04-08 10:31 ` Hans de Graaff
  2023-04-08 21:41   ` Sam James
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Graaff @ 2023-04-08 10:31 UTC (permalink / raw
  To: gentoo-dev

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

On Tue, 2023-04-04 at 01:02 +0100, Sam James wrote:
> 
> - app-misc/foo (with only USE_RUBY="ruby30") using ruby-single.eclass
> is queued
>   and fails because the installed Ruby isn't fully usable yet,
> because
>   the eclass only guarantees dev-lang/ruby:3.0 and virtual/rubygems
> is installed,
>   not necessarily rubygems for that interpreter.

lgtm, we do the same thing for ruby-fakegem.eclass. There could still
be issues with other PDEPENDs from dev-lang/ruby, perhaps we need to
make a virtual/ruby that includes all the PDEPENDs as well as dev-
lang/ruby and virtual/rubygems, and depend on that in cases where we
need "a working ruby implementation" ?

Hans

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

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

* Re: [gentoo-dev] [PATCH] ruby-single.eclass: depend on virtual/rubygems[ruby_targets_rubyNN(-)] for each impl
  2023-04-08 10:31 ` Hans de Graaff
@ 2023-04-08 21:41   ` Sam James
  0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2023-04-08 21:41 UTC (permalink / raw
  To: gentoo-dev

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


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

> [[PGP Signed Part:Undecided]]
> On Tue, 2023-04-04 at 01:02 +0100, Sam James wrote:
>> 
>> - app-misc/foo (with only USE_RUBY="ruby30") using ruby-single.eclass
>> is queued
>>   and fails because the installed Ruby isn't fully usable yet,
>> because
>>   the eclass only guarantees dev-lang/ruby:3.0 and virtual/rubygems
>> is installed,
>>   not necessarily rubygems for that interpreter.
>
> lgtm, we do the same thing for ruby-fakegem.eclass. There could still
> be issues with other PDEPENDs from dev-lang/ruby, perhaps we need to
> make a virtual/ruby that includes all the PDEPENDs as well as dev-
> lang/ruby and virtual/rubygems, and depend on that in cases where we
> need "a working ruby implementation" ?

Good idea - that should simplify things a lot for other consumers too.

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


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

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

end of thread, other threads:[~2023-04-08 21:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-04  0:02 [gentoo-dev] [PATCH] ruby-single.eclass: depend on virtual/rubygems[ruby_targets_rubyNN(-)] for each impl Sam James
2023-04-08 10:31 ` Hans de Graaff
2023-04-08 21:41   ` Sam James

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