public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] gems.eclass review
@ 2009-03-03 16:47 Alex Legler
  2009-03-07  3:03 ` [gentoo-dev] " Ryan Hill
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Legler @ 2009-03-03 16:47 UTC (permalink / raw
  To: gentoo-dev; +Cc: ruby

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

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: ;)

http://dev.gentoo.org/~a3li/ruby/gems.eclass.txt
Diff against the current version in the tree:
http://dev.gentoo.org/~a3li/ruby/gems.eclass.diff

Regards,
Alex



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-dev]  Re: gems.eclass review
  2009-03-03 16:47 [gentoo-dev] gems.eclass review Alex Legler
@ 2009-03-07  3:03 ` Ryan Hill
  2009-03-12 20:02   ` Alex Legler
  0 siblings, 1 reply; 5+ messages in thread
From: Ryan Hill @ 2009-03-07  3:03 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2322 bytes --]

On Tue, 03 Mar 2009 17:47:58 +0100
Alex Legler <a3li@gentoo.org> 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev]  Re: gems.eclass review
  2009-03-07  3:03 ` [gentoo-dev] " Ryan Hill
@ 2009-03-12 20:02   ` Alex Legler
  2009-03-14 18:02     ` Peter Volkov
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Legler @ 2009-03-12 20:02 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 901 bytes --]

On Fr, 2009-03-06 at 21:03 -0600, Ryan Hill wrote:
> 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:
> 

Actually, this is what we want. ;)
I noticed after I sent the eclass for review, that USE_RUBY="any" should
not be used anymore. So I added a deprecation notice and will get rid of
it in a month or so.

> > +		dodir ${GEMSDIR}
> 
> || die
> 

Added the two die's, thanks.

I also added eclass-manpages-style documentation and empty EAPI-2
functions to make pva happy. :p

I am going to wait another couple of days before comitting if anyone
should have more comments. Updated the old URLs with the new changes:

http://dev.gentoo.org/~a3li/ruby/gems.eclass.txt
http://dev.gentoo.org/~a3li/ruby/gems.eclass.diff

Thanks,
Alex

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev]  Re: gems.eclass review
  2009-03-12 20:02   ` Alex Legler
@ 2009-03-14 18:02     ` Peter Volkov
  2009-03-14 18:53       ` Ciaran McCreesh
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Volkov @ 2009-03-14 18:02 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

В Чтв, 12/03/2009 в 21:02 +0100, Alex Legler пишет:
> http://dev.gentoo.org/~a3li/ruby/gems.eclass.txt
> http://dev.gentoo.org/~a3li/ruby/gems.eclass.diff

You have:

EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install

I'm not sure here. Is it safe to export src_prepare function for
EAPI=0,1? If not I think eclass should either die or put some fake
depend like:

case ${EAPI} in
    2) : ;;
    *) DEPEND="INCORRECT-EAPI" ;;
esac

-- 
Peter.

[-- Attachment #2: Эта часть сообщения подписана цифровой подписью --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev]  Re: gems.eclass review
  2009-03-14 18:02     ` Peter Volkov
@ 2009-03-14 18:53       ` Ciaran McCreesh
  0 siblings, 0 replies; 5+ messages in thread
From: Ciaran McCreesh @ 2009-03-14 18:53 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

On Sat, 14 Mar 2009 21:02:45 +0300
Peter Volkov <pva@gentoo.org> wrote:
> I'm not sure here. Is it safe to export src_prepare function for
> EAPI=0,1?

Nope. You're only allowed to EXPORT_FUNCTIONS something that's a phase
function for your chosen EAPI.

(Incidentally, you're also only allowed to call EXPORT_FUNCTIONS once
per eclass. I seem to recall this being for historical reasons.)

-- 
Ciaran McCreesh

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-14 18:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-03 16:47 [gentoo-dev] gems.eclass review Alex Legler
2009-03-07  3:03 ` [gentoo-dev] " Ryan Hill
2009-03-12 20:02   ` Alex Legler
2009-03-14 18:02     ` Peter Volkov
2009-03-14 18:53       ` Ciaran McCreesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox