chantra / rpms / libdnf

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