re-organize spec file

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
This commit is contained in:
Igor Gnatenko 2016-04-05 19:54:10 +02:00
parent 78b212e337
commit 06911e8404

View File

@ -1,39 +1,60 @@
%{!?ruby_vendorarch: %global ruby_vendorarch %(ruby -r rbconfig -e "puts RbConfig::CONFIG['vendorarchdir'].nil? ? RbConfig::CONFIG['sitearchdir'] : RbConfig::CONFIG['vendorarchdir']")} %global libname solv
%filter_provides_in %{perl_vendorarch}/.*\.so$
%filter_provides_in %{python2_sitearch}/.*\.so$
%if 0%{?fedora}
%bcond_without python3
%filter_provides_in %{python3_sitearch}/.*\.so$
%global _cmake_opts \\\
-DCMAKE_BUILD_TYPE=RelWithDebInfo \\\
-DENABLE_PERL=1 \\\
-DENABLE_PYTHON=1 \\\
-DENABLE_RUBY=1 \\\
-DUSE_VENDORDIRS=1 \\\
-DFEDORA=1 \\\
-DENABLE_DEBIAN=1 \\\
-DENABLE_ARCHREPO=1 \\\
-DENABLE_LZMA_COMPRESSION=1 \\\
-DMULTI_SEMANTICS=1 \\\
-DENABLE_COMPLEX_DEPS=1 \\\
%{nil}
%else
%bcond_with python3
%global _cmake_opts \\\
-DCMAKE_BUILD_TYPE=RelWithDebInfo \\\
-DFEDORA=1 \\\
-DENABLE_LZMA_COMPRESSION=1 \\\
%{nil}
%endif
%filter_provides_in %{ruby_vendorarch}/.*\.so$
%filter_setup
Name: libsolv %if 0%{?fedora}
%bcond_without perl_bindings
%bcond_without ruby_bindings
%bcond_without python_bindings
%if %{with python_bindings}
%bcond_without python3
%endif
%bcond_without comps
%bcond_without appdata
%bcond_without debian_repo
%bcond_without arch_repo
%bcond_without helix_repo
%bcond_without multi_symantics
%bcond_without complex_deps
%else
%bcond_with perl_bindings
%bcond_with ruby_bindings
%bcond_with python_bindings
%if %{with python_bindings}
%bcond_with python3
%endif
%bcond_with comps
%bcond_with appdata
%bcond_with debian_repo
%bcond_with arch_repo
%bcond_with helix_repo
%bcond_with multi_symantics
%bcond_with complex_deps
%endif
%global _cmake_opts \\\
-DFEDORA=1 \\\
-DENABLE_RPMDB=ON \\\
-DENABLE_RPMDB_BYRPMHEADER=ON \\\
-DENABLE_RPMMD=ON \\\
%{?with_comps:-DENABLE_COMPS=ON} \\\
%{?with_appdata:-DENABLE_APPDATA=ON} \\\
-DUSE_VENDORDIRS=ON \\\
-DENABLE_LZMA_COMPRESSION=ON \\\
-DENABLE_BZIP2_COMPRESSION=ON \\\
%{?with_debian_repo:-DENABLE_DEBIAN=ON} \\\
%{?with_arch_repo:-DENABLE_ARCHREPO=ON} \\\
%{?with_helix_repo:-DENABLE_HELIXREPO=ON} \\\
%{?with_multi_symantics:-DMULTI_SYMANTICS=ON} \\\
%{?with_complex_deps:-DENABLE_COMPLEX_DEPS=1} \\\
%{nil}
Name: lib%{libname}
Version: 0.6.19 Version: 0.6.19
Release: 2%{?dist} Release: 3%{?dist}
Summary: Package dependency solver
License: BSD License: BSD
Url: https://github.com/openSUSE/libsolv URL: https://github.com/openSUSE/libsolv
Source: https://github.com/openSUSE/libsolv/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch0: 0001-ruby-make-compatible-with-ruby-2.2.patch Patch0: 0001-ruby-make-compatible-with-ruby-2.2.patch
Patch1: 0002-Add-repodata_lookup_dirstrarray_uninternalized-metho.patch Patch1: 0002-Add-repodata_lookup_dirstrarray_uninternalized-metho.patch
Patch2: 0003-Do-not-create-a-checksum-hash-when-we-re-not-extendi.patch Patch2: 0003-Do-not-create-a-checksum-hash-when-we-re-not-extendi.patch
@ -45,17 +66,19 @@ Patch7: 0008-Split-diskusage-and-fileprovides-code-into-separate-.patch
Patch8: 0009-Make-_Pool_tmpspace-definition-internal.patch Patch8: 0009-Make-_Pool_tmpspace-definition-internal.patch
Patch9: 0010-Rework-orphan-handling-in-dup-mode.patch Patch9: 0010-Rework-orphan-handling-in-dup-mode.patch
Group: Development/Libraries BuildRequires: cmake
Summary: Package dependency solver BuildRequires: gcc-c++
BuildRequires: cmake libdb-devel expat-devel rpm-devel zlib-devel BuildRequires: pkgconfig(rpm)
BuildRequires: swig BuildRequires: zlib-devel
%if 0%{?fedora} BuildRequires: expat-devel
BuildRequires: perl perl-devel ruby rubypick rubygems ruby-devel python2-devel # -DFEDORA=1
%endif # -DENABLE_RPMDB=ON
%if %{with python3} BuildRequires: libdb-devel
BuildRequires: python3-devel # -DENABLE_LZMA_COMPRESSION=ON
%endif BuildRequires: xz-devel
BuildRequires: xz-devel bzip2-devel # -DENABLE_BZIP2_COMPRESSION=ON
BuildRequires: bzip2-devel
%description %description
A free package dependency solver using a satisfiability algorithm. The A free package dependency solver using a satisfiability algorithm. The
library is based on two major, but independent, blocks: library is based on two major, but independent, blocks:
@ -67,173 +90,233 @@ library is based on two major, but independent, blocks:
resolving package dependencies. resolving package dependencies.
%package devel %package devel
Summary: A new approach to package dependency solving Summary: Development files for %{name}
Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: libsolv-tools%{?_isa} = %{version}-%{release}
Requires: libsolv%{?_isa} = %{version}-%{release}
Requires: rpm-devel%{?_isa} Requires: rpm-devel%{?_isa}
Requires: cmake
%description devel %description devel
Development files for libsolv, Development files for %{name}.
%package tools %package tools
Summary: A new approach to package dependency solving Summary: Package dependency solver tools
Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: gzip bzip2 coreutils # repo2solv dependencies. All of those are used in shell-script.
Requires: libsolv%{?_isa} = %{version}-%{release} Requires: /usr/bin/gzip
Requires: /usr/bin/bzip2
Requires: /usr/bin/lzma
Requires: /usr/bin/xz
Requires: /usr/bin/cat
Requires: /usr/bin/find
%description tools %description tools
Package dependency solver tools. Package dependency solver tools.
%package demo %package demo
Summary: Applications demoing the libsolv library Summary: Applications demoing the %{name} library
Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: curl gnupg2 # solv dependencies. Used as execlp() and system()
Requires: /usr/bin/curl
Requires: /usr/bin/gpg2
%description demo %description demo
Applications demoing the libsolv library. Applications demoing the %{name} library.
%if 0%{?fedora} %if %{with perl_bindings}
%package -n ruby-solv %package -n perl-%{libname}
Summary: Ruby bindings for the libsolv library Summary: Perl bindings for the %{name} library
Group: Development/Languages BuildRequires: swig
Requires: libsolv%{?_isa} = %{version}-%{release} BuildRequires: perl-devel
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n ruby-solv %description -n perl-%{libname}
Ruby bindings for sat solver. Perl bindings for the %{name} library.
%endif %endif
%if 0%{?fedora} %if %{with ruby_bindings}
%package -n python2-solv %package -n ruby-%{libname}
Summary: Python bindings for the libsolv library Summary: Ruby bindings for the %{name} library
Group: Development/Languages BuildRequires: swig
Requires: python2 BuildRequires: ruby-devel
Requires: libsolv%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python2-solv}
%description -n python2-solv %description -n ruby-%{libname}
Python bindings for sat solver. Ruby bindings for the %{name} library.
%endif %endif
%if %{with python_bindings}
%package -n python2-%{libname}
Summary: Python bindings for the %{name} library
%{?python_provide:%python_provide python2-%{libname}}
BuildRequires: swig
BuildRequires: python2-devel
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python2-%{libname}
Python bindings for the %{name} library.
Python 2 version.
%if %{with python3} %if %{with python3}
%package -n python3-solv %package -n python3-%{libname}
Summary: Python 3 bindings for the libsolv library Summary: Python bindings for the %{name} library
Group: Development/Languages %{?python_provide:%python_provide python3-%{libname}}
Requires: python3 BuildRequires: swig
Requires: libsolv%{?_isa} = %{version}-%{release} BuildRequires: python3-devel
%{?python_provide:%python_provide python3-solv} Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python3-solv %description -n python3-%{libname}
Python 3 bindings for sat solver. Python bindings for the %{name} library.
Python 3 version.
%endif %endif
%if 0%{?fedora}
%package -n perl-solv
Summary: Perl bindings for the libsolv library
Group: Development/Languages
Requires: perl
Requires: libsolv%{?_isa} = %{version}-%{release}
%description -n perl-solv
Perl bindings for sat solver.
%endif %endif
%prep %prep
%autosetup -p1 %autosetup -p1
mkdir build build-py2 build-py3
%if %{with python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build %build
%cmake %_cmake_opts \ pushd build
-DPythonLibs_FIND_VERSION=2 -DPythonLibs_FIND_VERSION_MAJOR=2 \ %cmake %_cmake_opts ../ \
-DENABLE_BZIP2_COMPRESSION=1 %{?with_perl_bindings:-DENABLE_PERL=ON} \
make %{?_smp_mflags} %{?with_ruby_bindings:-DENABLE_RUBY=ON} \
%{nil}
%make_build
popd
%if %{with python_bindings}
pushd build-py2
%cmake %_cmake_opts ../ \
-DENABLE_PYTHON=ON \
-DPythonLibs_FIND_VERSION=2 \
-DPythonLibs_FIND_VERSION_MAJOR=2 \
%{nil}
make %{?_smp_mflags} bindings_python
popd
%if %{with python3} %if %{with python3}
pushd %{py3dir}/ pushd build-py3
%cmake %_cmake_opts -DENABLE_PYTHON=1 \ %cmake %_cmake_opts ../ \
-DPythonLibs_FIND_VERSION=3 -DPythonLibs_FIND_VERSION_MAJOR=3 \ -DENABLE_PYTHON=ON \
-DENABLE_BZIP2_COMPRESSION=1 -DPythonLibs_FIND_VERSION=3 \
make %{?_smp_mflags} -DPythonLibs_FIND_VERSION_MAJOR=3 \
%{nil}
make %{?_smp_mflags} bindings_python
popd popd
%endif %endif
%endif
%install %install
%make_install pushd build
%make_install
popd
%if %{with python_bindings}
pushd build-py2
%make_install
popd
%if %{with python3} %if %{with python3}
pushd %{py3dir}/ pushd build-py3
%make_install %make_install
popd popd
%endif %endif
%endif
mv %{buildroot}%{_bindir}/repo2solv.sh %{buildroot}%{_bindir}/repo2solv
%check %check
make ARGS="-V" test pushd build
ctest -VV
popd
%post -p /sbin/ldconfig %post -p /sbin/ldconfig
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
%files %files
%doc LICENSE* README BUGS %license LICENSE*
%_libdir/libsolv.so.* %doc README
%_libdir/libsolvext.so.* %{_libdir}/%{name}.so.*
%{_libdir}/%{name}ext.so.*
%files tools
%if 0%{?fedora}
%_bindir/archpkgs2solv
%_bindir/archrepo2solv
%_bindir/deb2solv
%endif
%_bindir/deltainfoxml2solv
%_bindir/dumpsolv
%_bindir/installcheck
%_bindir/mergesolv
%_bindir/repo2solv.sh
%_bindir/repomdxml2solv
%_bindir/rpmdb2solv
%_bindir/rpmmd2solv
%_bindir/rpms2solv
%_bindir/testsolv
%_bindir/updateinfoxml2solv
%files devel %files devel
%doc examples/solv/ %{_libdir}/%{name}.so
%_libdir/libsolv.so %{_libdir}/%{name}ext.so
%_libdir/libsolvext.so %{_includedir}/%{libname}/
%_includedir/solv
%_datadir/cmake/Modules/FindLibSolv.cmake
%{_mandir}/man?/*
%{_libdir}/pkgconfig/%{name}.pc %{_libdir}/pkgconfig/%{name}.pc
# Own directory because we don't want to depend on cmake
%dir %{_datadir}/cmake/Modules/
%{_datadir}/cmake/Modules/FindLibSolv.cmake
%{_mandir}/man3/%{name}*.3*
# Some small macro to list tools with mans
%global solv_tool() \
%{_bindir}/%{1}\
%{_mandir}/man1/%{1}.1*
%files tools
%solv_tool deltainfoxml2solv
%solv_tool dumpsolv
%solv_tool installcheck
%solv_tool mergesolv
%solv_tool repomdxml2solv
%solv_tool rpmdb2solv
%solv_tool rpmmd2solv
%solv_tool rpms2solv
%solv_tool testsolv
%solv_tool updateinfoxml2solv
%if %{with comps}
%solv_tool comps2solv
%endif
%if %{with appdata}
%solv_tool appdata2solv
%endif
%if %{with debian_repo}
%solv_tool deb2solv
%endif
%if %{with arch_repo}
%solv_tool archpkgs2solv
%solv_tool archrepo2solv
%endif
%if %{with helix_repo}
%solv_tool helix2solv
%endif
%{_bindir}/repo2solv
%files demo %files demo
%_bindir/solv %{_bindir}/solv
%if 0%{?fedora} %if %{with perl_bindings}
%files -n perl-solv %files -n perl-%{libname}
%doc examples/p5solv %{perl_vendorarch}/%{libname}.pm
%{perl_vendorarch}/* %{perl_vendorarch}/%{libname}.so
%files -n ruby-solv
%doc examples/rbsolv
%{ruby_vendorarch}/*
%files -n python2-solv
%doc examples/pysolv
%{python2_sitearch}/*
%endif %endif
%if %{with ruby_bindings}
%files -n ruby-%{libname}
%{ruby_vendorarchdir}/%{libname}.so
%endif
%if %{with python_bindings}
%files -n python2-%{libname}
%{python2_sitearch}/_%{libname}.so
%{python2_sitearch}/%{libname}.py*
%if %{with python3} %if %{with python3}
%files -n python3-solv %files -n python3-%{libname}
%doc examples/pysolv %{python3_sitearch}/_%{libname}.so
%{python3_sitearch}/* %{python3_sitearch}/%{libname}.py
%{python3_sitearch}/__pycache__/%{libname}.*
%endif
%endif %endif
%changelog %changelog
* Tue Apr 05 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.6.19-3
- Reorganize spec file
- Enable helixrepo feature
- enable appdata feature
* Tue Mar 8 2016 Jaroslav Mracek <jmracek@redhat.com> - 0.6.19-2 * Tue Mar 8 2016 Jaroslav Mracek <jmracek@redhat.com> - 0.6.19-2
- Apply 9 patches from upstream - Apply 9 patches from upstream