Alexander Pyhalov
2014-11-25 18b823443b1bef8afd001aeb790d47a48e1278c9
Prepare oi-userland for ruby-19 migration (upstream changes)
1 files added
7 files modified
161 ■■■■■ changed files
make-rules/gem.mk 61 ●●●●● patch | view | raw | blame | history
make-rules/install.rb.mk 4 ●●● patch | view | raw | blame | history
make-rules/ips.mk 58 ●●●●● patch | view | raw | blame | history
make-rules/shared-macros.mk 11 ●●●● patch | view | raw | blame | history
tools/userland-unpack 4 ●●●● patch | view | raw | blame | history
transforms/defaults 2 ●●● patch | view | raw | blame | history
transforms/docs 9 ●●●●● patch | view | raw | blame | history
transforms/mkgeneric 12 ●●●●● patch | view | raw | blame | history
make-rules/gem.mk
New file
@@ -0,0 +1,61 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
#
GEM=/usr/ruby/$(RUBY_VERSION)/bin/gem
VENDOR_GEM_DIR=/usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/gems/$(RUBY_LIB_VERSION)
# Name of the gem spec to use.  This will typically be
# <component_name>.gemspec
GEMSPEC=$(COMPONENT_NAME).gemspec
# Some gems projects have to be built using rake
# Allow GEM build/install commands to be overwritten
# to account for possible differences
GEM_BUILD_ACTION=(cd $(@D); $(GEM) build $(GEMSPEC))
GEM_INSTALL_ACTION=\
    $(GEM) install -V --local --install-dir $(PROTO_DIR)/$(VENDOR_GEM_DIR) \
         --bindir $(PROTO_DIR)/$(VENDOR_GEM_DIR)/bin --force \
         $(@D)/$(COMPONENT_ARCHIVE)
$(BUILD_DIR)/%/.built:  $(SOURCE_DIR)/.prep
    $(RM) -r $(@D) ; $(MKDIR) $(@D)
    $(CLONEY) $(SOURCE_DIR) $(@D)
    $(COMPONENT_PRE_BUILD_ACTION)
    # Build the gem and cause the generation of a new gem spec
    # file in $(COMPONENT_SRC)
    $(GEM_BUILD_ACTION)
    $(COMPONENT_POST_BUILD_ACTION)
    $(TOUCH) $@
$(BUILD_DIR)/%/.installed:      $(BUILD_DIR)/%/.built
    $(COMPONENT_PRE_INSTALL_ACTION)
    $(MKDIR) $(PROTO_DIR)/$(GEM_DIR)
    # Install the new recreated gem
    $(GEM_INSTALL_ACTION)
    $(COMPONENT_POST_INSTALL_ACTION)
    $(TOUCH) $@
clean::
    $(RM) -r $(SOURCE_DIR) $(BUILD_DIR)
make-rules/install.rb.mk
@@ -18,9 +18,10 @@
#
# CDDL HEADER END
#
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
#
VENDOR_RUBY = /usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/$(RUBY_LIB_VERSION)
# default user executable binaries to /usr/bin
INSTALL_RB_BINDIR =    $(USRBINDIR)
@@ -38,6 +39,7 @@
    $(COMPONENT_PRE_INSTALL_ACTION)
    (cd $(SOURCE_DIR) ; $(ENV) $(COMPONENT_INSTALL_ENV) \
                ./install.rb --destdir=$(PROTO_DIR) \
                --ruby=$(RUBY) \
                --bindir=$(INSTALL_RB_BINDIR) \
                --sitelibdir=$(VENDOR_RUBY) \
                --mandir=$(USRSHAREMANDIR))
make-rules/ips.mk
@@ -136,10 +136,28 @@
NOPERL_MANIFESTS = $(UNVERSIONED_MANIFESTS)
endif
# Look for manifests which need to be duplicated for each version of ruby.
# NOPERL_MANIFESTS represents the manifests that are not Python or
# Perl manifests.  Extract the Ruby Manifests from NOPERL_MANIFESTS.
# Any remaining manifests are stored in NONRUBY_MANIFESTS
ifeq ($(findstring -RUBYVER,$(NOPERL_MANIFESTS)),-RUBYVER)
NORUBY_MANIFESTS = $(filter-out %GENFRAG.p5m,\
                      $(filter-out %-RUBYVER.p5m,$(NOPERL_MANIFESTS)))
RUBY_MANIFESTS = $(filter %-RUBYVER.p5m,$(NOPERL_MANIFESTS))
RUBYV_MANIFESTS = $(foreach v,$(shell echo $(RUBY_VERSIONS)),\
                      $(shell echo $(RUBY_MANIFESTS) |\
                      sed -e 's/-RUBYVER.p5m/-$(shell echo $(v) |\
                      cut -d. -f1,2 | tr -d .).p5m/g'))
RUBYNV_MANIFESTS = $(shell echo $(RUBY_MANIFESTS) | sed -e 's/-RUBYVER//')
else
NORUBY_MANIFESTS = $(NOPERL_MANIFESTS)
endif
VERSIONED_MANIFESTS = \
    $(PYV_MANIFESTS) $(PYNV_MANIFESTS) \
    $(PERLV_MANIFESTS) $(PERLNV_MANIFESTS) \
    $(NOPERL_MANIFESTS)
    $(RUBYV_MANIFESTS) $(RUBYNV_MANIFESTS) \
    $(NORUBY_MANIFESTS)
GENERATED =        $(MANIFEST_BASE)-generated
COMBINED =        $(MANIFEST_BASE)-combined
@@ -231,6 +249,44 @@
        $(WS_TOP)/transforms/mkgeneric $< > $@
    if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
# Define and execute a macro that generates a rule to create a manifest for a
# ruby module specific to a particular version of the ruby runtime.
# Creates build/manifest-*-modulename-##.p5m file where ## is replaced with
# the version number.
define ruby-manifest-rule
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: \
        PKG_MACROS += RUBY_VERSION=$(1) RUBY_LIB_VERSION=$(2) \
            RUBYV=$(subst .,,$(1))
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-RUBYVER.p5m
    if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then \
            cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; \
    fi
    $(PKGMOGRIFY) -D RUBY_VERSION=$(1) -D RUBY_LIB_VERSION=$(2) \
        -D RUBYV=$(shell echo $(1) | tr -d .) $$< > $$@
endef
$(foreach ver,$(RUBY_VERSIONS),\
        $(eval $(call ruby-manifest-rule,$(shell echo $(ver) | \
            cut -d. -f1,2),$(ver))))
# A rule to create a helper transform package for ruby, that will insert the
# appropriate conditional dependencies into a ruby library's
# runtime-version-generic package to pull in the version-specific bits when the
# corresponding version of ruby is on the system.
$(BUILD_DIR)/mkgeneric-ruby: $(WS_TOP)/make-rules/shared-macros.mk
    $(RM) $@
    $(foreach ver,$(RUBY_VERSIONS),\
            $(call mkgeneric,runtime/ruby,$(shell echo $(ver) | \
                cut -d. -f1,2 | tr -d .)))
# Build Ruby version-wrapping manifests from the generic version.
# Creates build/manifest-*-modulename.p5m file.
#
$(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby
    $(PKGMOGRIFY) -D RUBYV=### $(BUILD_DIR)/mkgeneric-ruby \
            $(WS_TOP)/transforms/mkgeneric $< > $@
    if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
ifeq   ($(strip $(COMPONENT_AUTOGEN_MANIFEST)),yes)
# auto-generate file/directory list
$(MANIFEST_BASE)-%.generated:    %.p5m $(BUILD_DIR)
make-rules/shared-macros.mk
@@ -304,9 +304,14 @@
F77 =        $(F77.$(COMPILER).$(BITS))
FC =        $(FC.$(COMPILER).$(BITS))
RUBY_VERSION =    1.8
RUBY.1.8 =    /usr/bin/ruby18
VENDOR_RUBY =    /usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/$(RUBY_VERSION)
RUBY_VERSION =  1.9
RUBY_LIB_VERSION =      1.9.1
RUBY.1.9 =      /usr/ruby/1.9/bin/ruby
RUBY =          $(RUBY.$(RUBY_VERSION))
# Use the ruby lib versions to represent the RUBY_VERSIONS that
# need to get built.  This is done because during package transformations
# both the ruby version and the ruby library version are needed.
RUBY_VERSIONS = $(RUBY_LIB_VERSION)
PYTHON_VENDOR_PACKAGES.32 = /usr/lib/python$(PYTHON_VERSION)/vendor-packages
PYTHON_VENDOR_PACKAGES.64 = /usr/lib/python$(PYTHON_VERSION)/vendor-packages/64
tools/userland-unpack
@@ -48,6 +48,8 @@
        uncompress = "/usr/bin/xz -dc"
    elif (re.search("(\.zip)$", filename) != None):
        uncompress = "/usr/bin/unzip -qo"
    elif (re.search("(\.gem)$", filename) != None):
        uncompress = "/usr/bin/gem unpack"
    unpack = " | gtar -xf -"
@@ -55,6 +57,8 @@
        unpack = ""
    elif (re.search("(\.jar)$", filename) != None):
        unpack = " | jar xf -"
    elif (re.search("(\.gem)$", filename) != None):
        unpack = ""
    if (verbose == True):
        print "command: %s %s %s" % (uncompress, filename, unpack)
transforms/defaults
@@ -142,7 +142,7 @@
#
# Set the default Ruby for mediated links
#
<transform link mediator=ruby mediator-version=1.8 -> default mediator-priority vendor>
<transform link mediator=ruby mediator-version=1.9 -> default mediator-priority vendor>
#
# Add a facet.version-lock.{package} to each 'optional' consolidation
transforms/docs
@@ -42,6 +42,9 @@
    default facet.doc.html all>
<transform dir file link hardlink path=usr/lib/help/.*\.html$ -> \
    default facet.doc.html all>
# Ruby API html docs
<transform file path=usr/ruby/.*/lib/ruby/vendor_ruby/.*/doc/.*/rdoc/* -> \
    default facet.doc.html all>
# pdf docs
<transform dir file link hardlink path=usr/.*/doc/.*\.pdf$ -> \
@@ -50,6 +53,11 @@
# ps docs
<transform dir file link hardlink path=usr/.*/doc/.*\.ps$ -> \
    default facet.doc.ps all>
# Ruby API ri Docs
<transform file path=usr/ruby/.*/lib/ruby/vendor_ruby/.*/doc/.*/ri/* -> \
    default facet.doc.ri all>
<transform file path=usr/ruby/.*/share/ri/.*/* -> default facet.doc.ri all>
# general documentation
<transform dir file link hardlink path=usr/.*/doc(/.+){0,1}$ -> \
@@ -60,3 +68,4 @@
<transform dir file link hardlink facet.doc.info=all -> delete facet.doc all>
<transform dir file link hardlink facet.doc.pdf=all -> delete facet.doc all>
<transform dir file link hardlink facet.doc.man=all -> delete facet.doc all>
<transform dir file link hardlink facet.doc.ri=all -> delete facet.doc all>
transforms/mkgeneric
@@ -20,7 +20,7 @@
#
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
#
# This set of transforms helps us take a package that's parameterized on a
@@ -34,14 +34,16 @@
#
# We do this by grabbing just the set actions from "mako-generic", and emitting
# those conditional depend actions.  We require that the parameterized package
# name end in "-###" (typically by setting a pkgmogrify variable to "###"),
# which we also remove here.  This works in conjunction with a set of rules in
# make-rules/ips.mk which create and use another transform file that actually
# emit the conditional dependencies.
# name end in "-###PYV###" (typically by setting a pkgmogrify variable to
# "###PYV###"), which we also remove here.  This works in conjunction with a set
# of rules in make-rules/ips.mk which create and use another transform file
# that actually emit the conditional dependencies.
<transform file dir link hardlink license user group driver legacy signature -> drop>
<transform depend -> default nodrop false>
<transform depend nodrop=false -> drop>
<transform set name=pkg.fmri value=(?:pkg:/)?(.+)-###PYV###@(.*) -> \
    edit value -###PYV### "">
<transform set name=pkg.fmri value=(?:pkg:/)?(.+)-###@(.*) -> \
    edit value -### "">
<transform depend nodrop=true -> delete nodrop true>