Este contenido no está disponible en el idioma seleccionado.
4.3. Extending the rh-ruby23 Software Collection
In Red Hat Software Collections 2.4, it is possible to extend the rh-ruby23 Software Collection by adding dependent packages. The Ruby on Rails 4.2 (rh-ror42) Software Collection, which is built on top of Ruby 2.3 provided by the rh-ruby23 Software Collection, is one example of such an extension.
This section provides detailed information about the rh-ror42 metapackage and the rh-ror42-rubygem-bcrypt package, which are both part of the rh-ror42 Software Collection.
4.3.1. The rh-ror42 Software Collection Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
This section contains a commented example of the Ruby on Rails 4.2 metapackage for the rh-ror42 Software Collection. The rh-ror42 Software Collection depends on the rh-ruby23 Software Collection.
Note the following in the rh-ror42 Software Collection metapackage example:
- The rh-ror42 Software Collection spec file has the following build dependencies set:
BuildRequires: %{scl_prefix_ruby}scldevel BuildRequires: %{scl_prefix_ruby}rubygems-devel
BuildRequires: %{scl_prefix_ruby}scldevel BuildRequires: %{scl_prefix_ruby}rubygems-devel
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This expands to, for example, rh-ruby23-scldevel and rh-ruby23-rubygems-devel.The rh-ruby23-scldevel subpackage contains two important macros,%scl_ruby
and%scl_prefix_ruby
. The rh-ruby23-scldevel subpackage should be available in the build root. In case there are multiple Ruby Software Collections available, rh-ruby23-scldevel determines which of the available Software Collections should be used.Note that the%scl_ruby
and%scl_prefix_ruby
macros are also defined at the top of the spec file. Although the definitions are not required, they provide a visual hint that the rh-ror42 Software Collection has been designed to be built on top of the rh-ruby23 Software Collection. They also serve as a fallback value. - The rh-ror42-runtime subpackage must depend on the runtime subpackage of the Software Collection it depends on. This dependency is specified as follows:
%package runtime Requires: %{scl_prefix_ruby}runtime
%package runtime Requires: %{scl_prefix_ruby}runtime
Copy to Clipboard Copied! Toggle word wrap Toggle overflow When the package is built against the rh-ruby23 Software Collection, this expands to rh-ruby23-runtime. - The rh-ror42-build subpackage must depend on the scldevel subpackage of the Software Collection it depends on. This is to ensure that all other packages of this Software Collection will have the same macros defined, thus it is built against the same Ruby version.
%package build Requires: %{scl_prefix_ruby}scldevel
%package build Requires: %{scl_prefix_ruby}scldevel
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the case of the rh-ruby23 Software Collection, this expands to rh-ruby23-scldevel. - The
enable
scriptlet for the rh-ror42 Software Collection contains the following line:. scl_source enable %{scl_ruby}
. scl_source enable %{scl_ruby}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note the dot at the beginning of the line. This line makes the Ruby Software Collection start implicitly when the rh-ror42 Software Collection is started so that the user can only typescl enable rh-ror42 command
instead ofscl enable rh-ruby23 rh-ror42 command
to run command in the Software Collection environment. - The rh-ror42-scldevel subpackage is provided so that it is available in case you need it to build a Software Collection which extends the rh-ror42 Software Collection. The package provides the
%{scl_ror}
and%{scl_prefix_ror}
macros, which can be used to extend the rh-ror42 Software Collection. - Because the rh-ror42 Software Collection's gems are installed in a separate root directory structure, you need to ensure that the correct ownership for the rubygems directories is set. This is done by using a snippet to generate a file list rubygems_filesystem.list.You are advised to set the runtime package to own all directories which would, if located in the root file system, be owned by another package. One example of such directories in the case of the rh-ror42 Software Collection is the Rubygem directory structure.