-
Notifications
You must be signed in to change notification settings - Fork 83
/
libzypp.spec.cmake
445 lines (392 loc) · 13.2 KB
/
libzypp.spec.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
#
# spec file for package libzypp
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150400 || (0%{?is_opensuse} && 0%{?sle_version} >= 150100)
%bcond_without zchunk
%else
%bcond_with zchunk
%endif
# libsolvs external references might require us to link against zstd, bz2, xz
%if 0%{?sle_version} >= 150000 || 0%{?suse_version} >= 1500
%bcond_without zstd
%else
%bcond_with zstd
%endif
%if 0%{?sle_version} >= 120300 || 0%{?suse_version} >= 1330 || !0%{?suse_version}
%bcond_without bz2
%bcond_without xz
%else
%bcond_with bz2
%bcond_with xz
%endif
%bcond_without mediabackend_tests
# older libsigc versions have a bug that causes a segfault
# when clearing connections during signal emission
# see https://bugzilla.gnome.org/show_bug.cgi?id=784550
%if 0%{?sle_version} < 150200
%bcond_without sigc_block_workaround
%else
%bcond_with sigc_block_workaround
%endif
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150600
%bcond_without visibility_hidden
%else
%bcond_with visibility_hidden
%endif
# Distros using just zypper may want to enable this as default earlier
%bcond_with enable_preview_single_rpmtrans_as_default_for_zypper
Name: libzypp
Version: @VERSION@
Release: 0
License: GPL-2.0-or-later
URL: https://github.com/openSUSE/libzypp
Summary: Library for package, patch, pattern and product management
Group: System/Packages
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: %{name}-%{version}.tar.bz2
Source1: %{name}-rpmlintrc
Provides: yast2-packagemanager
Obsoletes: yast2-packagemanager
# bsc#1227793: python zypp-plugin < 0.6.4 rejects stomp headers including a '-'
Conflicts: python2-zypp-plugin < 0.6.4
Conflicts: python3-zypp-plugin < 0.6.4
# API refactoring. Prevent zypper from using (now) private symbols
Conflicts: zypper <= 1.14.76
# Features we provide (update doc/autoinclude/FeatureTest.doc):
Provides: libzypp(plugin) = 0.1
Provides: libzypp(plugin:appdata) = 0
Provides: libzypp(plugin:commit) = 1
Provides: libzypp(plugin:services) = 1
Provides: libzypp(plugin:system) = 1
Provides: libzypp(plugin:urlresolver) = 0
Provides: libzypp(plugin:repoverification) = 0
Provides: libzypp(repovarexpand) = 1.1
%if 0%{?suse_version}
Recommends: logrotate
# lsof is used for 'zypper ps':
Recommends: lsof
%endif
BuildRequires: cmake >= 3.5
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(libudev)
%if 0%{?suse_version} >= 1330
BuildRequires: libboost_headers-devel
BuildRequires: libboost_program_options-devel
BuildRequires: libboost_test-devel
BuildRequires: libboost_thread-devel
%else
BuildRequires: boost-devel
%endif
BuildRequires: dejagnu
BuildRequires: doxygen
BuildRequires: texlive-latex
BuildRequires: texlive-xcolor
BuildRequires: texlive-newunicodechar
BuildRequires: texlive-dvips
BuildRequires: ghostscript
BuildRequires: gcc-c++ >= 7
BuildRequires: gettext-devel
BuildRequires: graphviz
BuildRequires: libxml2-devel
BuildRequires: yaml-cpp-devel
# we are loading libproxy dynamically, however we have
# a failsafe unit test that links against libproxy to make
# sure the API did not change
BuildRequires: libproxy-devel
#keep the libproxy runtime requires for old releases
%if 0%{?suse_version} && 0%{?suse_version} <= 1500 && 0%{?sle_version} <= 150500
Requires: libproxy1
%endif
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: pkgconfig
%else
BuildRequires: pkg-config
%endif
BuildRequires: libsolv-devel >= 0.7.24
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150600
BuildRequires: libsolv-tools-base >= 0.7.29
%requires_eq libsolv-tools-base
Requires: ( findutils if libsolv-tools-base <= 0.7.31 )
%else
BuildRequires: libsolv-tools
%requires_eq libsolv-tools
%endif
BuildRequires: glib2-devel
BuildRequires: libsigc++2-devel
BuildRequires: readline-devel >= 5.1
# required for testsuite
%if %{with mediabackend_tests}
BuildRequires: nginx
BuildRequires: vsftpd
%endif
Requires: rpm
BuildRequires: rpm
%if 0%{?suse_version}
BuildRequires: rpm-devel > 4.4
%endif
%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
BuildRequires: popt-devel
BuildRequires: rpm-devel > 4.4
%endif
%if 0%{?mandriva_version}
BuildRequires: librpm-devel > 4.4
%endif
%if 0%{?suse_version}
BuildRequires: libgpgme-devel
#testsuite
%if %{with mediabackend_tests}
BuildRequires: FastCGI-devel
%endif
%else
BuildRequires: gpgme-devel
#testsuite
%if %{with mediabackend_tests}
BuildRequires: fcgi-devel
%endif
%endif
%define min_curl_version 7.19.4
BuildRequires: libcurl-devel >= %{min_curl_version}
%if 0%{?suse_version}
# Code11+
Requires: libcurl4 >= %{min_curl_version}
%else
# Other distros (Fedora)
Requires: libcurl >= %{min_curl_version}
%endif
# required for documentation
%if 0%{?suse_version} >= 1330
BuildRequires: rubygem(asciidoctor)
%else
BuildRequires: asciidoc
BuildRequires: libxslt-tools
%endif
%if %{with zchunk}
BuildRequires: libzck-devel
%endif
%if %{with zstd}
BuildRequires: libzstd-devel
%endif
%if %{with bz2}
%if 0%{?suse_version}
BuildRequires: libbz2-devel
%else
BuildRequires: bzip2-devel
%endif
%endif
%if %{with xz}
BuildRequires: xz-devel
%endif
%description
libzypp is the package management library that powers applications
like YaST, zypper and the openSUSE/SLE implementation of PackageKit.
libzypp provides functionality for a package manager:
* An API for package repository management, supporting most common
repository metadata formats and signed repositories.
* An API for solving packages, products, patterns and patches
(installation, removal, update and distribution upgrade
operations) dependencies, with additional features like locking.
* An API for commiting the transaction to the system over a rpm
target. Supporting deltarpm calculation, media changing and
installation order calculation.
* An API for browsing available and installed software, with some
facilities for programs with an user interface.
%package devel
Summary: Header files for libzypp, a library for package management
Group: Development/Libraries/C and C++
Provides: yast2-packagemanager-devel
Obsoletes: yast2-packagemanager-devel
Provides: libzypp-tui-devel = 1
%if 0%{?suse_version} >= 1330
Requires: libboost_headers-devel
Requires: libboost_program_options-devel
Requires: libboost_test-devel
Requires: libboost_thread-devel
%else
Requires: boost-devel
%endif
Requires: bzip2
Requires: glibc-devel
Requires: libstdc++-devel
Requires: libxml2-devel
Requires: libzypp = %{version}
Requires: pkgconfig(openssl)
Requires: popt-devel
Requires: rpm-devel > 4.4
Requires: zlib-devel
Requires: libudev-devel
%if 0%{?suse_version}
# Code11+
Requires: libcurl-devel >= %{min_curl_version}
%else
# Other distros (Fedora)
Requires: libcurl-devel >= %{min_curl_version}
%endif
%if 0%{?suse_version}
%requires_ge libsolv-devel
%else
Requires: libsolv-devel
%endif
%description devel
Development files for libzypp, a library for package, patch, pattern
and product management.
%package devel-doc
Summary: Developer documentation for libzypp
Group: Documentation/HTML
%description devel-doc
Developer documentation for libzypp.
%prep
%autosetup -p1
%build
mkdir build
cd build
%if 0%{?suse_version} > 1500
# Bug 1189788 - UsrMerge: filesystem package breaks system when upgraded in a single rpm transaction
# While the bug is not fixed, we don't allow ZYPP_SINGLE_RPMTRANS=1 on a not UsrMerged system
export CFLAGS="%{optflags} -DNO_SINGLETRANS_USERMERGE"
export CXXFLAGS="%{optflags} -DNO_SINGLETRANS_USERMERGE"
%else
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
%endif
unset EXTRA_CMAKE_OPTIONS
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DENABLE_BUILD_DOCS=TRUE \
-DENABLE_BUILD_TRANS=TRUE \
-DENABLE_BUILD_TESTS=TRUE \
-DDOC_INSTALL_DIR=%{_docdir} \
-DLIB=%{_lib} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=1 \
-DCMAKE_INSTALL_LIBEXECDIR=%{_libexecdir} \
%{?with_visibility_hidden:-DENABLE_VISIBILITY_HIDDEN=1} \
%{?with_zchunk:-DENABLE_ZCHUNK_COMPRESSION=1} \
%{?with_zstd:-DENABLE_ZSTD_COMPRESSION=1} \
%{?with_sigc_block_workaround:-DENABLE_SIGC_BLOCK_WORKAROUND=1} \
%{!?with_mediabackend_tests:-DDISABLE_MEDIABACKEND_TESTS=1} \
%{?with enable_preview_single_rpmtrans_as_default_for_zypper:-DENABLE_PREVIEW_SINGLE_RPMTRANS_AS_DEFAULT_FOR_ZYPPER=1} \
${EXTRA_CMAKE_OPTIONS} \
..
make %{?_smp_mflags} VERBOSE=1
%install
cd build
%make_install
%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
ln -s %{_sysconfdir}/yum.repos.d %{buildroot}/%{_sysconfdir}/zypp/repos.d
%else
mkdir -p %{buildroot}/%{_sysconfdir}/zypp/repos.d
%endif
mkdir -p %{buildroot}/%{_sysconfdir}/zypp/services.d
mkdir -p %{buildroot}/%{_sysconfdir}/zypp/systemCheck.d
mkdir -p %{buildroot}/%{_sysconfdir}/zypp/vars.d
mkdir -p %{buildroot}/%{_sysconfdir}/zypp/vendors.d
mkdir -p %{buildroot}/%{_sysconfdir}/zypp/multiversion.d
mkdir -p %{buildroot}/%{_sysconfdir}/zypp/needreboot.d
mkdir -p %{buildroot}/%{_sysconfdir}/zypp/credentials.d
mkdir -p %{buildroot}/%{_prefix}/lib/zypp
mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins
mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/appdata
mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/commit
mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/services
mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/system
mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/urlresolver
mkdir -p %{buildroot}/%{_var}/lib/zypp
mkdir -p %{buildroot}/%{_var}/log/zypp
mkdir -p %{buildroot}/%{_var}/cache/zypp
# Default to 'solver.dupAllowVendorChange = false' on TW and post SLE12
%if 0%{?suse_version} >= 1330 || "%{distribution}" == "openSUSE Tumbleweed"
sed -i "s|# solver.dupAllowVendorChange = true|solver.dupAllowVendorChange = false|g" %{buildroot}%{_sysconfdir}/zypp/zypp.conf
%endif
cd ..
# Create filelist with translations
%{find_lang} zypp
%if %{defined _distconfdir}
# Move logratate files form /etc/logrotate.d to /usr/etc/logrotate.d
mkdir -p %{buildroot}/%{_distconfdir}/logrotate.d
mv %{buildroot}/%{_sysconfdir}/logrotate.d/zypp-history.lr %{buildroot}%{_distconfdir}/logrotate.d
%endif
%check
pushd build/tests
LD_LIBRARY_PATH="$(pwd)/../zypp:$LD_LIBRARY_PATH" ctest --output-on-failure .
popd
%if %{defined _distconfdir}
%pre
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in logrotate.d/zypp-history.lr; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
done
%endif
%if %{defined _distconfdir}
%posttrans
# Migration to /usr/etc, restore just created .rpmsave
for i in logrotate.d/zypp-history.lr; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
done
%endif
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files -f zypp.lang
%defattr(-,root,root)
%if 0%{?suse_version} >= 1500
%license COPYING
%endif
%dir %{_sysconfdir}/zypp
%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
%{_sysconfdir}/zypp/repos.d
%else
%dir %{_sysconfdir}/zypp/repos.d
%endif
%dir %{_sysconfdir}/zypp/services.d
%dir %{_sysconfdir}/zypp/systemCheck.d
%dir %{_sysconfdir}/zypp/vars.d
%dir %{_sysconfdir}/zypp/vendors.d
%dir %{_sysconfdir}/zypp/multiversion.d
%config(noreplace) %{_sysconfdir}/zypp/needreboot
%dir %{_sysconfdir}/zypp/needreboot.d
%dir %{_sysconfdir}/zypp/credentials.d
%config(noreplace) %{_sysconfdir}/zypp/zypp.conf
%config(noreplace) %{_sysconfdir}/zypp/systemCheck
%if %{defined _distconfdir}
%{_distconfdir}/logrotate.d/zypp-history.lr
%else
%config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
%endif
%dir %{_var}/lib/zypp
%if "%{_libexecdir}" != "%{_prefix}/lib"
%dir %{_libexecdir}/zypp
%endif
%dir %attr(750,root,root) %{_var}/log/zypp
%dir %{_var}/cache/zypp
%{_prefix}/lib/zypp
%{_datadir}/zypp
%{_bindir}/*
%{_libexecdir}/zypp/zypp-rpm
%{_libdir}/libzypp*so.*
%doc %{_mandir}/man1/*.1.*
%doc %{_mandir}/man5/*.5.*
%files devel
%defattr(-,root,root)
%{_libdir}/libzypp.so
%{_libdir}/libzypp-tui.a
%{_datadir}/cmake/Modules/*
%{_includedir}/zypp
%{_includedir}/zypp-core
%{_includedir}/zypp-media
%{_includedir}/zypp-curl
%{_includedir}/zypp-tui
%{_libdir}/pkgconfig/libzypp.pc
%files devel-doc
%defattr(-,root,root)
%{_docdir}/%{name}
%changelog