Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

spec: If DNF5 obsoletes DNF, do not build dnf and yum packages #2123

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions dnf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,17 @@ mkdir -p %{buildroot}%{py3pluginpath}/__pycache__/
mkdir -p %{buildroot}%{_localstatedir}/log/
mkdir -p %{buildroot}%{_var}/cache/dnf/
touch %{buildroot}%{_localstatedir}/log/%{name}.log
%if %{without dnf5_obsoletes_dnf}
ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/dnf
ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/dnf4
ln -sr %{buildroot}%{_datadir}/bash-completion/completions/dnf-3 %{buildroot}%{_datadir}/bash-completion/completions/dnf4
ln -sr %{buildroot}%{_datadir}/bash-completion/completions/dnf-3 %{buildroot}%{_datadir}/bash-completion/completions/dnf
for file in %{buildroot}%{_mandir}/man[578]/dnf4[-.]*; do
dir=$(dirname $file)
filename=$(basename $file)
ln -sr $file $dir/${filename/dnf4/dnf}
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
mv %{buildroot}%{_bindir}/dnf-automatic-3 %{buildroot}%{_bindir}/dnf-automatic
rm -vf %{buildroot}%{_bindir}/dnf-automatic-*

Expand All @@ -238,6 +240,7 @@ mv -f %{buildroot}%{confdir}/%{name}-strict.conf %{buildroot}%{confdir}/%{name}.
rm -vf %{buildroot}%{confdir}/%{name}-strict.conf
%endif

%if %{without dnf5_obsoletes_dnf}
# YUM compat layer
ln -sr %{buildroot}%{confdir}/%{name}.conf %{buildroot}%{_sysconfdir}/yum.conf
ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/yum
Expand All @@ -247,10 +250,14 @@ ln -sr %{buildroot}%{pluginconfpath} %{buildroot}%{_sysconfdir}/yum/pluginconf.
ln -sr %{buildroot}%{confdir}/protected.d %{buildroot}%{_sysconfdir}/yum/protected.d
ln -sr %{buildroot}%{confdir}/vars %{buildroot}%{_sysconfdir}/yum/vars
%endif
%endif

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

%if 0%{?fedora} >= 41 || 0%{?rhel} >= 10
Expand All @@ -266,6 +273,7 @@ ctest -VV
popd


%if %{without dnf5_obsoletes_dnf}
%post
%systemd_post dnf-makecache.timer

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

%postun
%systemd_postun_with_restart dnf-makecache.timer
%endif


%post automatic
Expand All @@ -286,6 +295,7 @@ popd
%systemd_postun_with_restart dnf-automatic.timer dnf-automatic-notifyonly.timer dnf-automatic-download.timer dnf-automatic-install.timer


%if %{without dnf5_obsoletes_dnf}
%files -f %{name}.lang
%{_bindir}/%{name}
%if 0%{?rhel} && 0%{?rhel} <= 7
Expand All @@ -299,6 +309,7 @@ popd
%{_mandir}/man5/dnf-transaction-json.5*
%{_unitdir}/%{name}-makecache.service
%{_unitdir}/%{name}-makecache.timer
%endif

%files data
%license COPYING PACKAGE-LICENSING
Expand Down Expand Up @@ -333,6 +344,7 @@ popd
%endif
%{_tmpfilesdir}/%{name}.conf

%if %{without dnf5_obsoletes_dnf}
%files -n %{yum_subpackage_name}
%{_bindir}/yum
%{_mandir}/man8/yum.8*
Expand All @@ -342,20 +354,20 @@ popd
%{_mandir}/man5/yum.conf.5.*
%{_mandir}/man8/yum-shell.8*
%{_mandir}/man1/yum-aliases.1*
%if %{without dnf5_obsoletes_dnf}
# If DNF5 does not obsolete DNF, protected.d/yum.conf should be owned by DNF
%config(noreplace) %{confdir}/protected.d/yum.conf
%else
# If DNF5 obsoletes DNF
# No longer using `noreplace` here. Older versions of DNF 4 marked `yum` as a
# protected package, but since Fedora 39, DNF needs to be able to update itself
# to DNF 5, so we need to replace the old /etc/dnf/protected.d/yum.conf.
%config %{confdir}/protected.d/yum.conf
%exclude %{_sysconfdir}/yum.conf
%exclude %{confdir}/protected.d/yum.conf
%exclude %{_mandir}/man5/yum.conf.5.*
%exclude %{_mandir}/man8/yum-shell.8*
%exclude %{_mandir}/man1/yum-aliases.1*
%endif
%else
%exclude %{_sysconfdir}/yum.conf
# No %%{yum_subpackage_name} package
%exclude %{confdir}/protected.d/yum.conf
%exclude %{_mandir}/man5/yum.conf.5.*
%exclude %{_mandir}/man8/yum.8*
%exclude %{_mandir}/man8/yum-shell.8*
%exclude %{_mandir}/man1/yum-aliases.1*
%endif
Expand Down
Loading