--- a/make-rules/puppetmodule.mk Tue Oct 04 14:04:16 2016 +0200
+++ b/make-rules/puppetmodule.mk Tue Oct 18 15:03:44 2016 -0700
@@ -20,7 +20,7 @@
#
#
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Puppet modules do not have any concept of 'build' so make this a no-op
@@ -30,6 +30,15 @@
$(COMPONENT_POST_BUILD_ACTION)
$(TOUCH) $@
+# Modify ruby scripts containing "#!/usr/bin/env ruby" to
+# use the version-specific ruby path, defined by the $(RUBY_VERSION) macro.
+# Without this change, the mediated ruby version in /usr/bin/ruby
+# will probably be used, which may not match the ruby
+# version supported by the puppet module.
+COMPONENT_POST_INSTALL_ACTION += \
+ cd $(PROTO_DIR); \
+ $(RUBY_SCRIPT_FIX_FUNC);
+
# install the source into the proto directory
$(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
$(COMPONENT_PRE_INSTALL_ACTION)
--- a/make-rules/ruby.mk Tue Oct 04 14:04:16 2016 +0200
+++ b/make-rules/ruby.mk Tue Oct 18 15:03:44 2016 -0700
@@ -31,3 +31,13 @@
PKG_MACROS += RUBYV=$(subst .,,$(RUBY_VERSION))
VENDOR_RUBY = /usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/$(RUBY_LIB_VERSION)
VENDOR_RUBY_ARCH = /usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/$(RUBY_LIB_VERSION)/$(MACH64)-solaris$(SOLARIS_VERSION)
+
+# Modify ruby scripts in the ruby-version-specific path of the proto area,
+# under usr/ruby/$(RUBY_VERSION), containing "#!/usr/bin/env ruby" to
+# use the version-specific ruby path, defined by the $(RUBY_VERSION) macro.
+# Without this change, the mediated ruby version in /usr/bin/ruby
+# will probably be used, which may not match the ruby
+# version supported by the component.
+COMPONENT_POST_INSTALL_ACTION += \
+ cd $(PROTO_DIR)/usr/ruby/$(RUBY_VERSION); \
+ $(RUBY_SCRIPT_FIX_FUNC);
--- a/make-rules/shared-macros.mk Tue Oct 04 14:04:16 2016 +0200
+++ b/make-rules/shared-macros.mk Tue Oct 18 15:03:44 2016 -0700
@@ -514,6 +514,14 @@
# both the ruby version and the ruby library version are needed.
RUBY_VERSIONS = $(RUBY_LIB_VERSION)
+# Transform Ruby scripts to call the supported
+# version-specific ruby; used in multiple *.mk files
+RUBY_SCRIPT_FIX_FUNC = \
+ $(GNU_GREP) -Rl '^\#! */usr/bin/env ruby' | \
+ /usr/bin/xargs -I\{\} $(GSED) -i -e \
+ '1s%^\#! */usr/bin/env ruby%\#!/usr/ruby/$(RUBY_VERSION)/bin/ruby%' \
+ \{\}
+
PYTHON.2.7.VENDOR_PACKAGES.32 = /usr/lib/python2.7/vendor-packages
PYTHON.2.7.VENDOR_PACKAGES.64 = /usr/lib/python2.7/vendor-packages/64
PYTHON.2.7.VENDOR_PACKAGES = $(PYTHON.2.7.VENDOR_PACKAGES.$(BITS))