11#
22# spec file for package libsolv
33#
4- # Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
4+ # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
55#
66# All modifications and additions to the file contributed by third parties
77# remain the property of their copyright owners, unless otherwise agreed
1515# Please submit bugfixes or comments via http://bugs.opensuse.org/
1616#
1717
18- Name: libsolv
19- Version: @VERSION@
20- Release: 0
21- Url: https://github.com/openSUSE/libsolv
22- Source: libsolv-%{version}.tar.bz2
23- BuildRoot: %{_tmppath}/%{name}-%{version}-build
18+ %define libname libsolv@LIBSOLV_SOVERSION@
2419
25- %bcond_without enable_static
26- %bcond_without disable_shared
27- %bcond_without perl_binding
28- %bcond_without python_binding
29- %bcond_without python3_binding
30- %bcond_without ruby_binding
31- %bcond_with zypp
32-
33- %if 0%{?leap_version} >= 420300 || 0%{?sle_version} >= 120300 || 0%{?suse_version} >= 1330 || !0%{?suse_version}
20+ %if 0%{?sle_version} >= 120300 || 0%{?suse_version} >= 1330 || !0%{?suse_version}
3421%bcond_without bz2
3522%bcond_without xz
3623%bcond_without zstd
@@ -39,56 +26,63 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
3926%bcond_with xz
4027%bcond_with zstd
4128%endif
42-
4329%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?mageia} >= 6 || 0%{?suse_version} >= 1330
4430%bcond_without richdeps
4531%else
4632%bcond_with richdeps
4733%endif
34+ %bcond_without python3
35+ %bcond_without python
36+ %bcond_without ruby
37+ %bcond_without perl
38+ %bcond_without static
39+ %bcond_with shared
40+ %bcond_with zypp
4841
49- %if 0%{?mandriva_version}
50- # force this version on mandriva
51- BuildRequires: libneon0.26-devel
52- %endif
53- %if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
54- BuildRequires: db-devel
55- %endif
56- BuildRequires: libxml2-devel
57- %if 0%{?suse_version} && 0%{?suse_version} < 1100
58- BuildRequires: graphviz
59- %endif
60- %if 0%{?suse_version} > 1020 || 0%{?fedora} || 0%{?mageia}
61- BuildRequires: fdupes
62- %endif
42+ Name: libsolv
43+ Version: @VERSION@
44+ Release: 0
45+ Summary: Package dependency solver using a satisfiability algorithm
46+ License: BSD-3-Clause
47+ Group: Development/Libraries/C and C++
48+ Url: https://github.com/openSUSE/libsolv
49+ Source: libsolv-%{version}.tar.bz2
6350BuildRequires: cmake
6451BuildRequires: gcc-c++
52+ BuildRequires: libxml2-devel
6553BuildRequires: rpm-devel
6654BuildRequires: zlib-devel
55+ BuildRoot: %{_tmppath}/%{name}-%{version}-build
6756
68- %if %{with perl_binding}
57+ %if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
58+ BuildRequires: db-devel
59+ %endif
60+
61+ %if %{with perl}
6962BuildRequires: perl
7063%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
7164BuildRequires: perl-devel
7265%endif
7366BuildRequires: swig
7467%endif
7568
76- %if %{with ruby_binding }
69+ %if %{with ruby }
7770%global ruby_vendorarch %(ruby -r rbconfig -e "puts RbConfig::CONFIG['vendorarchdir'].nil? ? RbConfig::CONFIG['sitearchdir'] : RbConfig::CONFIG['vendorarchdir']")
7871BuildRequires: ruby
7972BuildRequires: ruby-devel
8073BuildRequires: swig
8174%endif
8275
83- %if %{with python_binding }
76+ %if %{with python }
8477%global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))")
8578BuildRequires: python-devel
8679BuildRequires: swig
8780%endif
8881
89- %if %{with python3_binding }
82+ %if %{with python3 }
9083%global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))")
9184BuildRequires: python3-devel
85+ BuildRequires: swig
9286%endif
9387
9488%if %{with bz2}
@@ -107,20 +101,17 @@ BuildRequires: xz-devel
107101BuildRequires: libzstd-devel
108102%endif
109103
110- Summary: Package dependency solver using a satisfiability algorithm
111- License: BSD-3-Clause
112- Group: Development/Libraries/C and C++
113104
114105%description
115106libsolv is a library for solving packages and reading repositories.
116107The solver uses a satisfiability algorithm.
117108
118- %if ! %{with disable_shared }
119- %package -n libsolv@LIBSOLV_SOVERSION@
109+ %if %{with shared }
110+ %package -n %{libname}
120111Summary: Package dependency solver using a satisfiability algorithm
121112Group: System/Libraries
122113
123- %description -n libsolv@LIBSOLV_SOVERSION@
114+ %description -n %{libname}
124115libsolv is a library for solving packages and reading repositories.
125116It consists of two central blocks: Using a dictionary approach to
126117store and retrieve package and dependency information, and, using a
@@ -131,8 +122,8 @@ dependencies.
131122%package devel
132123Summary: Development files for libsolv, a package solver
133124Group: Development/Libraries/C and C++
134- %if ! %{with disable_shared }
135- Requires: libsolv@LIBSOLV_SOVERSION@ = %version
125+ %if %{with shared }
126+ Requires: %{libname} = %version
136127%endif
137128Requires: rpm-devel
138129Conflicts: libsatsolver-devel
@@ -144,10 +135,9 @@ reading repositories.
144135%package tools
145136Summary: Utilities to work with .solv files
146137Group: System/Management
138+ Conflicts: satsolver-tools-obsolete
147139Obsoletes: satsolver-tools < 0.18
148140Provides: satsolver-tools = 0.18
149- Conflicts: satsolver-tools-obsolete
150- Requires: gzip bzip2 coreutils findutils
151141
152142%description tools
153143libsolv is a library for solving packages and reading repositories.
@@ -159,13 +149,13 @@ files used by libsolv.
159149Summary: Applications demoing the libsolv library
160150Group: System/Management
161151Requires: curl
152+ Conflicts: libsatsolver-demo
162153%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
163154Requires: gnupg2
164155%endif
165156%if 0%{?suse_version}
166157Requires: gpg2
167158%endif
168- Conflicts: libsatsolver-demo
169159
170160%description demo
171161Applications demoing the libsolv library.
@@ -178,7 +168,7 @@ Group: Development/Languages/Ruby
178168Ruby bindings for libsolv.
179169
180170%package -n python-solv
181- %if 0%{?py_requires:1} && %{with python_binding }
171+ %if 0%{?py_requires:1} && %{with python }
182172%py_requires
183173%endif
184174Summary: Python bindings for the libsolv library
@@ -195,29 +185,29 @@ Group: Development/Languages/Python
195185Python3 bindings for libsolv.
196186
197187%package -n perl-solv
198- Requires: perl = %{perl_version}
199188Summary: Perl bindings for the libsolv library
200189Group: Development/Languages/Perl
190+ Requires: perl = %{perl_version}
201191
202192%description -n perl-solv
203193Perl bindings for libsolv.
204194
205195%prep
206- %setup -n libsolv-%{version}
196+ %setup -q
207197
208198%build
209199export CFLAGS="%{optflags}"
210200export CXXFLAGS="$CFLAGS"
211201
212202CMAKE_FLAGS=
213203%if 0%{?fedora} || 0%{?rhel} >= 6
214- CMAKE_FLAGS="-DFEDORA=1 -DENABLE_APPDATA=1 -DENABLE_COMPS=1 "
204+ CMAKE_FLAGS="-DFEDORA=1"
215205%endif
216206%if 0%{?mageia}
217- CMAKE_FLAGS="-DMAGEIA=1 -DENABLE_APPDATA=1 -DENABLE_COMPS=1 "
207+ CMAKE_FLAGS="-DMAGEIA=1"
218208%endif
219209%if 0%{?suse_version}
220- CMAKE_FLAGS="-DSUSE=1 -DENABLE_APPDATA=1 -DENABLE_COMPS=1 "
210+ CMAKE_FLAGS="-DSUSE=1"
221211%endif
222212
223213cmake $CMAKE_FLAGS \
@@ -226,12 +216,14 @@ cmake $CMAKE_FLAGS \
226216 -DCMAKE_VERBOSE_MAKEFILE=TRUE \
227217 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
228218 -DWITH_LIBXML2=1 \
229- %{?with_enable_static:-DENABLE_STATIC=1} \
230- %{?with_disable_shared:-DDISABLE_SHARED=1} \
231- %{?with_perl_binding:-DENABLE_PERL=1} \
232- %{?with_python_binding:-DENABLE_PYTHON=1} \
233- %{?with_python3_binding:-DENABLE_PYTHON3=1} \
234- %{?with_ruby_binding:-DENABLE_RUBY=1} \
219+ -DENABLE_APPDATA=1 \
220+ -DENABLE_COMPS=1 \
221+ %{?with_static:-DENABLE_STATIC=1} \
222+ %{!?with_shared:-DDISABLE_SHARED=1} \
223+ %{?with_perl:-DENABLE_PERL=1} \
224+ %{?with_python:-DENABLE_PYTHON=1} \
225+ %{?with_python3:-DENABLE_PYTHON3=1} \
226+ %{?with_ruby:-DENABLE_RUBY=1} \
235227 %{?with_bz2:-DENABLE_BZIP2_COMPRESSION=1} \
236228 %{?with_xz:-DENABLE_LZMA_COMPRESSION=1} \
237229 %{?with_zstd:-DENABLE_ZSTD_COMPRESSION=1} \
@@ -247,27 +239,27 @@ make DESTDIR=%{buildroot} install
247239ln -s repo2solv %{buildroot}/%{_bindir}/repo2solv.sh
248240
249241%if 0%{?suse_version}
250- %if %{with python_binding}
251- pushd %{buildroot}/%{python_sitearch}
252- python %py_libdir/py_compile.py *.py
253- python -O %py_libdir/py_compile.py *.py
254- popd
242+ %if %{with python}
243+ %py_compile -O %{buildroot}/%{python_sitearch}
255244%endif
256- %if %{with python3_binding }
245+ %if %{with python3 }
257246%py3_compile %{buildroot}/%{python3_sitearch}
258247%endif
259248%endif
260- %if %{with disable_shared }
249+ %if %{with static }
261250# we want to leave the .a file untouched
262251export NO_BRP_STRIP_DEBUG=true
263252%endif
264253
265- %if !%{with disable_shared}
266- %post -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
254+ %check
255+ make ARGS=--output-on-failure test
256+
257+ %if %{with shared}
258+ %post -n %{libname} -p /sbin/ldconfig
267259
268- %postun -n libsolv@LIBSOLV_SOVERSION@ -p /sbin/ldconfig
260+ %postun -n %{libname} -p /sbin/ldconfig
269261
270- %files -n libsolv@LIBSOLV_SOVERSION@
262+ %files -n %{libname}
271263%defattr(-,root,root)
272264%license LICENSE*
273265%{_libdir}/libsolv.so.*
@@ -286,11 +278,11 @@ export NO_BRP_STRIP_DEBUG=true
286278
287279%files devel
288280%defattr(-,root,root)
289- %if %{with enable_static }
281+ %if %{with static }
290282%{_libdir}/libsolv.a
291283%{_libdir}/libsolvext.a
292284%endif
293- %if ! %{with disable_shared }
285+ %if %{with shared }
294286%{_libdir}/libsolv.so
295287%{_libdir}/libsolvext.so
296288%endif
@@ -307,25 +299,25 @@ export NO_BRP_STRIP_DEBUG=true
307299%defattr(-,root,root)
308300%{_bindir}/solv
309301
310- %if %{with perl_binding }
302+ %if %{with perl }
311303%files -n perl-solv
312304%defattr(-,root,root)
313305%{perl_vendorarch}/*
314306%endif
315307
316- %if %{with ruby_binding }
308+ %if %{with ruby }
317309%files -n ruby-solv
318310%defattr(-,root,root)
319311%{ruby_vendorarch}/*
320312%endif
321313
322- %if %{with python_binding }
314+ %if %{with python }
323315%files -n python-solv
324316%defattr(-,root,root)
325317%{python_sitearch}/*
326318%endif
327319
328- %if %{with python3_binding }
320+ %if %{with python3 }
329321%files -n python3-solv
330322%defattr(-,root,root)
331323%{python3_sitearch}/*solv*
0 commit comments