Product SiteDocumentation Site

Chapter 3. Advanced Topics

3.1. Software Collection Automatic Provides and Requires and Filtering Support
3.2. Software Collection Macro Files Support
3.3. Packaging Wrappers for Software Collections
3.4. Software Collection Initscript Support
3.5. Software Collection Library Support
3.5.1. Using a Library Outside of the Software Collection
3.5.2. Prefixing the Library Major soname with the Software Collection Name
3.5.3. Software Collection Library Support in Fedora and Enterprise Linux 7
3.6. Software Collection .pc Files Support
3.7. Software Collection MANPATH Support
3.8. Software Collection cronjob Support
3.9. Software Collection Log File Support
3.10. Software Collection logrotate Support
3.11. Software Collection Lock File Support
3.12. Software Collection Configuration Files Support
3.13. Software Collection Kernel Module Support
3.14. Software Collection SELinux Support
3.14.1. SELinux Support in Fedora and Enterprise Linux 7
3.14.2. SELinux Support in Enterprise Linux 5
This chapter discusses advanced topics on packaging Software Collections.

3.1. Software Collection Automatic Provides and Requires and Filtering Support


The functionality described in this section is not available in Enterprise Linux 5 and 6.
RPM in Fedora and Enterprise Linux 7 features support for automatic Provides and Requires and filtering. For example, for all Python libraries, RPM automatically adds the following Requires:
Requires: python(abi) = (version)
As explained in Section 2.9, “Converting a Conventional Spec File”, you should prefix this Requires with %{?scl_prefix} when converting your conventional RPM package:
Requires: %{?scl_prefix}python(abi) = (version))
Keep in mind that the scripts searching for these dependencies must sometimes be rewritten for your Software Collection, as the original RPM scripts are not extensible enough, and, in some cases, filtering is not usable. For example, to rewrite automatic Python Provides and Requires, add the following lines in the macros.%{scl}-config macro file:
%__python_provides /usr/lib/rpm/ --provides %{_scl_root} %{scl_prefix}
%__python_requires /usr/lib/rpm/ --requires %{_scl_root} %{scl_prefix}
The /usr/lib/rpm/ file is based on a file from the conventional package and adjusts search paths.
If there are Provides or Requires that you need to adjust, for example, a pkg_config Provides, there are two ways to do it:
  • Add the following lines in the macros.%{scl}-config macro file so that it applies to all packages in the Software Collection:
    %_use_internal_dependency_generator 0
    %__deploop() while read FILE; do /usr/lib/rpm/rpmdeps -%{1} ${FILE}; done | /bin/sort -u
    %__find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}"
    %__find_requires /bin/sh -c "%{?__filter_req_cmd}  %{__deploop R} %{?__filter_from_req}"
    # Handle pkgconfig's virtual Provides and Requires
    %__filter_from_req | %{__sed} -e 's|pkgconfig|%{?scl_prefix}pkgconfig|g'
    %__filter_from_prov | %{__sed} -e 's|pkgconfig|%{?scl_prefix}pkgconfig|g'
  • Or, alternatively, add the following lines after tag definitions in every spec file for which you want to filter Provides or Requires:
    %{?scl:%filter_from_provides s|pkgconfig|%{?scl_prefix}pkgconfig|g}
    %{?scl:%filter_from_requires s|pkgconfig|%{?scl_prefix}pkgconfig|g}


When using filters, you need to pay attention to the automatic dependencies you change. For example, if the conventional package contains Requires: pkgconfig(package_1) and Requires: pkgconfig(package_2), and only package_2 is included in the Software Collection, ensure that you do not filter the Requires tag for package_1.