Este contenido no está disponible en el idioma seleccionado.
4.2. Extending the python27 and rh-python35 Software Collections
This section describes extending the python27 and rh-python35 Software Collections by creating a dependent Software Collection.
In Red Hat Software Collections 3.8, the scl tool is extended to support a macro
%scl_package_override(), which allows for easier packaging of your own dependent Software Collection.
4.2.1. The vt191 Software Collection Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
Below is a commented example of building a dependent Software Collection. The Software Collection is named
vt191 and contains the versiontools Python package version 1.9.1.
Note the following in the vt191 Software Collection metapackage:
- The vt191 Software Collection metapackage has the following build dependency set:
BuildRequires: %{scl_prefix_python}scldevelBuildRequires: %{scl_prefix_python}scldevelCopy to Clipboard Copied! Toggle word wrap Toggle overflow This expands to, for example, python27-scldevel.The python27-scldevel subpackage ships two important macros,%scl_pythonand%scl_prefix_python. Note that these macros are defined at the top of the metapackage spec file. Although the definitions are not required, they provide a visual hint that the vt191 Software Collection has been designed to be built on top of the python27 Software Collection. They also serve as a fallback value. - To have a
site-packagesdirectory set up properly, use the value of the%python27python_sitelibmacro and replacepython27withvt191. Note that if you are building the Software Collection with a different provider (for example,/opt/myorganization/instead of/opt/rh/), you will need to change these, too.Important
Because the/opt/rh/provider is used to install Software Collections provided by Red Hat, it is strongly recommended to use a different provider to avoid possible conflicts. See Section 2.3, “The Software Collection Root Directory” for more information. - The vt191-build subpackage has the following dependency set:
Requires: %{scl_prefix_python}scldevelRequires: %{scl_prefix_python}scldevelCopy to Clipboard Copied! Toggle word wrap Toggle overflow This expands to, for example, python27-scldevel. The purpose of this dependency is to ensure that the macros are always present when building packages for the vt191 Software Collection. - The
enablescriptlet for the vt191 Software Collection uses the following line:. scl_source enable %{scl_python}. scl_source enable %{scl_python}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note the dot at the beginning of the line. This line makes the Python Software Collection start implicitly when the vt191 Software Collection is started so that the user can only typescl enable vt191 commandinstead ofscl enable python27 vt191 commandto run command in the Software Collection environment. - The macro file
macros.vt191-configcalls the%scl_package_overridefunction to properly override%__os_install_post, Python dependency generators, and certain Python-specific macros used in other packages' spec files.
4.2.2. The python-versiontools Package Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
Below is a commented example of the python-versiontools package spec file. Note the following in the spec file:
- The
BuildRequirestags are prefixed with%{?scl_prefix_python}instead of%{scl_prefix}. - The
%installsection explictly specifies--install-purelib.
4.2.3. Building the vt191 Software Collection Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
To build the vt191 Software Collection:
- Install the python27-scldevel and python27-python-devel subpackages that are part of the python27 Software Collection.
- Build
vt191.specand install the vt191-runtime and vt191-build packages. - Install the python27-python-setuptools package, which is a build requirement for versiontools.
- Build
python-versiontools.spec.
4.2.4. Testing the vt191 Software Collection Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
To test the vt191 Software Collection:
- Install the vt191-python-versiontools package.
- Run the following command:
scl enable vt191 "python -c 'import versiontools; print(versiontools.__file__)'"
$ scl enable vt191 "python -c 'import versiontools; print(versiontools.__file__)'"Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify that the output contains the following line:
/opt/rh/vt191/root/usr/lib/python2.7/site-packages/versiontools/__init__.pyc
/opt/rh/vt191/root/usr/lib/python2.7/site-packages/versiontools/__init__.pycCopy to Clipboard Copied! Toggle word wrap Toggle overflow Note that the providerrhin the path may vary depending on your redefinition of the%_scl_prefixmacro. See Section 2.3, “The Software Collection Root Directory” for more information.