Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 569974 - app-eselect/eselect-ruby: should not have hardcoded ruby slots (i.e.: at this moment, you cannot eselect ruby 2.3)
Summary: app-eselect/eselect-ruby: should not have hardcoded ruby slots (i.e.: at this...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-28 14:06 UTC by Ivan Iraci
Modified: 2016-02-07 18:04 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Iraci 2015-12-28 14:06:20 UTC
find_targets() in /usr/share/eselect/modules/ruby.eselect has available version hard coded:
        for t in ${EROOT}${bindir}/${1:-ruby}{18,19,20,21,22} ; do
                [[ -e $t ]] || continue
                echo ${t}
        done

Right now, you can't eselect ruby 2.3 because of this implementation.

A much smarter (and simple) way to accomplish the same task could be the following:

echo "dev-lang/ruby" | eix '-|*' --format '<installedversions:NAMESLOT>' dev-lang/ruby | cut -f 2 -d: | sed "s/\.//"

Reproducible: Always
Comment 1 Alex Xu (Hello71) 2015-12-28 14:07:51 UTC
and it would also depend on eix.
Comment 2 Ivan Iraci 2015-12-28 14:24:01 UTC
This would depend on findutils and coreutils:

find /usr/bin/ -type f -name "ruby*" -exec basename {} \;

Ok?
Comment 3 Hans de Graaff gentoo-dev Security 2015-12-29 10:55:17 UTC
I have now added eselect-ruby-20151229 with support for ruby23. Apologies for overlooking this when adding the new version.

We've discussed a more dynamic approach like the one proposed here in the ruby team, but we feel that it is better to keep working with a whitelist of specific ruby versions. The dynamic approach could lead to unexpected side-effects in the future e.g. when someone adds a tool starting with ruby in /usr/bin.

Thanks for the report and suggestions.
Comment 4 Ivan Iraci 2015-12-29 11:13:56 UTC
(In reply to Hans de Graaff from comment #3)

> We've discussed a more dynamic approach like the one proposed here in the
> ruby team, but we feel that it is better to keep working with a whitelist of
> specific ruby versions. The dynamic approach could lead to unexpected
> side-effects in the future e.g. when someone adds a tool starting with ruby
> in /usr/bin.

Nothing that cannot be worked out with a small regex, IMHO.

Anyway, thanks.
Comment 5 Ivan Iraci 2015-12-29 11:18:11 UTC
find /usr/bin/ -type f -name "ruby[23][0-9]" -exec basename {} \;

This covers anything between ruby20 and ruby39 (without visible side effects).
Comment 6 Manuel Rüger (RETIRED) gentoo-dev 2015-12-31 17:38:44 UTC
(In reply to Ivan Iraci from comment #5)
> find /usr/bin/ -type f -name "ruby[23][0-9]" -exec basename {} \;
> 
> This covers anything between ruby20 and ruby39 (without visible side
> effects).

Does it work with Gentoo prefix?
What about support for rubinius and jruby?

It's not that easy, and the easiest way for now is to update it in a new eselect release. ;)
Comment 7 Ivan Iraci 2015-12-31 18:15:54 UTC
(In reply to Manuel Rüger from comment #6)
> > find /usr/bin/ -type f -name "ruby[23][0-9]" -exec basename {} \;
> Does it work with Gentoo prefix?
> What about support for rubinius and jruby?
> 
> It's not that easy, and the easiest way for now is to update it in a new
> eselect release. ;)

So you really want a full ebuild implementation from me... :)

Does the following for block support rubinius and jruby?!? How does it? :)

for t in ${EROOT}${bindir}/${1:-ruby}{18,19,20,21,22,23} ; do
                [[ -e $t ]] || continue
                echo ${t}
done

Well, can't we say that this is at least not less working than the current for block?
find ${EROOT}${bindir} -type f -name "ruby[23][0-9]" -exec basename {} \;

Are you able to find some regex matching jruby and rbx executables? I am. And I am not a regex black belt (to be honest, I'm pretty good at regexes, but you don't really have to be for such a simple task).

Please, don't disguise bias or lazyness as technical reasons.
If you have strong technical reasons against my arguments, use them.
Or just say you don't have the time to do it or... whatever.
Comment 8 Davide Pesavento (RETIRED) gentoo-dev 2016-01-19 20:43:46 UTC
(In reply to Hans de Graaff from comment #3)
> I have now added eselect-ruby-20151229 with support for ruby23. Apologies
> for overlooking this when adding the new version.

That's not enough. You also need to raise the eselect-ruby dependency in the ruby-2.3.0 ebuild.
Comment 9 Hans de Graaff gentoo-dev Security 2016-02-07 18:04:36 UTC
(In reply to Davide Pesavento from comment #8)

> That's not enough. You also need to raise the eselect-ruby dependency in the
> ruby-2.3.0 ebuild.

Done.