Make provides/requires filtering smarter/automatic

The issue with the previous approach was that _everything_ that
firefox's shared libraries required was filtered out. This included e.g.
libxul.so's dependency on libdbus-glib-1.so.2 which definitely should
not be filtered out.

Instead, a better approach is to only filter out all of the private
libraries provides (as they are firefox's implementation detail) and
also all the internal requires on the same private libraries.

RPM doesn't make it very easy, but the rudimentary filtering is there
and we can build upon that. This commit improves the filtering by making
it actually look at what's built, and automatically generating the list
of private libraries to filter based on that.

This also lets us drop manual dbus-glib requires and instead rely on
rpm's automatic dep generator (the results are no longer filtered out).

This should make the filtering future proof when more private libraries
are added in the future (e.g. nss).

https://bugzilla.redhat.com/show_bug.cgi?id=1582116
This commit is contained in:
Kalev Lember 2021-01-28 14:26:06 +01:00
parent 3ee1da498c
commit 00f050ca50

View File

@ -145,10 +145,14 @@ ExcludeArch: s390x
%global pre_tag .debug %global pre_tag .debug
%endif %endif
# Exclude private libraries from autogenerated provides and requires
%global __provides_exclude_from ^%{mozappdir}
%global __requires_exclude ^(%%(find %{buildroot}%{mozappdir} -name '*.so' | xargs -n1 basename | sort -u | paste -s -d '|' -))
Summary: Mozilla Firefox Web browser Summary: Mozilla Firefox Web browser
Name: firefox Name: firefox
Version: 85.0 Version: 85.0
Release: 5%{?pre_tag}%{?dist} Release: 6%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/firefox/ URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+ License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
@ -287,7 +291,6 @@ Requires: mozilla-filesystem
Recommends: mozilla-openh264 >= 2.1.1 Recommends: mozilla-openh264 >= 2.1.1
Recommends: libva Recommends: libva
Requires: p11-kit-trust Requires: p11-kit-trust
Requires: dbus-glib
%if %{?system_nss} %if %{?system_nss}
Requires: nspr >= %{nspr_build_version} Requires: nspr >= %{nspr_build_version}
Requires: nss >= %{nss_build_version} Requires: nss >= %{nss_build_version}
@ -716,19 +719,6 @@ xvfb-run ./mach build 2>&1 | cat -
make -C objdir buildsymbols make -C objdir buildsymbols
%endif %endif
# Don't provide/require bundled libs
%filter_provides_in %{mozappdir}/
%filter_requires_in %{mozappdir}/
%filter_provides_in %{mozappdir}/gmp-clearkey/0.1/
%filter_requires_in %{mozappdir}/gmp-clearkey/0.1/
%filter_provides_in %{mozappdir}/gtk2
%filter_requires_in %{mozappdir}/gtk2
# Do not check .so files in an application-specific library directory
# or any files in the application's data directory for provides
%global __requires_exclude_from ^(%{_libdir}/%{name}/.*\\.so.*|%{_libdir}/%{name}/gmp-clearkey/0.1/.*\\.so.*|%{_libdir}/%{name}/gtk2/.*\\.so.*)$
%global __provides_exclude_from ^(%{_libdir}/%{name}/.*\\.so.*|%{_libdir}/%{name}/gmp-clearkey/0.1/.*\\.so.*|%{_libdir}/%{name}/gtk2/.*\\.so.*)$
%global __requires_exclude ^libxul.*$
# run Firefox test suite # run Firefox test suite
%if 0%{?run_firefox_tests} %if 0%{?run_firefox_tests}
mkdir -p objdir/_virtualenvs/init_py3 mkdir -p objdir/_virtualenvs/init_py3
@ -1020,6 +1010,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#--------------------------------------------------------------------- #---------------------------------------------------------------------
%changelog %changelog
* Thu Jan 28 2021 Kalev Lember <klember@redhat.com> - 85.0-6
- Make provides/requires filtering smarter/automatic (rhbz#1582116)
- Drop dbus-glib requires that are now automatically generated again
* Thu Jan 28 2021 Martin Stransky <stransky@redhat.com> - 85.0-5 * Thu Jan 28 2021 Martin Stransky <stransky@redhat.com> - 85.0-5
- Add dbus-glib requires. - Add dbus-glib requires.