File dnf.spec of Package dnf
#
# spec file for package dnf
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 Neal Gompa <ngompa13@gmail.com>.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%global hawkey_version 0.11.1
%global librepo_version 1.7.19
%global libcomps_version 0.1.8
%global rpm_version 4.13.0
%global min_plugins_core 2.1.5
%global min_plugins_extras 0.10.0
%global confdir %{_sysconfdir}/%{name}
%global pluginconfpath %{confdir}/plugins
# Compat definitions
%{!?python2_sitelib: %global python2_sitelib %{python_sitelib}}
%{!?make_build: %global make_build %{__make} -O %{?_smp_mflags}}
%global py2pluginpath %{python2_sitelib}/dnf-plugins
%global py3pluginpath %{python3_sitelib}/dnf-plugins
# Disable services units stuff, as we're not using them on openSUSE
%bcond_with service_units
# Tests fail (possibly due to failures in libdnf tests on SUSE)
# Until those are resolved, these will remain disabled
%bcond_with tests
Name: dnf
Version: 2.7.5
Release: 0
Summary: Package manager forked from Yum, using libsolv as a dependency resolver
# For a breakdown of the licensing, see PACKAGE-LICENSING
License: GPL-2.0+ AND GPL-2.0
Group: System/Packages
Url: https://github.com/rpm-software-management/dnf
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM: Ensure DNF can recognize SUSE distro-release and kernel packages properly
# Proposed upstream: https://github.com/rpm-software-management/dnf/pull/1007
Patch0001: 0001-Add-additional-default-distroverpkg-and-installonlyp.patch
# PATCH-FIX-OPENSUSE: Switch default reposdir to /etc/dnf/repos.d
Patch1000: dnf-2.6.3-Switch-default-reposdir-to-etc-dnf-repos.d.patch
# PATCH-FIX-OPENSUSE: Fix detection of Python 2
Patch1001: dnf-2.7.5-Fix-detection-of-Python-2.patch
BuildRequires: cmake
BuildRequires: gettext
BuildRequires: python-Sphinx
BuildRequires: python-bugzilla
Requires: python3-dnf = %{version}-%{release}
Recommends: %{name}-lang >= %{version}
Recommends: dnf-plugins-core
Recommends: dnf-yum
Conflicts: dnf-plugins-core < %{min_plugins_core}
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)
BuildArch: noarch
%if %{with service_units}
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
%endif
%description
DNF is an package manager for RPM systems that was forked from Yum. Among the
many improvements, it uses libsolv as a dependency resolver.
%package conf
Summary: Configuration files for DNF
Group: System/Packages
Recommends: logrotate
%description conf
This package provides the configuration files for DNF.
%package yum
Summary: As a Yum CLI compatibility layer, supplies %{_bindir}/yum redirecting to DNF
Group: System/Packages
Requires: dnf = %{version}-%{release}
Conflicts: yum
%description yum
As a Yum CLI compatibility layer, it supplies %{_bindir}/yum redirecting to DNF.
%package -n python2-dnf
Summary: Python 2 interface to DNF
Group: System/Packages
BuildRequires: python-gpg
BuildRequires: python-pyliblzma
BuildRequires: python2-curses
BuildRequires: python2-devel
BuildRequires: python2-hawkey >= %{hawkey_version}
BuildRequires: python2-iniparse
BuildRequires: python2-libcomps >= %{libcomps_version}
BuildRequires: python2-librepo >= %{librepo_version}
BuildRequires: python2-nose
BuildRequires: rpm-python >= %{rpm_version}
Recommends: (python2-dbus-python if NetworkManager)
Requires: deltarpm
Requires: dnf-conf = %{version}-%{release}
Requires: python-gpg
Requires: python-pyliblzma
Requires: python2-curses
Requires: python2-hawkey >= %{hawkey_version}
Requires: python2-iniparse
Requires: python2-libcomps >= %{libcomps_version}
Requires: python2-librepo >= %{librepo_version}
Requires: rpm-python >= %{rpm_version}
Recommends: bash-completion
# DNF 2.0 doesn't work with old plugins
Conflicts: python2-dnf-plugins-core < %{min_plugins_core}
Conflicts: python2-dnf-plugins-extras-common < %{min_plugins_extras}
Provides: python-dnf = %{version}-%{release}
%description -n python2-dnf
This package provides the Python 2 interface to DNF.
%package -n python3-dnf
Summary: Python 3 interface to DNF
Group: System/Packages
BuildRequires: python3-curses
BuildRequires: python3-devel
BuildRequires: python3-gpg
BuildRequires: python3-hawkey >= %{hawkey_version}
BuildRequires: python3-iniparse
BuildRequires: python3-libcomps >= %{libcomps_version}
BuildRequires: python3-librepo >= %{librepo_version}
BuildRequires: python3-nose
BuildRequires: python3-rpm >= %{rpm_version}
Recommends: (python3-dbus-python if NetworkManager)
Requires: deltarpm
Requires: dnf-conf = %{version}-%{release}
Requires: python3-curses
Requires: python3-gpg
Requires: python3-hawkey >= %{hawkey_version}
Requires: python3-iniparse
Requires: python3-libcomps >= %{libcomps_version}
Requires: python3-librepo >= %{librepo_version}
Requires: python3-rpm >= %{rpm_version}
Recommends: bash-completion
# DNF 2.0 doesn't work with old plugins
Conflicts: python3-dnf-plugins-core < %{min_plugins_core}
Conflicts: python3-dnf-plugins-extras-common < %{min_plugins_extras}
%description -n python3-dnf
This package provides the Python 3 interface to DNF.
%lang_package
%if %{with service_units}
%package automatic
Summary: Alternative CLI to "dnf upgrade" suitable for automatic, regular execution
Group: System/Packages
BuildRequires: systemd-rpm-macros
Requires: dnf = %{version}-%{release}
%{?systemd_requires}
%description automatic
Alternative CLI to "dnf upgrade" suitable for automatic, regular execution.
%endif
%prep
%autosetup -p1
mkdir py3
%build
%cmake
%make_build
make doc-man
pushd ../py3
%cmake -DPYTHON_DESIRED:str=3 -DWITH_MAN=0 ../../
%make_build
popd
%install
pushd ./build
%make_install
popd
pushd ./py3/build
%make_install
popd
%find_lang %{name}
mkdir -p %{buildroot}%{confdir}/repos.d
mkdir -p %{buildroot}%{pluginconfpath}
mkdir -p %{buildroot}%{py2pluginpath}
mkdir -p %{buildroot}%{py3pluginpath}
mkdir -p %{buildroot}%{_sharedstatedir}/dnf
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
mv %{buildroot}%{_bindir}/dnf-automatic-3 %{buildroot}%{_bindir}/dnf-automatic
rm %{buildroot}%{_bindir}/dnf-automatic-2
ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/yum
%if ! %{with service_units}
rm %{buildroot}%{_bindir}/dnf-automatic
rm -rf %{buildroot}%{_unitdir}
rm -rf %{buildroot}%{confdir}/automatic.conf
rm -rf %{buildroot}%{_mandir}/man8/%{name}.automatic.8*
%endif
# We don't have ABRT/libreport in openSUSE
rm -rf %{buildroot}%{_sysconfdir}/libreport
%if %{with tests}
%check
pushd ./build
make ARGS="-V" test
popd
pushd ./py3/build
make ARGS="-V" test
popd
%endif
%files
%license COPYING PACKAGE-LICENSING
%doc AUTHORS README.rst
%{_bindir}/dnf
%{_mandir}/man8/dnf.8.*
%{_mandir}/man8/yum2dnf.8.*
%dir %{_var}/cache/dnf
%if %{with service_units}
%{_unitdir}/dnf-makecache.service
%{_unitdir}/dnf-makecache.timer
%endif
%files lang -f %{name}.lang
%files conf
%license COPYING PACKAGE-LICENSING
%doc AUTHORS README.rst
%dir %{confdir}
%dir %{pluginconfpath}
%dir %{confdir}/protected.d
%dir %{confdir}/repos.d
%config(noreplace) %{confdir}/%{name}.conf
%config(noreplace) %{confdir}/protected.d/%{name}.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%ghost %{_localstatedir}/log/hawkey.log
%ghost %{_localstatedir}/log/%{name}.log
%ghost %{_localstatedir}/log/%{name}.librepo.log
%ghost %{_localstatedir}/log/%{name}.rpm.log
%ghost %{_localstatedir}/log/%{name}.plugin.log
%dir %{_sharedstatedir}/%{name}
%ghost %{_sharedstatedir}/%{name}/groups.json
%ghost %{_sharedstatedir}/%{name}/yumdb
%ghost %{_sharedstatedir}/%{name}/history
%{_sysconfdir}/bash_completion.d/dnf
%{_mandir}/man5/dnf.conf.5.*
%{_tmpfilesdir}/dnf.conf
%files yum
%license COPYING PACKAGE-LICENSING
%doc AUTHORS README.rst
%{_bindir}/yum
%{_mandir}/man8/yum.8.*
%files -n python2-dnf
%license COPYING PACKAGE-LICENSING
%{_bindir}/dnf-2
%doc AUTHORS README.rst
%exclude %{python2_sitelib}/dnf/automatic
%{python2_sitelib}/dnf/
%dir %{py2pluginpath}
%files -n python3-dnf
%license COPYING PACKAGE-LICENSING
%doc AUTHORS README.rst
%{_bindir}/dnf-3
%exclude %{python3_sitelib}/dnf/automatic
%{python3_sitelib}/dnf/
%dir %{py3pluginpath}
%if %{with service_units}
%files automatic
%license COPYING PACKAGE-LICENSING
%doc AUTHORS
%{_bindir}/%{name}-automatic
%config(noreplace) %{confdir}/automatic.conf
%{_mandir}/man8/%{name}.automatic.8.*
%{_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
%post
%systemd_post %{name}-makecache.timer
%preun
%systemd_preun %{name}-makecache.timer
%postun
%systemd_postun_with_restart %{name}-makecache.timer
%post automatic
%systemd_post %{name}-automatic-notifyonly.timer
%systemd_post %{name}-automatic-download.timer
%systemd_post %{name}-automatic-install.timer
%preun automatic
%systemd_preun %{name}-automatic-notifyonly.timer
%systemd_preun %{name}-automatic-download.timer
%systemd_preun %{name}-automatic-install.timer
%postun automatic
%systemd_postun_with_restart %{name}-automatic-notifyonly.timer
%systemd_postun_with_restart %{name}-automatic-download.timer
%systemd_postun_with_restart %{name}-automatic-install.timer
%endif
%changelog