Name:           libsolv
Version:        0.6.35
Release:        5
Summary:        Package dependency solver
License:        BSD
URL:            https://github.com/openSUSE/libsolv
Source0:        https://github.com/openSUSE/libsolv/archive/%{version}/%{name}-%{version}.tar.gz

Patch0:         0001-Make-sure-that-targeted-updates-dont-do-reinstalls.patch

Patch6000:	CVE-2018-20534-20533-20532-Fix-Dereference-of-null-pointer.patch
Patch6001:	CVE-2018-20534-20533-20532-Fix-Add-va_end-before-return.patch
Patch6002:	CVE-2018-20534-20533-20532-Fix-Memory-leaks.patch
Patch6003:	CVE-2018-20534-20533-20532-Fix-testsolv-segfault.patch
Patch6004:	CVE-2018-20534-20533-20532-Fix-testsolv-segfaults.patch
Patch6005:	CVE-2018-20534-20533-20532-Fix-Be-sure-that-NONBLOCK-is-set.patch
Patch6006:	CVE-2018-20534-20533-20532-Don-t-set-values-that-are-never-read.patch

BuildRequires:  cmake,gcc-c++,ninja-build,pkgconfig(rpm),zlib-devel,libsolv-devel
BuildRequires:  libxml2-devel,xz-devel,bzip2-devel,libzstd-devel

Requires: findutils
Requires: curl
Requires: gnupg2

Provides:  %{name}-tools
Obsoletes: %{name}-tools

Provides:  %{name}-demo
Obsoletes: %{name}-demo

%description
This is libsolv, a free package dependency solver using a satisfiability algorithm.

%package devel
Summary:        Development files for %{name}
Requires:       %{name} = %{version}-%{release}
Requires:       rpm-devel

%description devel
Development files for %{name}.

%package -n perl-solv
Summary:        Perl bindings for the %{name} library
BuildRequires:  swig,perl-devel,perl-generators
Requires:       %{name} = %{version}-%{release}

%description -n perl-solv
Perl bindings for the %{name} library.

%package -n ruby-solv
Summary:        Ruby bindings for the %{name} library
BuildRequires:  swig,ruby-devel
Requires:       %{name} = %{version}-%{release}

%description -n ruby-solv
Ruby bindings for the %{name} library.

%package -n python2-solv
Summary:        Python bindings for the %{name} library
BuildRequires:  swig,python2-devel
Requires:       %{name} = %{version}-%{release}

%description -n python2-solv
Python2 bindings for the %{name} library.


%package -n python3-solv
Summary:        Python bindings for the %{name} library
BuildRequires:  swig,python3-devel
Requires:       %{name} = %{version}-%{release}

%description -n python3-solv
Python bindings for the %{name} library.

%package_help

%prep
%autosetup -n %{name}-%{version} -p1

%build
%cmake . -GNinja -DFEDORA=1 -DENABLE_RPMDB=ON -DENABLE_RPMDB_BYRPMHEADER=ON -DENABLE_RPMDB_LIBRPM=ON                               \
  -DENABLE_RPMPKG_LIBRPM=ON -DENABLE_RPMMD=ON -DENABLE_COMPS=ON -DENABLE_APPDATA=ON -DUSE_VENDORDIRS=ON -DWITH_LIBXML2=ON          \
  -DENABLE_LZMA_COMPRESSION=ON -DENABLE_BZIP2_COMPRESSION=ON -DENABLE_ZSTD_COMPRESSION=ON           \
  -DENABLE_HELIXREPO=ON -DENABLE_SUSEREPO=ON -DENABLE_DEBIAN=ON -DENABLE_ARCHREPO=ON -DMULTI_SEMANTICS=ON  \
  -DENABLE_COMPLEX_DEPS=1 -DENABLE_PERL=ON -DENABLE_RUBY=ON  -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=%{__python2}                   \
  -DENABLE_PYTHON3=ON -DPYTHON3_EXECUTABLE=%{__python3}

%ninja_build

%install
%ninja_install

cp -a %{_libdir}/libsolv* %{buildroot}%{_libdir}

%check
%ninja_test

%ldconfig_scriptlets

%files
%license LICENSE*
%{_libdir}/%{name}.so.*
%{_libdir}/%{name}ext.so.*
%{_bindir}/{deltainfoxml2solv,dumpsolv,installcheck,mergesolv,repomdxml2solv,solv}
%{_bindir}/{rpmdb2solv,rpmmd2solv,rpms2solv,testsolv,updateinfoxml2solv,repo2solv}
%{_bindir}/{comps2solv,appdata2solv,deb2solv,archpkgs2solv,archrepo2solv,helix2solv,susetags2solv}

%files devel
%{_libdir}/%{name}.so
%{_libdir}/%{name}ext.so
%{_includedir}/solv/
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/pkgconfig/%{name}ext.pc
%dir %{_datadir}/cmake/Modules/
%{_datadir}/cmake/Modules/FindLibSolv.cmake

%files -n perl-solv
%{perl_vendorarch}/solv.pm
%{perl_vendorarch}/solv.so

%files -n ruby-solv
%{ruby_vendorarchdir}/solv.so

%files -n python2-solv
%{python2_sitearch}/_solv.so
%{python2_sitearch}/solv.py*

%files -n python3-solv
%{python3_sitearch}/_solv.so
%{python3_sitearch}/solv.py
%{python3_sitearch}/__pycache__/solv.*

%files help
%doc README
%{_mandir}/man1/*
%{_mandir}/man3/%{name}*.3*

%changelog
* Wed Nov 20 2019 fangyufa<fangyufa1@huawei.com> - 0.6.35-5
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:modify name of cve-patches

* Sat Nov 9 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.6.35-4
- Package init
