このコンテンツは選択した言語では利用できません。
Chapter 3. Advanced Topics
This chapter discusses advanced topics on packaging Software Collections.
3.1. Software Collection Automatic Provides and Requires and Filtering Support
Important
The functionality described in this section is not available in Red Hat Enterprise Linux 5 and 6.
RPM in Red Hat 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/pythondeps-scl.sh --provides %{_scl_root} %{scl_prefix} %__python_requires /usr/lib/rpm/pythondeps-scl.sh --requires %{_scl_root} %{scl_prefix}
The
/usr/lib/rpm/pythondeps-scl.sh
file is based on a pythondeps.sh
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
orRequires
:%{?scl:%filter_from_provides s|pkgconfig|%{?scl_prefix}pkgconfig|g} %{?scl:%filter_from_requires s|pkgconfig|%{?scl_prefix}pkgconfig|g} %{?scl:%filter_setup}
Important
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.