dcavalca / rpms / libdnf

Forked from rpms/libdnf 2 years ago
Clone
90b570
%global libsolv_version 0.6.34-1
90b570
%global libmodulemd_version 1.6.1
90b570
%global dnf_conflict 4.0.9.2
90b570
%global swig_version 3.0.12
d57e47
d57e47
%bcond_with valgrind
d57e47
d57e47
# Do not build bindings for python3 for RHEL <= 7
d57e47
%if 0%{?rhel} && 0%{?rhel} <= 7
d57e47
%bcond_with python3
d57e47
%else
d57e47
%bcond_without python3
d57e47
%endif
d57e47
90b570
%if 0%{?rhel} > 7 || 0%{?fedora} > 29
90b570
# Disable python2 build by default
90b570
%bcond_with python2
90b570
%else
90b570
%bcond_without python2
90b570
%endif
90b570
d57e47
%if 0%{?rhel} && ! 0%{?centos}
d57e47
%bcond_without rhsm
d57e47
%else
d57e47
%bcond_with rhsm
d57e47
%endif
d57e47
d57e47
%global _cmake_opts \\\
d57e47
    -DENABLE_RHSM_SUPPORT=%{?with_rhsm:ON}%{!?with_rhsm:OFF} \\\
d57e47
    %{nil}
d57e47
d57e47
Name:           libdnf
90b570
Version:        0.22.5
90b570
Release:        1%{?dist}
d57e47
Summary:        Library providing simplified C and Python API to libsolv
d57e47
License:        LGPLv2+
d57e47
URL:            https://github.com/rpm-software-management/libdnf
d57e47
Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz
90b570
Patch0:         queue_init_clone-const_cast.patch
d57e47
d57e47
BuildRequires:  cmake
d57e47
BuildRequires:  gcc
90b570
BuildRequires:  gcc-c++
d57e47
BuildRequires:  libsolv-devel >= %{libsolv_version}
d57e47
BuildRequires:  pkgconfig(librepo)
d57e47
BuildRequires:  pkgconfig(check)
d57e47
%if %{with valgrind}
d57e47
BuildRequires:  valgrind
d57e47
%endif
d57e47
BuildRequires:  pkgconfig(gio-unix-2.0) >= 2.46.0
d57e47
BuildRequires:  pkgconfig(gtk-doc)
d57e47
BuildRequires:  rpm-devel >= 4.11.0
d57e47
%if %{with rhsm}
90b570
BuildRequires:  pkgconfig(librhsm) >= 0.0.3
d57e47
%endif
90b570
BuildRequires:  pkgconfig(sqlite3)
90b570
BuildRequires:  pkgconfig(json-c)
90b570
BuildRequires:  pkgconfig(cppunit)
90b570
BuildRequires:  pkgconfig(libcrypto)
90b570
BuildRequires:  pkgconfig(modulemd) >= %{libmodulemd_version}
90b570
BuildRequires:  pkgconfig(smartcols)
90b570
BuildRequires:  gettext
90b570
BuildRequires:  gpgme-devel
90b570
90b570
Requires:       libmodulemd%{?_isa} >= %{libmodulemd_version}
d57e47
Requires:       libsolv%{?_isa} >= %{libsolv_version}
d57e47
d57e47
%description
d57e47
A Library providing simplified C and Python API to libsolv.
d57e47
d57e47
%package devel
d57e47
Summary:        Development files for %{name}
d57e47
Requires:       %{name}%{?_isa} = %{version}-%{release}
d57e47
Requires:       libsolv-devel%{?_isa} >= %{libsolv_version}
d57e47
d57e47
%description devel
d57e47
Development files for %{name}.
d57e47
90b570
%if %{with python2}
90b570
%package -n python2-%{name}
90b570
%{?python_provide:%python_provide python2-%{name}}
90b570
Summary:        Python 2 bindings for the libdnf library.
90b570
Requires:       %{name}%{?_isa} = %{version}-%{release}
90b570
BuildRequires:  python2-devel
90b570
%if 0%{?rhel} == 7
90b570
BuildRequires:  python-sphinx
90b570
BuildRequires:  swig3 >= %{swig_version}
90b570
%else
90b570
BuildRequires:  python2-sphinx
90b570
BuildRequires:  swig >= %{swig_version}
90b570
%endif
90b570
90b570
%description -n python2-%{name}
90b570
Python 2 bindings for the libdnf library.
90b570
%endif # with python2
90b570
90b570
%if %{with python3}
90b570
%package -n python3-%{name}
90b570
%{?python_provide:%python_provide python3-%{name}}
90b570
Summary:        Python 3 bindings for the libdnf library.
90b570
Requires:       %{name}%{?_isa} = %{version}-%{release}
90b570
BuildRequires:  python3-devel
90b570
BuildRequires:  python3-sphinx
90b570
BuildRequires:  swig >= %{swig_version}
90b570
90b570
%description -n python3-%{name}
90b570
Python 3 bindings for the libdnf library.
90b570
%endif
90b570
90b570
%if %{with python2}
d57e47
%package -n python2-hawkey
d57e47
Summary:        Python 2 bindings for the hawkey library
d57e47
%{?python_provide:%python_provide python2-hawkey}
d57e47
BuildRequires:  python2-devel
d57e47
%if 0%{?rhel} && 0%{?rhel} <= 7
d57e47
BuildRequires:  python-nose
d57e47
%else
d57e47
BuildRequires:  python2-nose
d57e47
%endif
d57e47
Requires:       %{name}%{?_isa} = %{version}-%{release}
90b570
Requires:       python2-%{name} = %{version}-%{release}
d57e47
# Fix problem with hawkey - dnf version incompatibility
d57e47
# Can be deleted for distros where only python2-dnf >= 2.0.0
d57e47
Conflicts:      python2-dnf < %{dnf_conflict}
d57e47
Conflicts:      python-dnf < %{dnf_conflict}
d57e47
d57e47
%description -n python2-hawkey
d57e47
Python 2 bindings for the hawkey library.
90b570
%endif # with python2
d57e47
d57e47
%if %{with python3}
d57e47
%package -n python3-hawkey
d57e47
Summary:        Python 3 bindings for the hawkey library
d57e47
%{?python_provide:%python_provide python3-hawkey}
d57e47
BuildRequires:  python3-devel
d57e47
BuildRequires:  python3-nose
d57e47
Requires:       %{name}%{?_isa} = %{version}-%{release}
90b570
Requires:       python3-%{name} = %{version}-%{release}
d57e47
# Fix problem with hawkey - dnf version incompatibility
d57e47
# Can be deleted for distros where only python3-dnf >= 2.0.0
d57e47
Conflicts:      python3-dnf < %{dnf_conflict}
90b570
# Obsoletes F27 packages
d57e47
Obsoletes:      platform-python-hawkey < %{version}-%{release}
d57e47
d57e47
%description -n python3-hawkey
d57e47
Python 3 bindings for the hawkey library.
d57e47
%endif
d57e47
d57e47
%prep
dd8687
%autosetup -p1
90b570
%if %{with python2}
d57e47
mkdir build-py2
90b570
%endif # with python2
d57e47
%if %{with python3}
d57e47
mkdir build-py3
d57e47
%endif
d57e47
d57e47
%build
90b570
%if %{with python2}
d57e47
pushd build-py2
90b570
  %cmake -DPYTHON_DESIRED:FILEPATH=%{__python2} -DWITH_MAN=OFF ../ %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts}
d57e47
  %make_build
d57e47
popd
90b570
%endif # with python2
d57e47
d57e47
%if %{with python3}
d57e47
pushd build-py3
90b570
  %cmake -DPYTHON_DESIRED:FILEPATH=%{__python3} -DWITH_GIR=0 -DWITH_MAN=0 -Dgtkdoc=0 ../ %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts}
d57e47
  %make_build
d57e47
popd
d57e47
%endif
d57e47
d57e47
%check
d57e47
if [ "$(id -u)" == "0" ] ; then
d57e47
        cat <<ERROR 1>&2
d57e47
Package tests cannot be run under superuser account.
d57e47
Please build the package as non-root user.
d57e47
ERROR
d57e47
        exit 1
d57e47
fi
90b570
90b570
%if %{with python2}
d57e47
pushd build-py2
d57e47
  make ARGS="-V" test
d57e47
popd
90b570
%endif # with python2
d57e47
%if %{with python3}
d57e47
# Run just the Python tests, not all of them, since
d57e47
# we have coverage of the core from the first build
d57e47
pushd build-py3/python/hawkey/tests
d57e47
  make ARGS="-V" test
d57e47
popd
d57e47
%endif
d57e47
d57e47
%install
90b570
%if %{with python2}
d57e47
pushd build-py2
d57e47
  %make_install
d57e47
popd
90b570
%endif # with python2
d57e47
%if %{with python3}
d57e47
pushd build-py3
d57e47
  %make_install
d57e47
popd
d57e47
%endif
d57e47
90b570
%find_lang %{name}
90b570
90b570
%if 0%{?rhel} && 0%{?rhel} <= 7
d57e47
%post -p /sbin/ldconfig
d57e47
%postun -p /sbin/ldconfig
90b570
%else
90b570
%ldconfig_scriptlets
90b570
%endif
d57e47
90b570
%files -f %{name}.lang
d57e47
%license COPYING
90b570
%doc README.md AUTHORS
d57e47
%{_libdir}/%{name}.so.*
90b570
%{_libdir}/libdnf/plugins/README
d57e47
d57e47
%files devel
d57e47
%doc %{_datadir}/gtk-doc/html/%{name}/
d57e47
%{_libdir}/%{name}.so
d57e47
%{_libdir}/pkgconfig/%{name}.pc
d57e47
%{_includedir}/%{name}/
d57e47
90b570
%if %{with python2}
90b570
%files -n python2-%{name}
90b570
%{python2_sitearch}/%{name}/
90b570
%endif # with python2
90b570
90b570
%if %{with python3}
90b570
%files -n python3-%{name}
90b570
%{python3_sitearch}/%{name}/
90b570
%endif
90b570
90b570
%if %{with python2}
d57e47
%files -n python2-hawkey
d57e47
%{python2_sitearch}/hawkey/
90b570
%endif # with python2
d57e47
d57e47
%if %{with python3}
d57e47
%files -n python3-hawkey
d57e47
%{python3_sitearch}/hawkey/
d57e47
%endif
d57e47
d57e47
%changelog
90b570
* Tue Jan 08 2019 Daniel Mach <dmach@redhat.com> - 0.22.5-1
90b570
- Update to 0.22.5
90b570
- queue_init_clone src argument const_cast for libsolv 0.6.34 compatibility
d57e47
90b570
* Wed Jun 13 2018 Marek Blaha <mblaha@redhat.com> - 0.11.1-1
90b570
- Update to 0.11.1
d57e47
90b570
* Fri May 18 2018 Daniel Mach <dmach@redhat.com> - 0.7.4-4
90b570
- Rebuild on additional architectures
d57e47
90b570
* Thu Mar 23 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.7.4-3
90b570
- Backport patch to find releasever in RPMDB
d57e47
90b570
* Mon Feb 20 2017 Jan Silhan <jsilhan@redhat.com> - 0.7.4-2
90b570
- 0.7.4
d57e47
d57e47
* Fri Jan 06 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.7.1-1
d57e47
- 0.7.1
d57e47
d57e47
* Wed Dec 21 2016 Peter Robinson <pbrobinson@fedoraproject.org> 0.7.0-0.7gitf9b798c
d57e47
- Rebuild for Python 3.6
d57e47
d57e47
* Mon Dec 19 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.7.0-0.6gitf9b798c
d57e47
- Use new upstream URL
d57e47
d57e47
* Tue Dec 13 2016 Stratakis Charalampos <cstratak@redhat.com> - 0.7.0-0.5gitf9b798c
d57e47
- Rebuild for Python 3.6
d57e47
d57e47
* Tue Dec 06 2016 Martin Hatina <mhatina@redhat.com> - 0.7.0-0.4gitf9b798c
d57e47
- Increase conflict version of dnf
d57e47
d57e47
* Thu Dec 01 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.7.0-0.3gitf9b798c
d57e47
- Update to latest snapshot
d57e47
d57e47
* Fri Nov 04 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.7.0-0.2git8bd77f8
d57e47
- Update to latest snapshot
d57e47
d57e47
* Thu Sep 29 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.7.0-0.1git179c0a6
d57e47
- Initial package