List Archive: gentoo-dev
On Tue, 03 Mar 2009 17:47:58 +0100
Alex Legler <a3li@g.o> wrote:
> Hey,
>
> we have some changes to be made in gems.eclass for Ruby 1.9.1.
> Basically this introduces the possibility to install gems for multiple
> versions of Ruby.
>
> If anyone feels like reviewing, please review the following
> changes: ;)
> + # I'm not sure how many ebuilds have correctly set USE_RUBY - let's assume
> + # ruby18 if they haven't, since even pure Ruby gems that have been written
> + # against 1.8 can explode under 1.9.
> + if [[ -z "${USE_RUBY}" ]]; then
> + USE_RUBY="ruby18"
> + elif [[ "${USE_RUBY}" == "any" ]]; then
> + # Get the installed versions.
> + USE_RUBY=`ls /usr/bin/ruby* | grep -E 'ruby1(8|9)' | sed -e 's@/usr/bin/@@g'`
> fi
>
> + local num_ruby_slots=$(echo "${USE_RUBY}" | wc -w)
> +
> + for ruby_version in ${USE_RUBY} ; do
> + # Check that we have the version installed
> + [[ -e "/usr/bin/${ruby_version/ruby/gem}" ]] || continue
In the case that USE_RUBY is set to something funky, it never gets handled. The eclass
basically just does nothing. This might be what you want, but if not, how about something
like:
local my_ruby
if [[ -n ${USE_RUBY} ]]; then
if [[ ${USE_RUBY} == "any" ]]; then
for i in /usr/bin/ruby1*; do
[[ -f ${i} ]] && my_ruby="${my_ruby} ${i}"
done
elif [[ -x /usr/bin/${USE_RUBY} ]]; then
my_ruby=${USE_RUBY}
else
die "Some error message about a bad USE_RUBY value"
fi
else
my_ruby="ruby18"
fi
set -- ${my_ruby}
local num_ruby_slots=${#@}
> + einfo "Installing for ${ruby_version}..."
> + gems_location ${ruby_version}
> + dodir ${GEMSDIR}
|| die
> + if [[ -d "${D}/${GEMSDIR}/bin" ]] ; then
> + exeinto /usr/bin
> + for exe in "${D}"/${GEMSDIR}/bin/* ; do
> + if [ "$num_ruby_slots" -ge 2 ] ; then
> + # Ensures that the exe file gets run using the currently
> + # selected version of ruby.
> + sed -i -e 's@^#!/usr/bin/ruby.*$@#!/usr/bin/ruby@' "${exe}"
> + fi
> + doexe "${exe}"
|| die
--
gcc-porting, by design, by neglect
treecleaner, for a fact or just for effect
wxwidgets @ gentoo EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662
|
|