graaff      15/05/31 05:57:24

  Modified:             ChangeLog ruby-ng.eclass
  Added:                ruby-single.eclass ruby-utils.eclass
  Log:
  Add ruby-single.eclass to support packages that just need a ruby interpreter 
to be present. Refactor code common with ruby-ng.eclass into ruby-utils.eclass.

Revision  Changes    Path
1.1630               eclass/ChangeLog

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1630&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1630&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1629&r2=1.1630

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1629
retrieving revision 1.1630
diff -u -r1.1629 -r1.1630
--- ChangeLog   30 May 2015 16:09:05 -0000      1.1629
+++ ChangeLog   31 May 2015 05:57:23 -0000      1.1630
@@ -1,6 +1,12 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1629 2015/05/30 
16:09:05 mpagano Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1630 2015/05/31 
05:57:23 graaff Exp $
+
+  31 May 2015; Hans de Graaff <[email protected]> ruby-ng.eclass,
+  +ruby-single.eclass, +ruby-utils.eclass:
+  Add ruby-single.eclass to support packages that just need a ruby interpreter
+  to be present. Refactor code common with ruby-ng.eclass into
+  ruby-utils.eclass.
 
   30 May 2015; Mike Pagano <[email protected]> kernel-2.eclass:
   Drop PDEPEND on virtual/dev-manager. See bug #550086.



1.57                 eclass/ruby-ng.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ruby-ng.eclass?rev=1.57&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ruby-ng.eclass?rev=1.57&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ruby-ng.eclass?r1=1.56&r2=1.57

Index: ruby-ng.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- ruby-ng.eclass      28 Dec 2014 07:23:56 -0000      1.56
+++ ruby-ng.eclass      31 May 2015 05:57:23 -0000      1.57
@@ -1,6 +1,6 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.56 2014/12/28 
07:23:56 graaff Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-ng.eclass,v 1.57 2015/05/31 
05:57:23 graaff Exp $
 
 # @ECLASS: ruby-ng.eclass
 # @MAINTAINER:
@@ -34,6 +34,7 @@
 #  * all_ruby_configure
 
 # @ECLASS-VARIABLE: USE_RUBY
+# @DEFAULT_UNSET
 # @REQUIRED
 # @DESCRIPTION:
 # This variable contains a space separated list of targets (see above) a 
package
@@ -72,7 +73,7 @@
 # (e.g. selenium's firefox driver extension). When set this argument is
 # passed to "grep -E" to remove reporting of these shared objects.
 
-inherit eutils java-utils-2 multilib toolchain-funcs
+inherit eutils java-utils-2 multilib toolchain-funcs ruby-utils
 
 EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test 
src_install pkg_setup
 
@@ -99,46 +100,7 @@
 # Set `comparator' and `version' to include a comparator (=, >=, etc.) and a
 # version string to the returned string
 ruby_implementation_depend() {
-       local rubypn=
-       local rubyslot=
-
-       case $1 in
-               ruby18)
-                       rubypn="dev-lang/ruby"
-                       rubyslot=":1.8"
-                       ;;
-               ruby19)
-                       rubypn="dev-lang/ruby"
-                       rubyslot=":1.9"
-                       ;;
-               ruby20)
-                       rubypn="dev-lang/ruby"
-                       rubyslot=":2.0"
-                       ;;
-               ruby21)
-                       rubypn="dev-lang/ruby"
-                       rubyslot=":2.1"
-                       ;;
-               ruby22)
-                       rubypn="dev-lang/ruby"
-                       rubyslot=":2.2"
-                       ;;
-               ree18)
-                       rubypn="dev-lang/ruby-enterprise"
-                       rubyslot=":1.8"
-                       ;;
-               jruby)
-                       rubypn="dev-java/jruby"
-                       rubyslot=""
-                       ;;
-               rbx)
-                       rubypn="dev-lang/rubinius"
-                       rubyslot=""
-                       ;;
-               *) die "$1: unknown Ruby implementation"
-       esac
-
-       echo "$2${rubypn}$3${rubyslot}"
+       _ruby_implementation_depend $1
 }
 
 # @FUNCTION: ruby_samelib



1.1                  eclass/ruby-single.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ruby-single.eclass?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ruby-single.eclass?rev=1.1&content-type=text/plain

Index: ruby-single.eclass
===================================================================
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-single.eclass,v 1.1 2015/05/31 
05:57:23 graaff Exp $

# @ECLASS: ruby-single
# @MAINTAINER:
# Ruby team <[email protected]>
# @AUTHOR:
# Author: Hans de Graaff <[email protected]>
# Based on python-single-r1 by: Michał Górny <[email protected]>
# @BLURB: An eclass for Ruby packages not installed for multiple 
implementations.
# @DESCRIPTION:
# An eclass for packages which don't support being installed for
# multiple Ruby implementations. This mostly includes ruby-based
# scripts.

case "${EAPI:-0}" in
        0|1|2|3)
                die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
                ;;
        4|5)
                ;;
        *)
                die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
                ;;
esac

if [[ ! ${_RUBY_SINGLE} ]]; then

inherit ruby-utils

# @ECLASS-VARIABLE: USE_RUBY
# @DEFAULT_UNSET
# @REQUIRED
# @DESCRIPTION:
# This variable contains a space separated list of targets (see above) a package
# is compatible to. It must be set before the `inherit' call. There is no
# default. All ebuilds are expected to set this variable.


# @ECLASS-VARIABLE: RUBY_DEPS
# @DESCRIPTION:
#
# This is an eclass-generated Ruby dependency string for all
# implementations listed in USE_RUBY. Any one of the supported ruby
# targets will satisfy this dependency.
#
# Example use:
# @CODE
# RDEPEND="${RUBY_DEPS}
#   dev-foo/mydep"
# BDEPEND="${RDEPEND}"
# @
#
# Example value:
# @CODE
# || ( dev-lang/ruby:2.0 dev-lang/ruby:1.9 )
# @CODE

_ruby_single_implementations_depend() {
        local depend
        for _ruby_implementation in ${RUBY_TARGETS_PREFERENCE}; do
                if [[ ${USE_RUBY} =~ ${_ruby_implementation} ]]; then
                        depend="${depend} $(_ruby_implementation_depend 
$_ruby_implementation)"
                fi
        done
        echo "|| ( ${depend} )"
}

_ruby_single_set_globals() {
        RUBY_DEPS=$(_ruby_single_implementations_depend)
}
_ruby_single_set_globals


_RUBY_SINGLE=1
fi



1.1                  eclass/ruby-utils.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ruby-utils.eclass?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ruby-utils.eclass?rev=1.1&content-type=text/plain

Index: ruby-utils.eclass
===================================================================
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-utils.eclass,v 1.1 2015/05/31 
05:57:23 graaff Exp $

# @ECLASS: ruby-utils.eclass
# @MAINTAINER:
# Ruby team <[email protected]>
# @AUTHOR:
# Author: Hans de Graaff <[email protected]>
# @BLURB: An eclass for supporting ruby scripts and bindings in non-ruby 
packages
# @DESCRIPTION:
# The ruby-utils eclass is designed to allow an easier installation of
# Ruby scripts and bindings for non-ruby packages.
#
# This eclass does not set any metadata variables nor export any phase
# functions. It can be inherited safely.


if [[ ! ${_RUBY_UTILS} ]]; then


# @ECLASS-VARIABLE: RUBY_TARGETS_PREFERENCE
# @DESCRIPTION:
# This variable lists all the known ruby targets in preference of use as
# determined by the ruby team. By using this ordering rather than the
# USE_RUBY mandated ordering we have more control over which ruby
# implementation will be installed first (and thus eselected). This will
# provide for a better first installation experience.

# All RUBY_TARGETS
RUBY_TARGETS_PREFERENCE="ruby20 ruby19 "

# All other active ruby targets
RUBY_TARGETS_PREFERENCE+="ruby21 ruby22 "


_ruby_implementation_depend() {
        local rubypn=
        local rubyslot=

        case $1 in
                ruby18)
                        rubypn="dev-lang/ruby"
                        rubyslot=":1.8"
                        ;;
                ruby19)
                        rubypn="dev-lang/ruby"
                        rubyslot=":1.9"
                        ;;
                ruby20)
                        rubypn="dev-lang/ruby"
                        rubyslot=":2.0"
                        ;;
                ruby21)
                        rubypn="dev-lang/ruby"
                        rubyslot=":2.1"
                        ;;
                ruby22)
                        rubypn="dev-lang/ruby"
                        rubyslot=":2.2"
                        ;;
                ree18)
                        rubypn="dev-lang/ruby-enterprise"
                        rubyslot=":1.8"
                        ;;
                jruby)
                        rubypn="dev-java/jruby"
                        rubyslot=""
                        ;;
                rbx)
                        rubypn="dev-lang/rubinius"
                        rubyslot=""
                        ;;
                *) die "$1: unknown Ruby implementation"
        esac

        echo "$2${rubypn}$3${rubyslot}"
}



_RUBY_UTILS=1
fi




Reply via email to