Skip to content

Commit

Permalink
spec: If DNF5 obsoletes DNF, do not build dnf-automatic
Browse files Browse the repository at this point in the history
Fedora CI rpmdeplint test failed for dnf-automic in Fedora 42 because
dnf5-plugin-automatic package obsoletes dnf-automatic package there:

    Upgrade problems:
    dnf-automatic-4.21.1-1.fc42.noarch would be obsoleted by dnf5-plugin-automatic-5.2.5.0-2.fc41.x86_64 from repo fedora-42-x86_64

This patch fixes it by not building dnf-automatic package if a macro
for obsoleting dnf by dnf5 is set. (Similar to a previous
f519e60 commit.)
  • Loading branch information
ppisar authored and jan-kolarik committed Sep 23, 2024
1 parent 7b27428 commit d50a6b2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion dnf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ done
%endif
ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/dnf4
ln -sr %{buildroot}%{_datadir}/bash-completion/completions/dnf-3 %{buildroot}%{_datadir}/bash-completion/completions/dnf4
%if %{without dnf5_obsoletes_dnf}
mv %{buildroot}%{_bindir}/dnf-automatic-3 %{buildroot}%{_bindir}/dnf-automatic
%endif
rm -vf %{buildroot}%{_bindir}/dnf-automatic-*

# Strict conf distribution
Expand All @@ -253,16 +255,28 @@ ln -sr %{buildroot}%{confdir}/vars %{buildroot}%{_sysconfdir}/yum/vars
%endif

%if %{with dnf5_obsoletes_dnf}
rm %{buildroot}%{confdir}/automatic.conf
rm %{buildroot}%{confdir}/%{name}.conf
rm %{buildroot}%{_datadir}/locale/*/LC_MESSAGES/%{name}.mo
rm %{buildroot}%{_mandir}/man8/%{name}-automatic.8*
rm %{buildroot}%{_mandir}/man8/yum2dnf.8*
rm %{buildroot}%{_unitdir}/%{name}-automatic.service
rm %{buildroot}%{_unitdir}/%{name}-automatic.timer
rm %{buildroot}%{_unitdir}/%{name}-automatic-notifyonly.service
rm %{buildroot}%{_unitdir}/%{name}-automatic-notifyonly.timer
rm %{buildroot}%{_unitdir}/%{name}-automatic-download.service
rm %{buildroot}%{_unitdir}/%{name}-automatic-download.timer
rm %{buildroot}%{_unitdir}/%{name}-automatic-install.service
rm %{buildroot}%{_unitdir}/%{name}-automatic-install.timer
rm %{buildroot}%{_unitdir}/%{name}-makecache.service
rm %{buildroot}%{_unitdir}/%{name}-makecache.timer
%endif

%if 0%{?fedora} >= 41 || 0%{?rhel} >= 10
%py3_shebang_fix %{buildroot}%{_bindir}/dnf-3
%if %{without dnf5_obsoletes_dnf}
%py3_shebang_fix %{buildroot}%{_bindir}/dnf-automatic
%endif
%py3_shebang_fix %{buildroot}%{python3_sitelib}/%{name}/cli/completion_helper.py
%endif

Expand All @@ -282,7 +296,6 @@ popd

%postun
%systemd_postun_with_restart dnf-makecache.timer
%endif


%post automatic
Expand All @@ -293,6 +306,7 @@ popd

%postun automatic
%systemd_postun_with_restart dnf-automatic.timer dnf-automatic-notifyonly.timer dnf-automatic-download.timer dnf-automatic-install.timer
%endif


%if %{without dnf5_obsoletes_dnf}
Expand Down Expand Up @@ -389,6 +403,7 @@ popd
%dir %{py3pluginpath}/__pycache__
%{_var}/cache/%{name}/

%if %{without dnf5_obsoletes_dnf}
%files automatic
%{_bindir}/%{name}-automatic
%config(noreplace) %{confdir}/automatic.conf
Expand All @@ -402,6 +417,7 @@ popd
%{_unitdir}/%{name}-automatic-install.service
%{_unitdir}/%{name}-automatic-install.timer
%{python3_sitelib}/%{name}/automatic/
%endif

%changelog
* Wed Aug 14 2024 Evan Goode <mail@evangoo.de> - 4.21.1-1
Expand Down

0 comments on commit d50a6b2

Please # to comment.