# default dependencies %global hawkey_version 0.73.1 %global libcomps_version 0.1.8 %global libmodulemd_version 2.9.3 %global rpm_version 4.14.0 # conflicts %global conflicts_dnf_plugins_core_version 4.0.26 %global conflicts_dnf_plugins_extras_version 4.0.4 %global conflicts_dnfdaemon_version 0.3.19 %bcond dnf5_obsoletes_dnf %[0%{?fedora} > 40 || 0%{?rhel} > 11] # Iurt causes problems when fake ttys are being created # for the test framework to do its tests, causing them to fail. # Until this is resolved, tests will not be executed by default. %bcond_with tests # YUM compat subpackage configuration # # level=full -> deploy all compat symlinks (conflicts with yum < 4) # level=minimal -> deploy a subset of compat symlinks only # (no conflict with yum >= 3.4.3-505)* # level=preview -> minimal level with altered paths (no conflict with yum < 4) # *release 505 renamed /usr/bin/yum to /usr/bin/yum-deprecated %global yum_compat_level full %global yum_subpackage_name yum %if 0%{?fedora} # Avoid file conflict with yum < 4 in all Fedoras # It can be resolved by pretrans scriptlet but they are not recommended in Fedora %global yum_compat_level minimal %if 0%{?fedora} < 31 # Avoid name conflict with yum < 4 %global yum_subpackage_name %{name}-yum %endif %elif 0%{?mageia} %global yum_compat_level minimal %endif %if 0%{?rhel} && 0%{?rhel} <= 7 %global yum_compat_level preview %global yum_subpackage_name nextgen-yum4 %endif # paths %global confdir %{_sysconfdir}/%{name} %global pluginconfpath %{confdir}/plugins %global py3pluginpath %{python3_sitelib}/%{name}-plugins # Use the same directory of the main package for subpackage licence and docs %global _docdir_fmt %{name} %global pkg_summary Package manager %global pkg_description Utility that allows users to manage packages on their systems. \ It supports RPMs, modules and comps groups & environments. Name: dnf Version: 4.21.1 Release: 1.1%{?dist} Summary: %{pkg_summary} Group: System/Packaging # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPL-2.0-or-later AND GPL-1.0-only URL: https://github.com/rpm-software-management/dnf Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz # Mageia specific patches # The makecache timer disables itself whenever it is run in a live environment. # However, the upstream version of the unit only knows about the upstream dracut # live environment module. Since we currently use a custom one in Mageia, # we need to detect it and properly disable the timer. (ngompa) Patch1001: 1001-Disable-the-dnf-makecache-timer-for-Mageia-live-envi.patch # Per Martin Whitaker's request, the makecache timer should # only get invoked once the user has chosen to use DNF and the cache # has already been generated at least once. # This makes the first run considerably slower, but subsequent runs # should be much faster. (ngompa) Patch1002: 1002-Run-the-makecache-service-timer-only-if-the-DNF-cach.patch BuildArch: noarch BuildRequires: cmake BuildRequires: gettext # For autosetup BuildRequires: git-core # Documentation BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(bash-completion) BuildRequires: python3dist(sphinx) BuildRequires: python3dist(sphinx-rtd-theme) Requires: python3-%{name} = %{version}-%{release} %if 0%{?rhel} && 0%{?rhel} <= 7 Requires: python-dbus Requires: %{_bindir}/sqlite3 %elif 0%{?fedora} Recommends: (%{_bindir}/sqlite3 if (bash-completion and python3-dnf-plugins-core)) %elif 0%{?mageia} Recommends: sqlite3-tools Recommends: python3-dnf-plugins-core Recommends: python3-dbus %else Recommends: (python3dist(dbus-python) if NetworkManager) %endif Conflicts: python3-dnf-plugins-core < %{conflicts_dnf_plugins_core_version} Conflicts: python3-dnf-plugins-extras-common < %{conflicts_dnf_plugins_extras_version} %description %{pkg_description} %package data Summary: Common data and configuration files for DNF Group: System/Packaging %if %{with dnf5_obsoletes_dnf} Requires: /etc/dnf/dnf.conf %endif Obsoletes: %{name}-conf <= %{version}-%{release} Provides: %{name}-conf = %{version}-%{release} %description data Common data and configuration files for DNF %package -n %{yum_subpackage_name} Group: System/Packaging Requires: %{name} = %{version}-%{release} Summary: %{pkg_summary} %if 0%{?fedora} && 0%{?fedora} < 31 Conflicts: yum < 3.4.3-505 %else Provides: %{name}-yum = %{version}-%{release} Obsoletes: %{name}-yum < 5 %endif %description -n %{yum_subpackage_name} %{pkg_description} %package -n python3-%{name} Summary: Python 3 interface to DNF Group: System/Packaging %{?python_provide:%python_provide python3-%{name}} BuildRequires: python3-devel BuildRequires: python3-hawkey >= %{hawkey_version} BuildRequires: python3-libdnf >= %{hawkey_version} BuildRequires: python3-libcomps >= %{libcomps_version} BuildRequires: python3-libdnf BuildRequires: python3-libmodulemd >= %{libmodulemd_version} Requires: %{name}-data = %{version}-%{release} %if 0%{?mageia} Requires: mageia-dnf-conf Recommends: deltarpm # required for DNSSEC main.gpgkey_dns_verification https://dnf.readthedocs.io/en/latest/conf_ref.html Recommends: python3-unbound %endif Requires: python3-hawkey >= %{hawkey_version} Requires: python3-libdnf >= %{hawkey_version} Requires: python3-libcomps >= %{libcomps_version} Requires: python3-libdnf BuildRequires: python3-rpm >= %{rpm_version} Requires: python3-rpm >= %{rpm_version} %if 0%{?rhel} && 0%{?rhel} <= 7 Requires: rpm-plugin-systemd-inhibit %elif 0%{?mageia} Recommends: rpm-plugin-systemd-inhibit %else Recommends: (rpm-plugin-systemd-inhibit if systemd) %endif Provides: dnf-command(alias) Provides: dnf-command(autoremove) Provides: dnf-command(check-update) Provides: dnf-command(clean) Provides: dnf-command(distro-sync) Provides: dnf-command(downgrade) Provides: dnf-command(group) Provides: dnf-command(history) Provides: dnf-command(info) Provides: dnf-command(install) Provides: dnf-command(list) Provides: dnf-command(makecache) Provides: dnf-command(mark) Provides: dnf-command(provides) Provides: dnf-command(reinstall) Provides: dnf-command(remove) Provides: dnf-command(repolist) Provides: dnf-command(repoquery) Provides: dnf-command(repository-packages) Provides: dnf-command(search) Provides: dnf-command(updateinfo) Provides: dnf-command(upgrade) Provides: dnf-command(upgrade-to) %description -n python3-%{name} Python 3 interface to DNF. %package automatic Summary: %{pkg_summary} - automated upgrades Group: System/Packaging BuildRequires: pkgconfig(systemd) Requires: python3-%{name} = %{version}-%{release} %{?systemd_requires} %description automatic Systemd units that can periodically download package upgrades and apply them. %prep %autosetup -S git -p1 %build %cmake -DPYTHON_DESIRED:FILEPATH=%{__python3} -DDNF_VERSION=%{version} -DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name} %cmake_build %cmake_build -t doc-man %install %cmake_install %find_lang %{name} mkdir -p %{buildroot}%{confdir}/vars mkdir -p %{buildroot}%{confdir}/aliases.d mkdir -p %{buildroot}%{pluginconfpath}/ mkdir -p %{buildroot}%{_sysconfdir}/%{name}/modules.d mkdir -p %{buildroot}%{_sysconfdir}/%{name}/modules.defaults.d mkdir -p %{buildroot}%{py3pluginpath}/__pycache__/ mkdir -p %{buildroot}%{_localstatedir}/log/ mkdir -p %{buildroot}%{_var}/cache/dnf/ touch %{buildroot}%{_localstatedir}/log/%{name}.log ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/dnf ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/dnf4 if ! test -f %{buildroot}%{_datadir}/bash-completion/completions/dnf-3; then touch %{buildroot}%{_datadir}/bash-completion/completions/dnf-3 fi 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 mv %{buildroot}%{_bindir}/dnf-automatic-3 %{buildroot}%{_bindir}/dnf-automatic rm -vf %{buildroot}%{_bindir}/dnf-automatic-* # Strict conf distribution %if 0%{?rhel} mv -f %{buildroot}%{confdir}/%{name}-strict.conf %{buildroot}%{confdir}/%{name}.conf %else rm -vf %{buildroot}%{confdir}/%{name}-strict.conf %endif # YUM compat layer ln -sr %{buildroot}%{confdir}/%{name}.conf %{buildroot}%{_sysconfdir}/yum.conf ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/yum %if "%{yum_compat_level}" == "full" mkdir -p %{buildroot}%{_sysconfdir}/yum ln -sr %{buildroot}%{pluginconfpath} %{buildroot}%{_sysconfdir}/yum/pluginconf.d ln -sr %{buildroot}%{confdir}/protected.d %{buildroot}%{_sysconfdir}/yum/protected.d ln -sr %{buildroot}%{confdir}/vars %{buildroot}%{_sysconfdir}/yum/vars %endif %if %{with dnf5_obsoletes_dnf} rm %{buildroot}%{confdir}/%{name}.conf %endif %if 0%{?mageia} # We don't have ABRT/libreport in Mageia rm -rf %{buildroot}%{_sysconfdir}/libreport/ %endif %if "%{version}" >= "4.20.0" && %{without dnf5_obsoletes_dnf} # Create copies so that you can use `man dnf` instead of `man dnf4` # For some reason, symlinks didn't work cp -f %{buildroot}/%{_mandir}/man8/%{name}4.8 %{buildroot}/%{_mandir}/man8/%{name}.8 cp -f %{buildroot}/%{_mandir}/man7/%{name}4.modularity.7 %{buildroot}/%{_mandir}/man7/%{name}.modularity.7 cp -f %{buildroot}/%{_mandir}/man5/%{name}4-transaction-json.5 %{buildroot}/%{_mandir}/man5/%{name}-transaction-json.5 cp -f %{buildroot}/%{_mandir}/man5/%{name}4.conf.5 %{buildroot}/%{_mandir}/man5/%{name}.conf.5 %endif %if %{with tests} %check %ctest %endif %post %systemd_post dnf-makecache.timer %preun %systemd_preun dnf-makecache.timer %postun %systemd_postun_with_restart dnf-makecache.timer %post automatic %systemd_post dnf-automatic.timer dnf-automatic-notifyonly.timer dnf-automatic-download.timer dnf-automatic-install.timer %preun automatic %systemd_preun dnf-automatic.timer dnf-automatic-notifyonly.timer dnf-automatic-download.timer dnf-automatic-install.timer %postun automatic %systemd_postun_with_restart dnf-automatic.timer dnf-automatic-notifyonly.timer dnf-automatic-download.timer dnf-automatic-install.timer %files -f %{name}.lang %license COPYING PACKAGE-LICENSING %doc AUTHORS README.rst %if %{without dnf5_obsoletes_dnf} %{_bindir}/%{name} %endif %if 0%{?rhel} && 0%{?rhel} <= 7 %{_sysconfdir}/bash_completion.d/%{name} %elif 0%{?mageia} %{_datadir}/bash-completion/completions/%{name} %else %{_datadir}/bash-completion/completions/%{name} %endif %{_mandir}/man8/%{name}*.8* %{_mandir}/man8/yum2dnf.8* %{_mandir}/man7/dnf*.modularity.7* %{_mandir}/man5/dnf*-transaction-json.5* %{_unitdir}/%{name}-makecache.service %{_unitdir}/%{name}-makecache.timer %{_var}/cache/%{name}/ %files data %license COPYING PACKAGE-LICENSING %doc AUTHORS README.rst %dir %{confdir} %dir %{confdir}/modules.d %dir %{confdir}/modules.defaults.d %dir %{pluginconfpath} %if %{without dnf5_obsoletes_dnf} %dir %{confdir}/protected.d %dir %{confdir}/vars %endif %dir %{confdir}/aliases.d %exclude %{confdir}/aliases.d/zypper.conf %if %{without dnf5_obsoletes_dnf} # If DNF5 does not obsolete DNF ownership of dnf.conf should be DNF's %config(noreplace) %{confdir}/%{name}.conf %endif %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %ghost %attr(644,-,-) %{_localstatedir}/log/hawkey.log %ghost %attr(644,-,-) %{_localstatedir}/log/%{name}.log %ghost %attr(644,-,-) %{_localstatedir}/log/%{name}.librepo.log %ghost %attr(644,-,-) %{_localstatedir}/log/%{name}.rpm.log %ghost %attr(644,-,-) %{_localstatedir}/log/%{name}.plugin.log %ghost %attr(755,-,-) %dir %{_sharedstatedir}/%{name} %ghost %attr(644,-,-) %{_sharedstatedir}/%{name}/groups.json %ghost %attr(755,-,-) %dir %{_sharedstatedir}/%{name}/yumdb %ghost %attr(755,-,-) %dir %{_sharedstatedir}/%{name}/history %{_mandir}/man5/%{name}*.conf.5* %{_tmpfilesdir}/%{name}.conf %files -n %{yum_subpackage_name} %if "%{yum_compat_level}" == "full" %{_bindir}/yum %{_sysconfdir}/yum.conf %{_sysconfdir}/yum/pluginconf.d %{_sysconfdir}/yum/protected.d %{_sysconfdir}/yum/vars %{_mandir}/man8/yum.8* %{_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 %endif %else %exclude %{_sysconfdir}/yum.conf %exclude %{_sysconfdir}/yum/pluginconf.d %exclude %{_sysconfdir}/yum/protected.d %exclude %{_sysconfdir}/yum/vars %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 %if "%{yum_compat_level}" == "minimal" %{_bindir}/yum %{_mandir}/man8/yum.8* %endif %if "%{yum_compat_level}" == "preview" %{_bindir}/yum4 %{_mandir}/man8/yum4.8* %exclude %{_mandir}/man8/yum.8* %endif %files -n python3-%{name} %license COPYING PACKAGE-LICENSING %doc AUTHORS README.rst %{_bindir}/%{name}-3 %{_bindir}/%{name}4 %dir %{_datadir}/bash-completion %dir %{_datadir}/bash-completion/completions %{_datadir}/bash-completion/completions/%{name}-3 %{_datadir}/bash-completion/completions/%{name}4 %exclude %{python3_sitelib}/%{name}/automatic %{python3_sitelib}/%{name}-*.dist-info %{python3_sitelib}/%{name}/ %dir %{py3pluginpath} %dir %{py3pluginpath}/__pycache__ %files automatic %license COPYING PACKAGE-LICENSING %doc AUTHORS %{_bindir}/%{name}-automatic %config(noreplace) %{confdir}/automatic.conf %{_mandir}/man8/%{name}-automatic.8* %{_unitdir}/%{name}-automatic.service %{_unitdir}/%{name}-automatic.timer %{_unitdir}/%{name}-automatic-notifyonly.service %{_unitdir}/%{name}-automatic-notifyonly.timer %{_unitdir}/%{name}-automatic-download.service %{_unitdir}/%{name}-automatic-download.timer %{_unitdir}/%{name}-automatic-install.service %{_unitdir}/%{name}-automatic-install.timer %{python3_sitelib}/%{name}/automatic/