Limit deps and don't ship Fedora config in RHEL builds

RHEL does not include dash or checkbashisms, which are only used for one
specific linter, nor pytest-xdist used in the tests.  Also, limit
Fedora-specific configuration to Fedora builds.
This commit is contained in:
Yaakov Selkowitz 2023-05-23 00:36:05 -04:00 committed by Todd Zullinger
parent 52c9006a4d
commit 071348f40e

View File

@ -3,7 +3,7 @@
Name: rpmlint Name: rpmlint
Version: 2.4.0 Version: 2.4.0
Release: 7%{?dist} Release: 8%{?dist}
Summary: Tool for checking common errors in RPM packages Summary: Tool for checking common errors in RPM packages
License: GPL-2.0-or-later License: GPL-2.0-or-later
URL: https://github.com/rpm-software-management/rpmlint URL: https://github.com/rpm-software-management/rpmlint
@ -35,21 +35,29 @@ BuildRequires: git-core
BuildRequires: python3-devel BuildRequires: python3-devel
# tests # tests
%if %{with tests} %if %{with tests}
%if ! 0%{?rhel}
BuildRequires: dash BuildRequires: dash
BuildRequires: devscripts-checkbashisms BuildRequires: devscripts-checkbashisms
%endif
BuildRequires: hunspell-cs BuildRequires: hunspell-cs
BuildRequires: hunspell-en-US BuildRequires: hunspell-en-US
BuildRequires: python3dist(pytest) BuildRequires: python3dist(pytest)
%if ! 0%{?rhel}
BuildRequires: python3dist(pytest-xdist) BuildRequires: python3dist(pytest-xdist)
%endif
BuildRequires: /usr/bin/appstream-util BuildRequires: /usr/bin/appstream-util
BuildRequires: /usr/bin/desktop-file-validate BuildRequires: /usr/bin/desktop-file-validate
%endif %endif
%if ! 0%{?rhel}
Requires: dash Requires: dash
Requires: devscripts-checkbashisms Requires: devscripts-checkbashisms
%endif
Requires: rpm-build Requires: rpm-build
Requires: /usr/bin/appstream-util Requires: /usr/bin/appstream-util
Requires: /usr/bin/desktop-file-validate Requires: /usr/bin/desktop-file-validate
%if 0%{?fedora}
Requires: rpmlint-fedora-license-data Requires: rpmlint-fedora-license-data
%endif
%description %description
rpmlint is a tool for checking common errors in RPM packages. Binary rpmlint is a tool for checking common errors in RPM packages. Binary
@ -62,7 +70,8 @@ and source packages as well as spec files can be checked.
sed -i 's/python-magic/file-magic/g' setup.py sed -i 's/python-magic/file-magic/g' setup.py
# Don't lint the code or measure coverage in %%check # Don't lint the code or measure coverage in %%check
sed -i -e 's/ --cov=rpmlint//' -e 's/ --flake8//' setup.cfg # On RHEL, also avoid xdist by disabling parallelism
sed -i -e 's/ --cov=rpmlint//' -e 's/ --flake8//' %{?rhel:-e 's/ -n auto//'} setup.cfg
# Avoid warnings about pytest.mark.no_cover marker # Avoid warnings about pytest.mark.no_cover marker
sed -i '/^@pytest.mark.no_cover/d' test/test_lint.py sed -i '/^@pytest.mark.no_cover/d' test/test_lint.py
@ -78,7 +87,9 @@ sed -i '/^@pytest.mark.no_cover/d' test/test_lint.py
%pyproject_save_files %{name} %pyproject_save_files %{name}
mkdir -p %{buildroot}%{_sysconfdir}/xdg/rpmlint/ mkdir -p %{buildroot}%{_sysconfdir}/xdg/rpmlint/
%if 0%{?fedora}
cp -a %{SOURCE1} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{buildroot}%{_sysconfdir}/xdg/rpmlint/ cp -a %{SOURCE1} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{buildroot}%{_sysconfdir}/xdg/rpmlint/
%endif
%check %check
%if %{with tests} %if %{with tests}
@ -88,11 +99,16 @@ cp -a %{SOURCE1} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{buildroot}%{_sysconfdir}/xdg
%files -f %{pyproject_files} %files -f %{pyproject_files}
%doc README.md %doc README.md
%dir %{_sysconfdir}/xdg/rpmlint %dir %{_sysconfdir}/xdg/rpmlint
%if 0%{?fedora}
%config(noreplace) %{_sysconfdir}/xdg/rpmlint/*.toml %config(noreplace) %{_sysconfdir}/xdg/rpmlint/*.toml
%endif
%{_bindir}/rpmdiff %{_bindir}/rpmdiff
%{_bindir}/rpmlint %{_bindir}/rpmlint
%changelog %changelog
* Thu May 25 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 2.4.0-8
- Limit deps and don't ship Fedora config in RHEL builds
* Thu May 25 2023 Todd Zullinger <tmz@pobox.com> - 2.4.0-7 * Thu May 25 2023 Todd Zullinger <tmz@pobox.com> - 2.4.0-7
- adjust for rpm-4.19.0 API changes - adjust for rpm-4.19.0 API changes