On 08/31 01:22, Jeremy Evans wrote:
> Another possible way to handle this would be to keep ruby 1.9 ports
> using the ruby19 FLAVOR, but switch ruby 1.8 ports to use a ruby18
> FLAVOR, and have unFLAVORed builds just default to the ruby19
> FLAVOR.  I'll consider that approach if the @conflict markers can be
> added to the PLIST automatically by ruby.port.mk for ruby18 ports.

Here's a basic proof of concept of this approach.

Jeremy

Index: ruby18.PLIST
===================================================================
RCS file: ruby18.PLIST
diff -N ruby18.PLIST
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ ruby18.PLIST        31 Aug 2012 21:57:27 -0000
@@ -0,0 +1 @@
+@pkgpath ${PKGPATH}
Index: ruby.port.mk
===================================================================
RCS file: /cvs/ports/lang/ruby/ruby.port.mk,v
retrieving revision 1.50
diff -u -p -r1.50 ruby.port.mk
--- ruby.port.mk        9 Dec 2011 21:41:43 -0000       1.50
+++ ruby.port.mk        1 Sep 2012 00:08:23 -0000
@@ -16,20 +16,23 @@ MODRUBY_HANDLE_FLAVORS ?= No
 # the same port directory for gem and extconf based ports.  It does this
 # by adding FLAVORS automatically, unless FLAVORS are already defined
 # or the port defines MODRUBY_REV to tie the port to a specific ruby
-# version.  For example, JDBC gem ports want to set MODRUBY_REV=jruby,
+# version.  For example, JDBC gem ports want to set FLAVOR=jruby,
 # since they don't work on ruby 1.8 or ruby 1.9.
 .if !defined(MODRUBY_REV)
 .  if ${MODRUBY_HANDLE_FLAVORS:L:Myes}
+
+# If ruby.pork.mk should handle FLAVORs, define a separate FLAVOR
+# for each ruby interpreter
 .    if !defined(FLAVORS)
-FLAVORS?=              ruby19 rbx jruby
+FLAVORS?=              ruby18 ruby19 rbx jruby
 .    endif
 
 # Instead of adding flavors to the end of the package name, we use
 # different package stems for ruby 1.8, ruby 1.9, and jruby packages.
 # ruby 1.8 uses the historical ruby-* package stem, ruby 1.9 uses
-# ruby19-* and jruby uses jruby-*.  In most cases, PKGNAME in the port
-# should be set to the same as DISTNAME, and this will insert the
-# correct package prefix.
+# ruby19-*, jruby uses jruby-*, and rubinius uses rbx.  In most cases,
+# PKGNAME in the port should be set to the same as DISTNAME, and this
+# will insert the correct package prefix.
 FULLPKGNAME?=          ${MODRUBY_PKG_PREFIX}-${PKGNAME}
 
 # If the port can work on both ruby 1.9 and another version of ruby,
@@ -43,23 +46,38 @@ FULLPKGNAME?=               ${MODRUBY_PKG_PREFIX}-${P
 SUBST_VARS+=           GEM_BIN_SUFFIX GEM_MAN_SUFFIX
 
 FLAVOR?=
-# Without a FLAVOR, assume the use of ruby 1.8.
+# Without a FLAVOR, assume the use of ruby 1.9.
 .     if empty(FLAVOR)
-MODRUBY_REV=           1.8
+FLAVOR =               ruby19
+.     endif
+
 # Check for conflicting FLAVORs and set MODRUBY_REV appropriately based
 # on the FLAVOR.
+.    if ${FLAVOR:L:Mruby18}
+.      if ${FLAVOR:L:Mruby19} || ${FLAVOR:L:Mjruby} || ${FLAVOR:L:Mrbx}
+ERRORS+=               "Fatal: Conflicting flavors used: ${FLAVOR}"
+.      endif
+MODRUBY_REV=           1.8
+
+# Handle updates from older ruby 1.8 ports that didn't use the ruby18
+# FLAVOR by adding a @pkgpath entry to the PLIST.
+SUBST_VARS+=   PKGPATH
+PKG_ARGS+=     -f ${PORTSDIR}/lang/ruby/ruby18.PLIST
+
 .    elif ${FLAVOR:L:Mruby19}
-.      if ${FLAVOR:L:Mjruby} || ${FLAVOR:L:Mrbx}
+.      if ${FLAVOR:L:Mruby18} || ${FLAVOR:L:Mjruby} || ${FLAVOR:L:Mrbx}
 ERRORS+=               "Fatal: Conflicting flavors used: ${FLAVOR}"
 .      endif
 MODRUBY_REV=           1.9
+
 .    elif ${FLAVOR:L:Mjruby}
-.      if ${FLAVOR:L:Mruby19} || ${FLAVOR:L:Mrbx}
+.      if ${FLAVOR:L:Mruby18} || ${FLAVOR:L:Mruby19} || ${FLAVOR:L:Mrbx}
 ERRORS+=               "Fatal: Conflicting flavors used: ${FLAVOR}"
 .      endif
 MODRUBY_REV=           jruby
+
 .    elif ${FLAVOR:L:Mrbx}
-.      if ${FLAVOR:L:Mruby19} || ${FLAVOR:L:Mjruby}
+.      if ${FLAVOR:L:Mruby18} || ${FLAVOR:L:Mruby19} || ${FLAVOR:L:Mjruby}
 ERRORS+=               "Fatal: Conflicting flavors used: ${FLAVOR}"
 .      endif
 MODRUBY_REV=           rbx

Reply via email to