Gentoo Archives: gentoo-commits

From: "Diego Petteno (flameeyes)" <flameeyes@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: ruby-fakegem.eclass
Date: Fri, 19 Feb 2010 11:58:40
Message-Id: E1NiRVF-0004v5-B3@stork.gentoo.org
1 flameeyes 10/02/19 11:58:37
2
3 Modified: ruby-fakegem.eclass
4 Log:
5 Don't create generic wrappers when installing for a single implementation.
6
7 Since we have a few packages that can only be installed for JRuby, and
8 that thus wouldn't work with any of the selected implementations, and
9 a few that installs only for Ruby 1.8 (and thus would break if 1.9 was
10 selected), try to reduce their impact by only producing generic
11 wrappers when installing for multiple implementations.
12
13 This should produce a totally working system after updating from 1.9,
14 among other things.
15
16 To make sure that the wrappers generated by different revisions of
17 ruby-fakegem.eclass are properly identified, also add the CVS ID of
18 the eclass in the comments of the generated wrapper.
19
20 At the same time add the same specification about generation to the
21 gemspec files, so that we can identify “older” specifications quickly.
22
23 Revision Changes Path
24 1.16 eclass/ruby-fakegem.eclass
25
26 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/ruby-fakegem.eclass?rev=1.16&view=markup
27 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/ruby-fakegem.eclass?rev=1.16&content-type=text/plain
28 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/ruby-fakegem.eclass?r1=1.15&r2=1.16
29
30 Index: ruby-fakegem.eclass
31 ===================================================================
32 RCS file: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v
33 retrieving revision 1.15
34 retrieving revision 1.16
35 diff -u -r1.15 -r1.16
36 --- ruby-fakegem.eclass 19 Feb 2010 08:47:36 -0000 1.15
37 +++ ruby-fakegem.eclass 19 Feb 2010 11:58:36 -0000 1.16
38 @@ -1,6 +1,6 @@
39 # Copyright 1999-2009 Gentoo Foundation
40 # Distributed under the terms of the GNU General Public License v2
41 -# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.15 2010/02/19 08:47:36 flameeyes Exp $
42 +# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.16 2010/02/19 11:58:36 flameeyes Exp $
43 #
44 # @ECLASS: ruby-fakegem.eclass
45 # @MAINTAINER:
46 @@ -148,6 +148,7 @@
47 # so better taking this into consideration.
48 local quoted_description=${DESCRIPTION//\"/\\\"}
49 cat - > "${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} <<EOF
50 +# generated by ruby-fakegem.eclass $Id: ruby-fakegem.eclass,v 1.16 2010/02/19 11:58:36 flameeyes Exp $
51 Gem::Specification.new do |s|
52 s.name = "${RUBY_FAKEGEM_NAME}"
53 s.version = "${RUBY_FAKEGEM_VERSION}"
54 @@ -175,11 +176,33 @@
55 local binpath=$(dirname $newbinary)
56 [[ ${binpath} = . ]] && binpath=/usr/bin
57
58 + # Try to find out whether the package is going to install for
59 + # one or multiple implementations; if we're installing for a
60 + # *single* implementation, no need to use “/usr/bin/env ruby”
61 + # in the shebang, and we can actually avoid errors when
62 + # calling the script by default (see for instance the
63 + # JRuby-specific commands).
64 + local rubycmd=
65 + for implementation in ${USE_RUBY}; do
66 + # ignore non-enabled implementations
67 + use ruby_targets_${implementation} || continue
68 + if [ -z $rubycmd ]; then
69 + # if no other implementation was set before, set it.
70 + rubycmd="/usr/bin/${implementation}"
71 + else
72 + # if another implementation already arrived, then make
73 + # it generic and break out of the loop. This ensures
74 + # that we do at most two iterations.
75 + rubycmd="/usr/bin/env ruby"
76 + break
77 + fi
78 + done
79 +
80 cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF
81 -#!/usr/bin/env ruby
82 +#!${rubycmd}
83 # This is a simplified version of the RubyGems wrapper
84 #
85 -# Generated by ruby-fakegem.eclass
86 +# Generated by ruby-fakegem.eclass $Id: ruby-fakegem.eclass,v 1.16 2010/02/19 11:58:36 flameeyes Exp $
87
88 require 'rubygems'