commit:     711ab5dcbb20007552471868517ad3548e97f72c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 10 09:00:55 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 10 09:03:22 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=711ab5dc

dev-ruby/racc: run rake for a valid Ruby

This is a hack but given racc is needed by Ruby itself, our eselect
stuff won't have had a chance to run yet (like it does when an old
Ruby slot gets depcleaned). So, go with it to avoid breaking upgrades
during the transition :(

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-ruby/racc/racc-1.6.2.ebuild | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/dev-ruby/racc/racc-1.6.2.ebuild b/dev-ruby/racc/racc-1.6.2.ebuild
index ecf5e73559a8..a568aa1d0569 100644
--- a/dev-ruby/racc/racc-1.6.2.ebuild
+++ b/dev-ruby/racc/racc-1.6.2.ebuild
@@ -36,10 +36,18 @@ all_ruby_prepare() {
 
        # Avoid depending on rake-compiler since we don't use it to compile
        # the extension.
-       sed -i -e '/rake-compiler/ s:^:#:' -e '/extensiontask/ s:^:#:' Rakefile
-       sed -i -e '/ExtensionTask/,/^  end/ s:^:#:' Rakefile
-       # Which means we need to generate the parser file here
-       rake lib/racc/parser-text.rb || die
+       sed -i -e '/rake-compiler/ s:^:#:' -e '/extensiontask/ s:^:#:' Rakefile 
|| die
+       sed -i -e '/ExtensionTask/,/^  end/ s:^:#:' Rakefile || die
+
+       # ...which means we need to generate the parser file here
+       for ruby in ${USE_RUBY} ; do
+               if use ruby_targets_${ruby} ; then
+                       if has_version -b 
"virtual/rubygems[ruby_targets_${ruby}(-)]" && has_version -b 
"dev-ruby/rake[ruby_targets_${ruby}(-)]" ; then
+                               ${ruby} -S rake lib/racc/parser-text.rb || die
+                               break
+                       fi
+               fi
+       done
 
        sed -i -e 's:_relative ": "./:' ${RUBY_FAKEGEM_GEMSPEC} || die
 }

Reply via email to