Discussion:
[RFC] Ruby version handling changes
OBATA Akio
2014-07-03 12:29:38 UTC
Permalink
Hi,

Please review following changes:

1. Rename RUBY_VERSION_SUPPORTED to RUBY_VERSIONS_ACCEPTED,
same name as Lua, Python and PHP.
2. Introduce RUBY_VERSIONS_INCOMPATIBLE, same as Lua and Python.

3. Fail if no valid Ruby version.

Index: lang/ruby/rubyversion.mk
===================================================================
RCS file: /cvsroot/pkgsrc/lang/ruby/rubyversion.mk,v
retrieving revision 1.121
diff -u -r1.121 rubyversion.mk
--- lang/ruby/rubyversion.mk 21 May 2014 03:19:57 -0000 1.121
+++ lang/ruby/rubyversion.mk 3 Jul 2014 12:13:39 -0000
@@ -33,17 +33,27 @@
# Ruby version to use. This variable should not be set in
# packages. Normally it is used by bulk build tools.
#
-# Possible values: ${RUBY_VERSION_SUPPORTED}
+# Possible values: ${RUBY_VERSIONS_ACCEPTED}
# Default: ${RUBY_VERSION_DEFAULT}
#
# === Package-settable variables ===
#
-# RUBY_VERSION_SUPPORTED
+# RUBY_VERSIONS_ACCEPTED
# The Ruby versions that are acceptable for the package.
#
# Possible values: 18 193 200 21
# Default: 200 193 18 21
#
+# RUBY_VERSIONS_INCOMPATIBLE
+# The Ruby versions that are NOT acceptable for the package
+#
+# Possible values: 18 193 200 21
+# Default: (empty)
+#
+# RUBY_VERSION_SUPPORTED
+# Deprecated. Use RUBY_VERSIONS_ACCEPTED instead.
+#
+#
# RUBY_NOVERSION
# If "Yes", the package dosen't depend on any version of Ruby, such
# as editing mode for emacs. In this case, package's name would begin
@@ -231,30 +241,33 @@
#
RUBY_VERSION_DEFAULT?= 200

-RUBY_VERSION_SUPPORTED?= 200 193 18 21
+RUBY_VERSIONS_ACCEPTED?= ${RUBY_VERSION_SUPPORTED:U200 193 18 21}
+RUBY_VERSIONS_INCOMPATIBLE?= # empty

.if defined(RUBY_VERSION_REQD)
-. for rv in ${RUBY_VERSION_SUPPORTED}
-. if "${rv}" == ${RUBY_VERSION_REQD}
-RUBY_VER= ${rv}
-. endif
-. endfor
-.elif !defined(RUBY_VER)
-. for rv in ${RUBY_VERSION_SUPPORTED}
-. if "${rv}" == ${RUBY_VERSION_DEFAULT}
-RUBY_VER= ${rv}
-. endif
-. endfor
+RUBY_VER= ${RUBY_VERSION_REQD}
+. if !empty(RUBY_VERSIONS_ACCEPTED:M${RUBY_VERSION_REQD}) && \
+ empty(RUBY_VERSIONS_INCOMPATIBLE:M${RUBY_VERSION_REQD})
+. else
+PKG_FAIL_REASON= "No valid Ruby version"
+. endif
+.elif !defined(RUBY_VER) && \
+ !empty(RUBY_VERSIONS_ACCEPTED:M${RUBY_VERSION_DEFAULT}) && \
+ empty(RUBY_VERSIONS_INCOMPATIBLE:M${RUBY_VERSION_DEFAULT})
+RUBY_VER= ${RUBY_VERSION_DEFAULT}
.endif

.if !defined(RUBY_VER)
-. for rv in ${RUBY_VERSION_SUPPORTED}
-. if !defined(RUBY_VER)
+. for rv in ${RUBY_VERSIONS_ACCEPTED}
+. if !defined(RUBY_VER) && empty(RUBY_VERSIONS_INCOMPATIBLE:M${rv})
RUBY_VER= ${rv}
. endif
. endfor
.endif

+.if !defined(RUBY_VER)
+PKG_FAIL_REASON= "No valid Ruby version"
+.endif
RUBY_VER:= ${RUBY_VER_MAP.${RUBY_VER}:U${RUBY_VER}}

RUBY_SUFFIX?= ${_RUBY_VER_MAJOR}${_RUBY_VER_MINOR}${_RUBY_VER_TEENY}
--
OBATA Akio / ***@lins.jp
Greg Troxel
2014-07-03 13:22:09 UTC
Permalink
Post by OBATA Akio
+# RUBY_VERSIONS_ACCEPTED
# The Ruby versions that are acceptable for the package.
#
# Possible values: 18 193 200 21
# Default: 200 193 18 21
This is an ordered list, it seems. Perhaps that's really obvious, but
it would be nice to have a comment explaining that the user's default is
used if it's in the list, and otherwise the first one (filtered by
versions that are missing on this platform??).
Post by OBATA Akio
-RUBY_VERSION_SUPPORTED?= 200 193 18 21
+RUBY_VERSIONS_ACCEPTED?= ${RUBY_VERSION_SUPPORTED:U200 193 18 21}
+RUBY_VERSIONS_INCOMPATIBLE?= # empty
Presumably there should be a warning for use of a deprecated variable.
Or, it could be in pkglint.
OBATA Akio
2014-08-24 01:18:03 UTC
Permalink
Post by Greg Troxel
Post by OBATA Akio
+# RUBY_VERSIONS_ACCEPTED
# The Ruby versions that are acceptable for the package.
#
# Possible values: 18 193 200 21
# Default: 200 193 18 21
This is an ordered list, it seems. Perhaps that's really obvious, but
it would be nice to have a comment explaining that the user's default is
used if it's in the list, and otherwise the first one (filtered by
versions that are missing on this platform??).
Just a rename of variable.
Post by Greg Troxel
Post by OBATA Akio
-RUBY_VERSION_SUPPORTED?= 200 193 18 21
+RUBY_VERSIONS_ACCEPTED?= ${RUBY_VERSION_SUPPORTED:U200 193 18 21}
+RUBY_VERSIONS_INCOMPATIBLE?= # empty
Presumably there should be a warning for use of a deprecated variable.
Or, it could be in pkglint.
I would like to "deprecate" after 2014Q3 out, to be pullup easier.

Index: lang/ruby/rubyversion.mk
===================================================================
RCS file: /cvsroot/pkgsrc/lang/ruby/rubyversion.mk,v
retrieving revision 1.122
diff -u -r1.122 rubyversion.mk
--- lang/ruby/rubyversion.mk 14 Aug 2014 03:59:22 -0000 1.122
+++ lang/ruby/rubyversion.mk 24 Aug 2014 01:16:29 -0000
@@ -33,17 +33,27 @@
# Ruby version to use. This variable should not be set in
# packages. Normally it is used by bulk build tools.
#
-# Possible values: ${RUBY_VERSION_SUPPORTED}
+# Possible values: ${RUBY_VERSIONS_ACCEPTED}
# Default: ${RUBY_VERSION_DEFAULT}
#
# === Package-settable variables ===
#
-# RUBY_VERSION_SUPPORTED
+# RUBY_VERSIONS_ACCEPTED
# The Ruby versions that are acceptable for the package.
#
# Possible values: 18 193 200 21
# Default: 200 193 18 21
#
+# RUBY_VERSIONS_INCOMPATIBLE
+# The Ruby versions that are NOT acceptable for the package
+#
+# Possible values: 18 193 200 21
+# Default: (empty)
+#
+# RUBY_VERSION_SUPPORTED
+# Deprecated. Use RUBY_VERSIONS_ACCEPTED instead.
+#
+#
# RUBY_NOVERSION
# If "Yes", the package dosen't depend on any version of Ruby, such
# as editing mode for emacs. In this case, package's name would begin
@@ -232,30 +242,37 @@
#
RUBY_VERSION_DEFAULT?= 200

-RUBY_VERSION_SUPPORTED?= 200 193 18 21
+.if defined(RUBY_VERSION_SUPPORTED)
+#WARNINGS+= "RUBY_VERSION_SUPPORTED is deprecated, please use RUBY_VERSIONS_ACCEPTED"
+RUBY_VERSIONS_ACCEPTED= ${RUBY_VERSION_SUPPORTED}
+.endif
+RUBY_VERSIONS_ACCEPTED?= 200 193 18 21
+RUBY_VERSIONS_INCOMPATIBLE?= # empty

.if defined(RUBY_VERSION_REQD)
-. for rv in ${RUBY_VERSION_SUPPORTED}
-. if "${rv}" == ${RUBY_VERSION_REQD}
-RUBY_VER= ${rv}
-. endif
-. endfor
-.elif !defined(RUBY_VER)
-. for rv in ${RUBY_VERSION_SUPPORTED}
-. if "${rv}" == ${RUBY_VERSION_DEFAULT}
-RUBY_VER= ${rv}
-. endif
-. endfor
+RUBY_VER= ${RUBY_VERSION_REQD}
+. if !empty(RUBY_VERSIONS_ACCEPTED:M${RUBY_VERSION_REQD}) && \
+ empty(RUBY_VERSIONS_INCOMPATIBLE:M${RUBY_VERSION_REQD})
+. else
+PKG_FAIL_REASON= "No valid Ruby version"
+. endif
+.elif !defined(RUBY_VER) && \
+ !empty(RUBY_VERSIONS_ACCEPTED:M${RUBY_VERSION_DEFAULT}) && \
+ empty(RUBY_VERSIONS_INCOMPATIBLE:M${RUBY_VERSION_DEFAULT})
+RUBY_VER= ${RUBY_VERSION_DEFAULT}
.endif

.if !defined(RUBY_VER)
-. for rv in ${RUBY_VERSION_SUPPORTED}
-. if !defined(RUBY_VER)
+. for rv in ${RUBY_VERSIONS_ACCEPTED}
+. if !defined(RUBY_VER) && empty(RUBY_VERSIONS_INCOMPATIBLE:M${rv})
RUBY_VER= ${rv}
. endif
. endfor
.endif

+.if !defined(RUBY_VER)
+PKG_FAIL_REASON= "No valid Ruby version"
+.endif
RUBY_VER:= ${RUBY_VER_MAP.${RUBY_VER}:U${RUBY_VER}}

RUBY_SUFFIX?= ${_RUBY_VER_MAJOR}${_RUBY_VER_MINOR}${_RUBY_VER_TEENY}
--
OBATA Akio / ***@lins.jp
OBATA Akio
2014-09-11 02:35:01 UTC
Permalink
One questionable point is "RUBY_PKGPREFIX and RUBY_VERSION for ruby21",
former is "ruby212" and later is "21".

From some logics and comments in lang/ruby/rubyversion.mk,
moreover new version scheme introduced in ruby-2.1.x,
I feel that RUBY_PREFIX for ruby21 should be "ruby21".
Takahiro Kambe
2014-09-15 05:28:37 UTC
Permalink
Hi,

I'm sorry for late reply since I was almost sick in bed for a week.

In message <***@cabos.lins.jp>
on Thu, 11 Sep 2014 11:35:01 +0900,
Post by OBATA Akio
One questionable point is "RUBY_PKGPREFIX and RUBY_VERSION for
ruby21",
former is "ruby212" and later is "21".
RUBY_PKGPREFIX distict different teeny version of Ruby, such as 2.1.1
and 2.1.2.
Post by OBATA Akio
From some logics and comments in lang/ruby/rubyversion.mk,
I update some description later to match current status.
Post by OBATA Akio
moreover new version scheme introduced in ruby-2.1.x,
I feel that RUBY_PREFIX for ruby21 should be "ruby21".
It is correct. But,

* It needs to change of RUBY_VER_DIR for Ruby 2.1 (and later).
* Change from now cause almost whole ruby package's PKGREVISON bump
(for not default version of Ruby.)

/usr/pkg/lib/ruby/2.1.2 => /usr/pkg/lib/ruby/2.1.0

I want to introduce it next teeny version release of Ruby 2.1 (though
it is not certain such release would be).

Best regards.
--
Takahiro Kambe <***@NetBSD.org>/<***@back-street.net>
Loading...