Blob Blame History Raw
%{?!dnf_lowest_compatible: %global dnf_lowest_compatible 1.1.9}
%{?!dnf_not_compatible: %global dnf_not_compatible 2.0}
%global hawkey_version 0.6.1

%if 0%{?rhel} && 0%{?rhel} <= 7
%bcond_with python3
%else
%bcond_without python3
%endif

Name:           dnf-plugins-core
Version:        0.1.21
Release:        3%{?dist}
Summary:        Core Plugins for DNF
License:        GPLv2+
URL:            https://github.com/rpm-software-management/dnf-plugins-core
Source0:        %{url}/archive/%{name}-%{version}/%{name}-%{version}.tar.gz
Patch0001:      0001-Change-name-of-def-valid.patch
BuildArch:      noarch
BuildRequires:  cmake
BuildRequires:  gettext
%if %{with python3}
Requires:       python3-%{name} = %{version}-%{release}
%else
Requires:       python2-%{name} = %{version}-%{release}
%endif
Provides:       dnf-command(builddep)
Provides:       dnf-command(config-manager)
Provides:       dnf-command(copr)
Provides:       dnf-command(debuginfo-install)
Provides:       dnf-command(download)
Provides:       dnf-command(repoquery)
Provides:       dnf-command(reposync)

%description
Core Plugins for DNF. This package enhances DNF with builddep, config-manager,
copr, debuginfo-install, download, needs-restarting, repoquery and
reposync commands. Additionally provides generate_completion_cache, noroot and
protected_packages passive plugins.

%package -n python2-%{name}
Summary:        Core Plugins for DNF
%{?python_provide:%python_provide python2-%{name}}
BuildRequires:  python2-dnf >= %{dnf_lowest_compatible}
BuildRequires:  python2-dnf < %{dnf_not_compatible}
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires:  python-nose
%else
BuildRequires:  python2-nose
%endif
BuildRequires:  python-sphinx
BuildRequires:  python2-devel
Requires:       python2-dnf >= %{dnf_lowest_compatible}
Requires:       python2-dnf < %{dnf_not_compatible}
Requires:       python-hawkey >= %{hawkey_version}
Conflicts:      %{name} <= 0.1.5
# let the both python plugin versions be updated simultaneously
Conflicts:      python3-%{name} < %{version}-%{release}
Conflicts:      python-%{name} < %{version}-%{release}

%description -n python2-%{name}
Core Plugins for DNF, Python 2 interface. This package enhances DNF with builddep, copr,
config-manager, debuginfo-install, download, needs-restarting, repoquery and
reposync commands. Additionally provides generate_completion_cache, noroot and
protected_packages passive plugins.

%if %{with python3}
%package -n python3-%{name}
Summary:    Core Plugins for DNF
%{?python_provide:%python_provide python3-%{name}}
BuildRequires:  python3-devel
BuildRequires:  python3-dnf >= %{dnf_lowest_compatible}
BuildRequires:  python3-dnf < %{dnf_not_compatible}
BuildRequires:  python3-nose
BuildRequires:  python3-sphinx
Requires:       python3-dnf >= %{dnf_lowest_compatible}
Requires:       python3-dnf < %{dnf_not_compatible}
Requires:       python3-hawkey >= %{hawkey_version}
Conflicts:      %{name} <= 0.1.5
# let the both python plugin versions be updated simultaneously
Conflicts:      python2-%{name} < %{version}-%{release}
Conflicts:      python-%{name} < %{version}-%{release}

%description -n python3-%{name}
Core Plugins for DNF, Python 3 interface. This package enhances DNF with builddep, copr,
config-manager, debuginfo-install, download, needs-restarting, repoquery and
reposync commands. Additionally provides generate_completion_cache, noroot and
protected_packages passive plugins.
%endif

%prep
%autosetup -p1
mkdir build-py2
%if %{with python3}
mkdir build-py3
%endif

%build
pushd build-py2
  %cmake ../
  %make_build
  make doc-man
popd
%if %{with python3}
pushd build-py3
  %cmake ../ -DPYTHON_DESIRED:str=3
  %make_build
  make doc-man
popd
%endif

%install
pushd build-py2
  %make_install
popd
%if %{with python3}
pushd build-py3
  %make_install
popd
%endif
%find_lang %{name}

%check
PYTHONPATH=./plugins nosetests-%{python2_version} -s tests/
%if %{with python3}
PYTHONPATH=./plugins nosetests-%{python3_version} -s tests/
%endif

%files
%{_mandir}/man8/dnf.plugin.*

%files -n python2-%{name} -f %{name}.lang
%license COPYING
%doc AUTHORS README.rst
%dir %{_sysconfdir}/dnf/protected.d
%ghost %{_var}/cache/dnf/packages.db
%config %{_sysconfdir}/dnf/plugins/*
%{python2_sitelib}/dnf-plugins/*
%{python2_sitelib}/dnfpluginscore/

%if %{with python3}
%files -n python3-%{name} -f %{name}.lang
%license COPYING
%doc AUTHORS README.rst
%dir %{_sysconfdir}/dnf/protected.d
%ghost %{_var}/cache/dnf/packages.db
%config %{_sysconfdir}/dnf/plugins/*
%exclude %{python3_sitelib}/dnf-plugins/__pycache__/
%exclude %{python3_sitelib}/dnf-plugins/kickstart.py
%{python3_sitelib}/dnf-plugins/*
%{python3_sitelib}/dnf-plugins/__pycache__/*
%{python3_sitelib}/dnfpluginscore/
%endif

%changelog
* Thu Aug 18 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.1.21-3
- Backport patch for copr for guessing chroot
- Trim changelog

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.21-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Fri May 27 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.1.21-2
- spec: explicitly conflict with python-%%{name} with different version

* Thu May 19 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.1.21-1
- update to 0.1.21