2 # - fix config having escaped html entities:
3 # # package A requires capability foo >= 1.0 while package B provides "foo"
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 snap # install configs for official Th snapshot
10 %bcond_with rpm4 # use rpm4 instead of rpm5
11 %bcond_with tests # tests
13 # current snapshot name
16 # required versions (forced to avoid SEGV with mixed db used by rpm and poldek)
20 %define ver_rpm 1:4.14
21 %define ver_db_devel %(rpm -q --qf '%|E?{%{E}:}|%{V}-%{R}' --what-provides db-devel)
23 %define ver_db %(rpm -q --provides rpm-lib | awk 'BEGIN { v="RPM_TOO_OLD" } /^rpm-db-ver = [.0-9]+$/ { v=$3 } END { print v }')
24 %define db_pkg db%{ver_db}
25 %define ver_rpm 5.4.10
29 Summary: RPM packages management helper tool
30 Summary(hu.UTF-8): RPM csomagkezelést segítő eszköz
31 Summary(pl.UTF-8): Pomocnicze narzędzie do zarządzania pakietami RPM
34 Release: %{rel}%{?with_snap:.%{SNAP}}
36 Group: Applications/System
37 #Source0: http://poldek.pld-linux.org/download/snapshots/%{name}-%{version}-cvs%{snap}.tar.bz2
38 Source0: https://github.com/poldek-pm/poldek/releases/download/v%{version}/%{name}-%{version}.tar.xz
39 # Source0-md5: 2759fe45bc50efb6084d5338d725411a
41 Source2: %{name}-multilib.conf
42 Source3: %{name}-config.sh
43 Source5: %{name}-aliases.conf
44 Source6: %{name}.desktop
46 # Source7-md5: ee487abede50874e9eceb6495d5ee150
47 Source8: %{name}-debuginfo.conf
48 Source9: %{name}-aidath.conf
49 Source10: %{name}-multilib-aidath.conf
50 Source11: %{name}-archive.conf
51 Source100: %{name}-snap.conf
52 Source101: %{name}-multilib-snap.conf
53 Source102: %{name}-debuginfo-snap.conf
54 Patch0: %{name}-config.patch
55 Patch1: pm-hooks.patch
56 Patch2: %{name}-ext-down-enable.patch
57 Patch3: %{name}-pc.patch
58 Patch4: %{name}-info.patch
59 Patch5: %{name}-multiarch-x32.patch
60 Patch6: rpm-4.15.patch
61 Patch7: db-index-format.patch
62 Patch8: rpm4-uname-deps.patch
63 Patch9: sqlite-rpmdb.patch
64 Patch10: rpm4-cpuinfo-deps.patch
65 Patch11: rpm4-no-dir-deps.patch
66 URL: http://poldek.pld-linux.org/
67 BuildRequires: %{db_pkg}-devel >= %{ver_db}
68 BuildRequires: autoconf >= 2.63
69 BuildRequires: automake >= 1:1.11
70 BuildRequires: bzip2-devel
71 BuildRequires: check-devel
72 BuildRequires: docbook-dtd412-xml
73 BuildRequires: docbook2X
74 BuildRequires: gettext-tools >= 0.11.5
75 BuildRequires: libgomp-devel
76 BuildRequires: libtool
77 BuildRequires: libxml2-devel >= 2
78 BuildRequires: ncurses-devel
79 BuildRequires: openssl-devel >= 0.9.7d
80 BuildRequires: pcre-devel
81 BuildRequires: perl-XML-Simple
82 BuildRequires: perl-base
83 BuildRequires: perl-modules
84 BuildRequires: pkgconfig
85 BuildRequires: popt-devel
86 %{?with_python:BuildRequires: python-devel}
87 BuildRequires: readline-devel >= 5.0
88 BuildRequires: rpm-devel >= %{ver_rpm}
89 %{?with_python:BuildRequires: rpm-pythonprov}
90 BuildRequires: tar >= 1:1.22
91 BuildRequires: texinfo
94 BuildRequires: zlib-devel
95 BuildRequires: zstd-devel
97 BuildRequires: %{db_pkg}-static >= %{ver_db}
98 BuildRequires: bzip2-static
99 BuildRequires: glibc-static
100 BuildRequires: libxml2-static
101 BuildRequires: ncurses-static
102 BuildRequires: openssl-static
103 BuildRequires: pcre-static
104 BuildRequires: popt-static
105 BuildRequires: readline-static
106 BuildRequires: rpm-static
107 BuildRequires: zlib-static
108 BuildRequires: zstd-static
110 Requires(postun): awk
111 Requires(postun): sed >= 4.0
113 Requires: %{db_pkg} >= %{ver_db_devel}
115 Requires: %{db_pkg} >= %{ver_db}
116 Requires: rpm-db-ver = %{ver_db}
118 Requires: %{name}-libs = %{version}-%{release}
119 Requires: /bin/run-parts
120 Requires: rpm >= %{ver_rpm}
121 Requires: rpm-lib >= %{ver_rpm}
123 Conflicts: etckeeper < 1.18-2
124 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
126 # it could be %{_libexecdir}/%{name}, but beware of compatibility (path hardcoded in configurations)
127 %define pkglibexecdir %{_prefix}/lib/%{name}
130 poldek is an RPM package management tool which allows you to easily
131 perform package verification, installation (including system
132 installation from scratch), upgrading, and removal.
134 Program can be used in batch (like apt-get from Debian's APT) or
135 interactive mode. The interactive mode puts you into a readline
136 interface with command line autocompletion and history, similar to the
137 shell mode of Perl's CPAN.
139 %{?with_static:This version is statically linked.}
141 %{!?with_imode:This version hasn't got interactive mode.}
144 %description -l hu.UTF-8
145 poldek egy RPM csomagkezelő eszköz, amely megkönnyíti a
146 csomagellenőrzést, telepítést (beleértve a rendszertelepítést a
147 nulláról), frissítést és eltávolítást.
149 A program használható parancssorból (mint a Debian apt-get programja)
150 vagy interaktív módban. Az interaktív mód egy readline környezetet
151 jelent, parancskiegészítéssel és előzményekkel, hasonlóan a Perl CPAN
154 %{?with_static:Ez a verzió statikusan linkelt.}
156 %{!?with_imode:Ennek a verziónak nincs interaktív módja.}
158 %description -l pl.UTF-8
159 poldek jest narzędziem linii poleceń służącym do weryfikacji,
160 instalacji (włączając instalację systemu od zera), aktualizacji i
163 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
164 interaktywnym. Tryb interaktywny posiada interfejs readline z
165 dopełnianiem komend i historią, podobny do trybu shell perlowego
168 %{?with_static:Ta wersja jest konsolidowana statycznie.}
170 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
173 Summary: poldek libraries
174 Summary(hu.UTF-8): A poldek könyvtárai
175 Summary(pl.UTF-8): Biblioteki poldka
181 %description libs -l hu.UTF-8
184 %description libs -l pl.UTF-8
188 Summary: Header files for poldek libraries
189 Summary(hu.UTF-8): A poldek könyvtár fejlesztői fájljai
190 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
191 Group: Development/Libraries
192 Requires: %{name}-libs = %{version}-%{release}
193 Requires: rpm-devel >= %{ver_rpm}
196 Header files for poldek libraries.
198 %description devel -l hu.UTF-8
199 A poldek könyvtár fejlesztői fájljai.
201 %description devel -l pl.UTF-8
202 Pliki nagłówkowe bibliotek poldka.
205 Summary: poldek static libraries
206 Summary(hu.UTF-8): poldek statikus könyvtárak
207 Summary(pl.UTF-8): Biblioteki statyczne poldka
208 Group: Development/Libraries
209 Requires: %{name}-devel = %{version}-%{release}
212 poldek static libraries.
214 %description static -l hu.UTF-8
215 poldek statikus könyvtárak.
217 %description static -l pl.UTF-8
218 Biblioteki statyczne poldka.
220 %package -n python-poldek
221 Summary: Python modules for poldek
222 Summary(hu.UTF-8): Python modulok poldek-hez
223 Summary(pl.UTF-8): Moduły języka Python dla poldka
224 Group: Libraries/Python
225 Requires: %{name}-libs = %{version}-%{release}
226 Requires: python-libs
228 %description -n python-poldek
229 Python modules for poldek.
231 %description -n python-poldek -l hu.UTF-8
232 Python modulok poldek-hez.
234 %description -n python-poldek -l pl.UTF-8
235 Moduły języka Python dla poldka.
252 %{__rm} doc/poldek.info
253 %{__rm} m4/libtool.m4 m4/lt*.m4
255 # cleanup backups after patching
256 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
257 chmod u+x ./configure ./doc/conf-xml2.sh
281 %{?with_static:--enable-static --disable-shared} \
282 %{!?with_imode:--disable-imode} \
283 --with-pkglibdir=%{pkglibexecdir} \
285 %{?with_python:--with-python}
288 %{__make} -C doc poldek.info
299 rm -rf $RPM_BUILD_ROOT
300 install -d $RPM_BUILD_ROOT/var/cache/%{name}
303 DESTDIR=$RPM_BUILD_ROOT
305 install -p %{SOURCE3} $RPM_BUILD_ROOT%{_bindir}/poldek-config
308 %{__make} -C python install \
309 DESTDIR=$RPM_BUILD_ROOT \
310 py_sitedir=%{py_sitedir}
313 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
315 %ifarch i486 i686 ppc sparc alpha athlon aarch64
316 %define ftp_arch %{_target_cpu}
319 %define ftp_arch x86_64
320 %define ftp_alt_arch i686
321 %define ftp_alt2_arch x32
325 %define ftp_alt_arch x86_64
326 %define ftp_alt2_arch i686
329 %define ftp_arch i486
331 %ifarch pentium2 pentium3 pentium4
332 %define ftp_arch i686
334 %ifarch sparcv9 sparc64
335 %define ftp_arch sparc
336 %define ftp_arch %{_target_cpu}
338 %define ftp_alt_arch sparcv9
342 %define pld_conf %{SOURCE1}
343 %define pld_debuginfo_conf %{SOURCE8}
344 %define pld_archive_conf %{SOURCE11}
347 %define pld_multilib_conf %{SOURCE2}
348 %define pld_multilib2_conf %{SOURCE2}
352 %ifarch sparcv9 sparc64
353 %define pld_conf %{SOURCE9}
354 %undefine pld_archive_conf
357 %define pld_multilib_conf %{SOURCE10}
360 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
362 %if 0%{?pld_multilib_conf:1}
363 %{__sed} 's|%%ARCH%%|%{ftp_alt_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
366 %if 0%{?pld_multilib2_conf:1}
367 %{__sed} 's|%%ARCH%%|%{ftp_alt2_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt2_arch}.conf
370 %if 0%{?pld_debuginfo_conf:1}
371 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
374 %if 0%{?pld_archive_conf:1}
375 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_archive_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-archive.conf
378 # Always install snapshot configs
379 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
380 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE100} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
381 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
382 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE102} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-debuginfo.conf
384 %{__sed} -e 's|%%ARCH%%|%{ftp_alt_arch}|g' \
385 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
386 %{__sed} -e 's|%%ARCH%%|%{ftp_alt2_arch}|g' \
387 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt2_arch}.conf
391 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
392 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
394 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
395 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
398 # create "all" meta repo
399 %if 0%{?ftp_alt_arch:1}%{?ftp_alt2_arch:1}
400 cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-all.conf
401 # group source for referring th+th-multiarch sources together, i.e poldek -n th-all
405 sources = th %{?ftp_alt_arch:th-%{ftp_alt_arch}} %{?ftp_alt2_arch:th-%{ftp_alt2_arch}}
409 # th-2014 snap does not exist for x32 yet
410 %if "%{ftp_arch}" == "x32"
411 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
413 %if "%{ftp_alt2_arch}" == "x32"
414 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-x32.conf
417 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
420 # add desktop file and icon
421 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
422 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
423 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
426 # sources we don't package
427 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
428 # include them in %doc
431 %{__rm} -f configs/Makefile*
435 %{__rm} $RPM_BUILD_ROOT%{_libdir}/_poldekmod.{la,so}
441 rm -rf $RPM_BUILD_ROOT
444 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
445 if [ "$1" = "1" ]; then
446 # remove ignore = vserver-packages inside vserver on first install
449 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
450 done </proc/self/status
452 if [ -z "$ctx" -o "$ctx" = "0" ]; then
457 if [ "$VSERVER" = "yes" ]; then
458 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
462 %postun -p /sbin/postshell
463 -/usr/sbin/fix-info-dir -c %{_infodir}
465 %post libs -p /sbin/ldconfig
466 %postun libs -p /sbin/ldconfig
468 %triggerpostun -- poldek < 0.30.1-8
469 # poldek < 0.30-0.20080225.00.1
470 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
471 %{__sed} -i -e '/^%%include source.conf/{
473 a# /etc/poldek/repos.d/*.conf
474 a%%includedir repos.d
475 }' %{_sysconfdir}/%{name}/poldek.conf
478 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
479 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
481 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
482 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
483 %{__mv} -v %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
487 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
488 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
489 %{__mv} -v %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
493 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave ]; then
494 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf{,.rpmnew}
495 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
497 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave ]; then
498 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf{,.rpmnew}
499 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
502 if [ $1 -le 1 ]; then
503 # revert change on --downgrade
504 %{__sed} -i -re 's,^pm command = %{pkglibexecdir}/pm-command.sh,#&,' %{_sysconfdir}/%{name}/%{name}.conf
507 %{__sed} -i -re 's,#?(pm command =).*,\1 %{pkglibexecdir}/pm-command.sh,' %{_sysconfdir}/%{name}/%{name}.conf
510 %files -f %{name}.lang
511 %defattr(644,root,root,755)
512 %doc ChangeLog README* NEWS configs
513 %dir %{_sysconfdir}/%{name}
514 %dir %{_sysconfdir}/%{name}/pre-install.d
515 %{_sysconfdir}/%{name}/pre-install.d/README
516 %dir %{_sysconfdir}/%{name}/post-install.d
517 %{_sysconfdir}/%{name}/post-install.d/README
518 %dir %{_sysconfdir}/%{name}/repos.d
519 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
520 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
521 %attr(755,root,root) %{_bindir}/ipoldek
522 %attr(755,root,root) %{_bindir}/poldek
523 %attr(755,root,root) %{_bindir}/poldek-config
524 %attr(755,root,root) %{_bindir}/rpmvercmp
525 %dir %{pkglibexecdir}
526 %attr(755,root,root) %{pkglibexecdir}/pm-command.sh
527 %attr(755,root,root) %{pkglibexecdir}/poldekuser-setup.sh
528 %attr(755,root,root) %{pkglibexecdir}/vfcompr
529 %attr(755,root,root) %{pkglibexecdir}/vfjuggle
530 %attr(755,root,root) %{pkglibexecdir}/vfsmb
531 %attr(755,root,root) %{pkglibexecdir}/zlib-in-rpm.sh
532 %{_mandir}/man1/%{name}*.1*
533 %lang(pl) %{_mandir}/pl/man1/%{name}*
534 %{_infodir}/poldek.info*
536 %{_desktopdir}/%{name}.desktop
537 %{_pixmapsdir}/%{name}.png
539 %dir /var/cache/%{name}
541 %if %{without static}
543 %defattr(644,root,root,755)
544 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
545 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
546 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
547 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
548 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
549 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.1
550 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.3
551 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
552 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
553 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
557 %defattr(644,root,root,755)
558 %if %{without static}
559 %attr(755,root,root) %{_libdir}/libpoclidek.so
560 %attr(755,root,root) %{_libdir}/libpoldek.so
561 %attr(755,root,root) %{_libdir}/libtndb.so
562 %attr(755,root,root) %{_libdir}/libtrurl.so
563 %attr(755,root,root) %{_libdir}/libvfile.so
565 %{_libdir}/libpoclidek.la
566 %{_libdir}/libpoldek.la
567 %{_libdir}/libtndb.la
568 %{_libdir}/libtrurl.la
569 %{_libdir}/libvfile.la
570 %{_includedir}/poldek
574 %{_pkgconfigdir}/tndb.pc
575 %{_pkgconfigdir}/trurlib.pc
578 %defattr(644,root,root,755)
580 %{_libdir}/libtrurl.a
583 %files -n python-poldek
584 %defattr(644,root,root,755)
585 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
586 %{py_sitescriptdir}/poldek.py[co]
587 %{py_sitescriptdir}/poldekmod.py[co]