Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 373227 - RUBY_OPTIONAL="no" should trigger ruby targets to use REQUIRED_USE in EAPI 4
Summary: RUBY_OPTIONAL="no" should trigger ruby targets to use REQUIRED_USE in EAPI 4
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-27 17:49 UTC by Matthew Schultz
Modified: 2011-07-22 09:11 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ruby-ng.eclass.patch (ruby-ng.eclass.patch,960 bytes, patch)
2011-06-27 19:18 UTC, Matthew Schultz
Details | Diff
ruby-ng.eclass.patch (ruby-ng.eclass.patch,945 bytes, patch)
2011-06-27 19:52 UTC, Matthew Schultz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Schultz 2011-06-27 17:49:04 UTC
Currently ruby-ng.eclass dies if a ruby target is not met with this message for all EAPIs:

You need to select at least one Ruby implementation by setting RUBY_TARGETS in /etc/make.conf.

I propose for EAPI 4 that the ruby-ng.eclass add all the ruby targets to REQUIRED_USE if RUBY_OPTIONAL is "no".  This will prevent the package from even attempting to merge since the ebuild already knows that it won't be possible.  

This is especially handy for an ebuild that would attempt to use only ruby19 like this: USE_RUBY="ruby19" RUBY_OPTIONAL="no".  If the user does not unmask the ruby_targets_ruby19 use flag, the package will still show whatever dependencies it's going to merge and attempt to merge anyway when this is not possible.

This change should alert the user to the situation without causing a merge to die and may even prevent bogus bugs from being filed.

Reproducible: Always
Comment 1 Matthew Schultz 2011-06-27 19:18:49 UTC
Created attachment 278379 [details, diff]
ruby-ng.eclass.patch

Proposed ruby-ng.eclass patch.  This adds two functions:

ruby_get_use_implementations:  This will get an array of implementations that the user enabled through RUBY_TARGETS.  This is technically out of the scope of this bug but I need it for an ebuild I'm working on.

ruby_get_use_targets: This gets an array of ruby_targets_[implementation] to be used with the REQUIRED_USE portion below it
Comment 2 Matthew Schultz 2011-06-27 19:52:01 UTC
Created attachment 278387 [details, diff]
ruby-ng.eclass.patch

Removed the prepended REQUIRED_USE which is not allowed.
Comment 3 Matthew Schultz 2011-06-27 19:57:07 UTC
The ruby_get_use_implementations is needed because there aren't any functions that provide an array of implementations that are enabled by the user.  

A good example of this is the librets ebuild I am working on in the sunrise overlay.  I cannot use a lot of the built-in functions provided by ruby-ng because the package optionally depends on ruby and does not build in the typical manner a ruby package is built (it uses swig).  I need get a list of the implementations enabled by the user so I can determine which implementations to compile against manually.  This function would make my ebuild a little simpler and possibly provide for other cases where there are unorthodox builds for packages that support ruby.
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-07-14 09:00:26 UTC
Thanks Matthew, you're right of course on the approach, looks good to me as well.
Comment 5 Hans de Graaff gentoo-dev Security 2011-07-22 09:11:20 UTC
I've just added both patches to ruby-ng. (Both? Yes, I split the patch into both functional components to avoid future headscratching.)

Thanks!