Gentoo Logo
Gentoo Spaceship

Installation:
Gentoo Handbook
Installation Docs

Documentation:
Home
Listing
About Gentoo
Philosophy
Social Contract

Resources:
Bug Tracker
Developer List
Discussion Forums
Gentoo BitTorrents
Gentoo Linux Enhancement Proposals
IRC Channels
Mailing Lists
Mirrors
Name and Logo Guidelines
Online Package Database
Security Announcements
Staffing Needs
Supporting Vendors
View our CVS

Graphics:
Logos and themes
Icons
ScreenShots

Miscellaneous Resources:
Gentoo Linux Store
Gentoo-hosted projects
IBM dW/Intel article archive




List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Ryan Hill <dirtyepic@g.o>
Subject: Re: gems.eclass review
Date: Fri, 6 Mar 2009 21:03:51 -0600
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
Attachment:
signature.asc (PGP signature)
Replies:
Re: Re: gems.eclass review
-- Alex Legler
References:
gems.eclass review
-- Alex Legler
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
gems.eclass review
Next by thread:
Re: Re: gems.eclass review
Previous by date:
Re: How to speed up maintenance and other Gentoo work?
Next by date:
Re: How to speed up maintenance and other Gentoo work?


Updated Jun 17, 2009

Donate to support our development efforts.

Gentoo Centric Hosting: vr.org

VR Hosted

Tek Alchemy

Tek Alchemy

SevenL.net

SevenL.net

php|architect

php|architect

Copyright 2001-2007 Gentoo Foundation, Inc. Questions, Comments? Email www@gentoo.org.