summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2010-02-19 11:58:36 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2010-02-19 11:58:36 +0000
commit06083c634937862b22368f16c658a5740d4e50bd (patch)
tree94d283767b05117ae9fb8155e4cac34cca16ddfe /eclass/ruby-fakegem.eclass
parentFix bug #303789 properly by depending on a fixed version of emul qtlibs. (diff)
downloadhistorical-06083c634937862b22368f16c658a5740d4e50bd.tar.gz
historical-06083c634937862b22368f16c658a5740d4e50bd.tar.bz2
historical-06083c634937862b22368f16c658a5740d4e50bd.zip
Don't create generic wrappers when installing for a single implementation.
Since we have a few packages that can only be installed for JRuby, and that thus wouldn't work with any of the selected implementations, and a few that installs only for Ruby 1.8 (and thus would break if 1.9 was selected), try to reduce their impact by only producing generic wrappers when installing for multiple implementations. This should produce a totally working system after updating from 1.9, among other things. To make sure that the wrappers generated by different revisions of ruby-fakegem.eclass are properly identified, also add the CVS ID of the eclass in the comments of the generated wrapper. At the same time add the same specification about generation to the gemspec files, so that we can identify “older” specifications quickly.
Diffstat (limited to 'eclass/ruby-fakegem.eclass')
-rw-r--r--eclass/ruby-fakegem.eclass29
1 files changed, 26 insertions, 3 deletions
diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
index f66b522db751..45b33fad244a 100644
--- a/eclass/ruby-fakegem.eclass
+++ b/eclass/ruby-fakegem.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.15 2010/02/19 08:47:36 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.16 2010/02/19 11:58:36 flameeyes Exp $
#
# @ECLASS: ruby-fakegem.eclass
# @MAINTAINER:
@@ -148,6 +148,7 @@ ruby_fakegem_genspec() {
# so better taking this into consideration.
local quoted_description=${DESCRIPTION//\"/\\\"}
cat - > "${T}"/${RUBY_FAKEGEM_NAME}-${_ruby_implementation} <<EOF
+# generated by ruby-fakegem.eclass $Id: ruby-fakegem.eclass,v 1.16 2010/02/19 11:58:36 flameeyes Exp $
Gem::Specification.new do |s|
s.name = "${RUBY_FAKEGEM_NAME}"
s.version = "${RUBY_FAKEGEM_VERSION}"
@@ -175,11 +176,33 @@ ruby_fakegem_binwrapper() {
local binpath=$(dirname $newbinary)
[[ ${binpath} = . ]] && binpath=/usr/bin
+ # Try to find out whether the package is going to install for
+ # one or multiple implementations; if we're installing for a
+ # *single* implementation, no need to use “/usr/bin/env ruby”
+ # in the shebang, and we can actually avoid errors when
+ # calling the script by default (see for instance the
+ # JRuby-specific commands).
+ local rubycmd=
+ for implementation in ${USE_RUBY}; do
+ # ignore non-enabled implementations
+ use ruby_targets_${implementation} || continue
+ if [ -z $rubycmd ]; then
+ # if no other implementation was set before, set it.
+ rubycmd="/usr/bin/${implementation}"
+ else
+ # if another implementation already arrived, then make
+ # it generic and break out of the loop. This ensures
+ # that we do at most two iterations.
+ rubycmd="/usr/bin/env ruby"
+ break
+ fi
+ done
+
cat - > "${T}"/gembin-wrapper-${gembinary} <<EOF
-#!/usr/bin/env ruby
+#!${rubycmd}
# This is a simplified version of the RubyGems wrapper
#
-# Generated by ruby-fakegem.eclass
+# Generated by ruby-fakegem.eclass $Id: ruby-fakegem.eclass,v 1.16 2010/02/19 11:58:36 flameeyes Exp $
require 'rubygems'