]> TLD Linux GIT Repositories - packages/poldek.git/blob - poldek.spec
- merged PLD changes
[packages/poldek.git] / poldek.spec
1 # TODO
2 # - fix config having escaped html entities:
3 #   # package A requires capability foo >= 1.0 while package B provides "foo"
4
5 # Conditional build:
6 %bcond_with     static  # don't use shared libraries
7 %bcond_without  imode   # don't build interactive mode
8 %bcond_with     python  # don't build python bindings
9 %bcond_with     tests   # tests
10
11 # required versions (forced to avoid SEGV with mixed db used by rpm and poldek)
12 %define         db_pkg          db
13 %define         ver_db          5.3
14 %define         ver_rpm         1:4.14
15 %define         ver_db_devel    %(rpm -q --qf '%|E?{%{E}:}|%{V}-%{R}' --what-provides db-devel)
16
17 Summary:        RPM packages management helper tool
18 Summary(hu.UTF-8):      RPM csomagkezelést segítő eszköz
19 Summary(pl.UTF-8):      Pomocnicze narzędzie do zarządzania pakietami RPM
20 Name:           poldek
21 Version:        0.42.2
22 Release:        6
23 License:        GPL v2
24 Group:          Applications/System
25 #Source0:       http://poldek.pld-linux.org/download/snapshots/%{name}-%{version}-cvs%{snap}.tar.bz2
26 Source0:        https://github.com/poldek-pm/poldek/releases/download/v%{version}/%{name}-%{version}.tar.xz
27 # Source0-md5:  2759fe45bc50efb6084d5338d725411a
28 Source1:        tld.conf
29 Source2:        tld-multilib.conf
30 Source3:        tld-debuginfo.conf
31 Source4:        %{name}-config.sh
32 Source5:        %{name}-aliases.conf
33 Source6:        %{name}.desktop
34 Source7:        %{name}.png
35 # Source7-md5:  ee487abede50874e9eceb6495d5ee150
36 Patch0:         %{name}-config.patch
37 Patch1:         pm-hooks.patch
38 Patch2:         %{name}-ext-down-enable.patch
39 Patch3:         %{name}-pc.patch
40 Patch4:         %{name}-info.patch
41 Patch5:         %{name}-multiarch-x32.patch
42 Patch6:         rpm-4.15.patch
43 Patch7:         db-index-format.patch
44 Patch8:         rpm4-uname-deps.patch
45 Patch9:         sqlite-rpmdb.patch
46 Patch10:        rpm4-cpuinfo-deps.patch
47 Patch11:        rpm4-no-dir-deps.patch
48 Patch12:        rpm4-rpmvercmp.patch
49 Patch13:        trurlib-shared.patch
50 Patch14:        rpm4-script-req-workaround.patch
51 Patch15:        skip-buildid-obsoletes.patch
52 URL:            http://poldek.pld-linux.org/
53 BuildRequires:  %{db_pkg}-devel >= %{ver_db}
54 BuildRequires:  autoconf >= 2.63
55 BuildRequires:  automake >= 1:1.11
56 BuildRequires:  bzip2-devel
57 BuildRequires:  check-devel
58 BuildRequires:  docbook-dtd412-xml
59 BuildRequires:  docbook2X
60 BuildRequires:  gettext-tools >= 0.11.5
61 BuildRequires:  libgomp-devel
62 BuildRequires:  libtool
63 BuildRequires:  libxml2-devel >= 2
64 BuildRequires:  ncurses-devel
65 BuildRequires:  openssl-devel >= 0.9.7d
66 BuildRequires:  pcre-devel
67 BuildRequires:  perl-XML-Simple
68 BuildRequires:  perl-base
69 BuildRequires:  perl-modules
70 BuildRequires:  pkgconfig
71 BuildRequires:  popt-devel
72 %{?with_python:BuildRequires:   python-devel}
73 BuildRequires:  readline-devel >= 5.0
74 BuildRequires:  rpm-devel >= %{ver_rpm}
75 %{?with_python:BuildRequires:   rpm-pythonprov}
76 BuildRequires:  tar >= 1:1.22
77 BuildRequires:  texinfo
78 BuildRequires:  xmlto
79 BuildRequires:  xz
80 BuildRequires:  zlib-devel
81 BuildRequires:  zstd-devel
82 %if %{with static}
83 BuildRequires:  %{db_pkg}-static >= %{ver_db}
84 BuildRequires:  bzip2-static
85 BuildRequires:  glibc-static
86 BuildRequires:  libxml2-static
87 BuildRequires:  ncurses-static
88 BuildRequires:  openssl-static
89 BuildRequires:  pcre-static
90 BuildRequires:  popt-static
91 BuildRequires:  readline-static
92 BuildRequires:  rpm-static
93 BuildRequires:  zlib-static
94 BuildRequires:  zstd-static
95 %endif
96 Requires(postun):       awk
97 Requires(postun):       sed >= 4.0
98 Requires:       %{db_pkg} >= %{ver_db_devel}
99 Requires:       %{name}-libs = %{version}-%{release}
100 Requires:       /bin/run-parts
101 Requires:       rpm >= %{ver_rpm}
102 Requires:       rpm-lib >= %{ver_rpm}
103 Requires:       sed
104 Conflicts:      etckeeper < 1.18-2
105 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
106
107 # it could be %{_libexecdir}/%{name}, but beware of compatibility (path hardcoded in configurations)
108 %define         pkglibexecdir   %{_prefix}/lib/%{name}
109
110 %description
111 poldek is an RPM package management tool which allows you to easily
112 perform package verification, installation (including system
113 installation from scratch), upgrading, and removal.
114
115 Program can be used in batch (like apt-get from Debian's APT) or
116 interactive mode. The interactive mode puts you into a readline
117 interface with command line autocompletion and history, similar to the
118 shell mode of Perl's CPAN.
119
120 %{?with_static:This version is statically linked.}
121
122 %{!?with_imode:This version hasn't got interactive mode.}
123 #'vim
124
125 %description -l hu.UTF-8
126 poldek egy RPM csomagkezelő eszköz, amely megkönnyíti a
127 csomagellenőrzést, telepítést (beleértve a rendszertelepítést a
128 nulláról), frissítést és eltávolítást.
129
130 A program használható parancssorból (mint a Debian apt-get programja)
131 vagy interaktív módban. Az interaktív mód egy readline környezetet
132 jelent, parancskiegészítéssel és előzményekkel, hasonlóan a Perl CPAN
133 shell módjához.
134
135 %{?with_static:Ez a verzió statikusan linkelt.}
136
137 %{!?with_imode:Ennek a verziónak nincs interaktív módja.}
138
139 %description -l pl.UTF-8
140 poldek jest narzędziem linii poleceń służącym do weryfikacji,
141 instalacji (włączając instalację systemu od zera), aktualizacji i
142 usuwania pakietów.
143
144 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
145 interaktywnym. Tryb interaktywny posiada interfejs readline z
146 dopełnianiem komend i historią, podobny do trybu shell perlowego
147 modułu CPAN.
148
149 %{?with_static:Ta wersja jest konsolidowana statycznie.}
150
151 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
152
153 %package libs
154 Summary:        poldek libraries
155 Summary(hu.UTF-8):      A poldek könyvtárai
156 Summary(pl.UTF-8):      Biblioteki poldka
157 Group:          Libraries
158
159 %description libs
160 poldek libraries.
161
162 %description libs -l hu.UTF-8
163 A poldek könyvtárai.
164
165 %description libs -l pl.UTF-8
166 Biblioteki poldka.
167
168 %package devel
169 Summary:        Header files for poldek libraries
170 Summary(hu.UTF-8):      A poldek könyvtár fejlesztői fájljai
171 Summary(pl.UTF-8):      Pliki nagłówkowe bibliotek poldka
172 Group:          Development/Libraries
173 Requires:       %{name}-libs = %{version}-%{release}
174 Requires:       rpm-devel >= %{ver_rpm}
175
176 %description devel
177 Header files for poldek libraries.
178
179 %description devel -l hu.UTF-8
180 A poldek könyvtár fejlesztői fájljai.
181
182 %description devel -l pl.UTF-8
183 Pliki nagłówkowe bibliotek poldka.
184
185 %package static
186 Summary:        poldek static libraries
187 Summary(hu.UTF-8):      poldek statikus könyvtárak
188 Summary(pl.UTF-8):      Biblioteki statyczne poldka
189 Group:          Development/Libraries
190 Requires:       %{name}-devel = %{version}-%{release}
191
192 %description static
193 poldek static libraries.
194
195 %description static -l hu.UTF-8
196 poldek statikus könyvtárak.
197
198 %description static -l pl.UTF-8
199 Biblioteki statyczne poldka.
200
201 %package -n python-poldek
202 Summary:        Python modules for poldek
203 Summary(hu.UTF-8):      Python modulok poldek-hez
204 Summary(pl.UTF-8):      Moduły języka Python dla poldka
205 Group:          Libraries/Python
206 Requires:       %{name}-libs = %{version}-%{release}
207 Requires:       python-libs
208
209 %description -n python-poldek
210 Python modules for poldek.
211
212 %description -n python-poldek -l hu.UTF-8
213 Python modulok poldek-hez.
214
215 %description -n python-poldek -l pl.UTF-8
216 Moduły języka Python dla poldka.
217
218 %prep
219 %setup -q
220 %patch0 -p1
221 %patch1 -p1
222 %patch2 -p1
223 %patch3 -p1
224 %patch4 -p1
225 %patch5 -p1
226 %patch6 -p1
227 %patch7 -p1
228 %patch8 -p1
229 %patch9 -p1
230 %patch10 -p1
231 %patch11 -p1
232 %patch12 -p1
233 cd trurlib
234 %patch13 -p1
235 cd ..
236 %patch14 -p1
237 %patch15 -p1
238
239 %{__rm} doc/poldek.info
240 %{__rm} m4/libtool.m4 m4/lt*.m4
241
242 # cleanup backups after patching
243 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
244 chmod u+x ./configure ./doc/conf-xml2.sh
245
246 %build
247 %{__gettextize}
248 %{__libtoolize}
249 %{__aclocal} -I m4
250 %{__autoheader}
251 %{__autoconf}
252 %{__automake}
253 cd tndb
254 %{__libtoolize}
255 %{__aclocal}
256 %{__autoheader}
257 %{__autoconf}
258 %{__automake}
259 cd ../trurlib
260 %{__libtoolize}
261 %{__aclocal}
262 %{__autoheader}
263 %{__autoconf}
264 %{__automake}
265 cd ..
266
267 %configure \
268         %{?with_static:--enable-static --disable-shared} \
269         %{!?with_imode:--disable-imode} \
270         --with-pkglibdir=%{pkglibexecdir} \
271         --enable-nls \
272         %{?with_python:--with-python}
273 %{__make}
274
275 %{__make} -C doc poldek.info
276
277 %if %{with python}
278 %{__make} -C python
279 %endif
280
281 %if %{with tests}
282 %{__make} check
283 %endif
284
285 %install
286 rm -rf $RPM_BUILD_ROOT
287 install -d $RPM_BUILD_ROOT/var/cache/%{name}
288
289 %{__make} install \
290         DESTDIR=$RPM_BUILD_ROOT
291
292 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}/poldek-config
293
294 %if %{with python}
295 %{__make} -C python install \
296         DESTDIR=$RPM_BUILD_ROOT \
297         py_sitedir=%{py_sitedir}
298 %endif
299
300 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
301
302 %ifarch i686 aarch64
303         %define         ftp_arch        %{_target_cpu}
304 %endif
305 %ifarch %{x8664}
306         %define         ftp_arch        x86_64
307         %define         ftp_alt_arch    i686
308 %endif
309
310 %define tld_conf %{SOURCE1}
311
312 %ifarch %{x8664}
313         %define tld_multilib_conf %{SOURCE2}
314 %endif
315
316 %define tld_debuginfo_conf %{SOURCE3}
317
318 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{tld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld.conf
319
320 %if 0%{?tld_multilib_conf:1}
321         %{__sed} 's|%%ARCH%%|%{ftp_alt_arch}|g' < %{tld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
322 %endif
323
324 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{tld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld-debuginfo.conf
325
326 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
327
328 %if %{with imode}
329 # add desktop file and icon
330 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
331 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
332 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
333 %endif
334
335 # sources we don't package
336 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
337 # include them in %doc
338 %{__rm} -rf configs
339 cp -a conf configs
340 %{__rm} -f configs/Makefile*
341
342 %if %{with python}
343 %py_postclean
344 %{__rm} $RPM_BUILD_ROOT%{_libdir}/_poldekmod.{la,so}
345 %endif
346
347
348 %find_lang %{name}
349
350 %clean
351 rm -rf $RPM_BUILD_ROOT
352
353 %post
354 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
355 if [ "$1" = "1" ]; then
356         # remove ignore = vserver-packages inside vserver on first install
357         {
358                 while read f ctx; do
359                         [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
360                 done </proc/self/status
361         } 2>/dev/null
362         if [ -z "$ctx" -o "$ctx" = "0" ]; then
363                 VSERVER=no
364         else
365                 VSERVER=yes
366         fi
367         if [ "$VSERVER" = "yes" ]; then
368                 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
369         fi
370 fi
371
372 %postun -p      /sbin/postshell
373 -/usr/sbin/fix-info-dir -c %{_infodir}
374
375 %post   libs -p /sbin/ldconfig
376 %postun libs -p /sbin/ldconfig
377
378 %triggerpostun -- poldek < 0.30-0.20080225.00.1
379 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
380         %{__sed} -i -e '/^%%include source.conf/{
381                 a
382                 a# /etc/poldek/repos.d/*.conf
383                 a%%includedir repos.d
384         }' %{_sysconfdir}/%{name}/poldek.conf
385 fi
386
387 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
388 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
389
390 if [ -f %{_sysconfdir}/%{name}/tld-source.conf.rpmsave ]; then
391         %{__mv} -f %{_sysconfdir}/%{name}/repos.d/tld.conf{,.rpmnew}
392         %{__mv} -v %{_sysconfdir}/%{name}/tld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld.conf
393 fi
394
395 %ifarch %{x8664}
396 if [ -f %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave ]; then
397         %{__mv} -f %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf{,.rpmnew}
398         %{__mv} -v %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
399 fi
400 %endif
401
402 %triggerpostun -- %{name} < 0.30.1-8
403 if [ $1 -le 1 ]; then
404         # revert change on  --downgrade
405         %{__sed} -i -re 's,^pm command = %{pkglibexecdir}/pm-command.sh,#&,' %{_sysconfdir}/%{name}/%{name}.conf
406 else
407         # setup pm command
408         %{__sed} -i -re 's,#?(pm command =).*,\1 %{pkglibexecdir}/pm-command.sh,' %{_sysconfdir}/%{name}/%{name}.conf
409 fi
410
411 %files -f %{name}.lang
412 %defattr(644,root,root,755)
413 %doc ChangeLog README* NEWS configs
414 %dir %{_sysconfdir}/%{name}
415 %dir %{_sysconfdir}/%{name}/pre-install.d
416 %{_sysconfdir}/%{name}/pre-install.d/README
417 %dir %{_sysconfdir}/%{name}/post-install.d
418 %{_sysconfdir}/%{name}/post-install.d/README
419 %dir %{_sysconfdir}/%{name}/repos.d
420 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/cli.conf
421 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/fetch.conf
422 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/poldek.conf
423 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/source.conf
424 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/tld.conf
425 %if 0%{?tld_multilib_conf:1}
426 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
427 %endif
428 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/tld-debuginfo.conf
429 %attr(755,root,root) %{_bindir}/ipoldek
430 %attr(755,root,root) %{_bindir}/poldek
431 %attr(755,root,root) %{_bindir}/poldek-config
432 %attr(755,root,root) %{_bindir}/rpmvercmp
433 %dir %{pkglibexecdir}
434 %attr(755,root,root) %{pkglibexecdir}/pm-command.sh
435 %attr(755,root,root) %{pkglibexecdir}/poldekuser-setup.sh
436 %attr(755,root,root) %{pkglibexecdir}/vfcompr
437 %attr(755,root,root) %{pkglibexecdir}/vfjuggle
438 %attr(755,root,root) %{pkglibexecdir}/vfsmb
439 %attr(755,root,root) %{pkglibexecdir}/zlib-in-rpm.sh
440 %{_mandir}/man1/%{name}*.1*
441 %lang(pl) %{_mandir}/pl/man1/%{name}*
442 %{_infodir}/poldek.info*
443 %if %{with imode}
444 %{_desktopdir}/%{name}.desktop
445 %{_pixmapsdir}/%{name}.png
446 %endif
447 %dir /var/cache/%{name}
448
449 %if %{without static}
450 %files libs
451 %defattr(644,root,root,755)
452 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
453 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
454 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
455 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
456 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
457 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.1
458 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.3
459 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
460 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
461 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
462 %endif
463
464 %files devel
465 %defattr(644,root,root,755)
466 %if %{without static}
467 %attr(755,root,root) %{_libdir}/libpoclidek.so
468 %attr(755,root,root) %{_libdir}/libpoldek.so
469 %attr(755,root,root) %{_libdir}/libtndb.so
470 %attr(755,root,root) %{_libdir}/libtrurl.so
471 %attr(755,root,root) %{_libdir}/libvfile.so
472 %endif
473 %{_libdir}/libpoclidek.la
474 %{_libdir}/libpoldek.la
475 %{_libdir}/libtndb.la
476 %{_libdir}/libtrurl.la
477 %{_libdir}/libvfile.la
478 %{_includedir}/poldek
479 %{_includedir}/tndb
480 %{_includedir}/trurl
481 %{_includedir}/vfile
482 %{_pkgconfigdir}/tndb.pc
483 %{_pkgconfigdir}/trurlib.pc
484
485 %files static
486 %defattr(644,root,root,755)
487 %{_libdir}/libtndb.a
488 %{_libdir}/libtrurl.a
489
490 %if %{with python}
491 %files -n python-poldek
492 %defattr(644,root,root,755)
493 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
494 %{py_sitescriptdir}/poldek.py[co]
495 %{py_sitescriptdir}/poldekmod.py[co]
496 %endif