• [gentoo-dev] [PATCH] ruby-single.eclass: depend on virtual/rubygems[rub

    From Sam James@21:1/5 to All on Tue Apr 4 02:10:01 2023
    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} )"
    }

    _rub
  • From Hans de Graaff@21:1/5 to Sam James on Sat Apr 8 12:40:01 2023
    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

    -----BEGIN PGP SIGNATURE-----

    iQEzBAABCAAdFiEEIggVRmJzp0YePtgn2zR/k4ZU+jQFAmQxQoYACgkQ2zR/k4ZU +jTBAAgAsEE8OUglCwap6ix4OSIrxbgdSUuzOY7xpJb7vffTMzP3jidp4GYQ0BMD qDJZhsFzSgppwIRdNLq/ob5aHht5feTVDLjYaa+7QPjmr8VyneeMV3DNZL1hAbEt ft5MXk6aTKd8Nuh8BtwO7UPg5oPpGTDsPoKY8qbOapB2SYcVNpX7UDAdeLvbz8OF QHSOaCnrQIOm0K7cA3jRHwNC33qgaaKt+qGTQyihCZqXYVFhkU8fUMNllhGb0eD7 FbvJtl3hWmxfM3yY4Us9Ismv6kdB8pXmeJ0utatDUpK9D6iNc76PER0jmFEgFzxq 09cmsGUT1VrbOgN0TftXhDLeIyirwQ==
    =d7m1
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam James@21:1/5 to Hans de Graaff on Sat Apr 8 23:50:01 2023
    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]]


    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iOUEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZDHfq18UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv by5vcmcACgkQc4QJ9SDfkZBvVgD9EnBcI/GRXeGi+GbtjK9Tv4DuD7LqmeyXJOMh PebfMEsA/AxQdA8QPQpAvtRD/SmqodTM/BfEgm1OOck6LQSNl9IH
    !VD
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)