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 URL: http://poldek.pld-linux.org/
65 BuildRequires: %{db_pkg}-devel >= %{ver_db}
66 BuildRequires: autoconf >= 2.63
67 BuildRequires: automake >= 1:1.11
68 BuildRequires: bzip2-devel
69 BuildRequires: check-devel
70 BuildRequires: docbook-dtd412-xml
71 BuildRequires: docbook2X
72 BuildRequires: gettext-tools >= 0.11.5
73 BuildRequires: libgomp-devel
74 BuildRequires: libtool
75 BuildRequires: libxml2-devel >= 2
76 BuildRequires: ncurses-devel
77 BuildRequires: openssl-devel >= 0.9.7d
78 BuildRequires: pcre-devel
79 BuildRequires: perl-XML-Simple
80 BuildRequires: perl-base
81 BuildRequires: perl-modules
82 BuildRequires: pkgconfig
83 BuildRequires: popt-devel
84 %{?with_python:BuildRequires: python-devel}
85 BuildRequires: readline-devel >= 5.0
86 BuildRequires: rpm-devel >= %{ver_rpm}
87 %{?with_python:BuildRequires: rpm-pythonprov}
88 BuildRequires: tar >= 1:1.22
89 BuildRequires: texinfo
92 BuildRequires: zlib-devel
93 BuildRequires: zstd-devel
95 BuildRequires: %{db_pkg}-static >= %{ver_db}
96 BuildRequires: bzip2-static
97 BuildRequires: glibc-static
98 BuildRequires: libxml2-static
99 BuildRequires: ncurses-static
100 BuildRequires: openssl-static
101 BuildRequires: pcre-static
102 BuildRequires: popt-static
103 BuildRequires: readline-static
104 BuildRequires: rpm-static
105 BuildRequires: zlib-static
106 BuildRequires: zstd-static
108 Requires(postun): awk
109 Requires(postun): sed >= 4.0
111 Requires: %{db_pkg} >= %{ver_db_devel}
113 Requires: %{db_pkg} >= %{ver_db}
114 Requires: rpm-db-ver = %{ver_db}
116 Requires: %{name}-libs = %{version}-%{release}
117 Requires: /bin/run-parts
118 Requires: rpm >= %{ver_rpm}
119 Requires: rpm-lib >= %{ver_rpm}
121 Conflicts: etckeeper < 1.18-2
122 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
124 # it could be %{_libexecdir}/%{name}, but beware of compatibility (path hardcoded in configurations)
125 %define pkglibexecdir %{_prefix}/lib/%{name}
128 poldek is an RPM package management tool which allows you to easily
129 perform package verification, installation (including system
130 installation from scratch), upgrading, and removal.
132 Program can be used in batch (like apt-get from Debian's APT) or
133 interactive mode. The interactive mode puts you into a readline
134 interface with command line autocompletion and history, similar to the
135 shell mode of Perl's CPAN.
137 %{?with_static:This version is statically linked.}
139 %{!?with_imode:This version hasn't got interactive mode.}
142 %description -l hu.UTF-8
143 poldek egy RPM csomagkezelő eszköz, amely megkönnyíti a
144 csomagellenőrzést, telepítést (beleértve a rendszertelepítést a
145 nulláról), frissítést és eltávolítást.
147 A program használható parancssorból (mint a Debian apt-get programja)
148 vagy interaktív módban. Az interaktív mód egy readline környezetet
149 jelent, parancskiegészítéssel és előzményekkel, hasonlóan a Perl CPAN
152 %{?with_static:Ez a verzió statikusan linkelt.}
154 %{!?with_imode:Ennek a verziónak nincs interaktív módja.}
156 %description -l pl.UTF-8
157 poldek jest narzędziem linii poleceń służącym do weryfikacji,
158 instalacji (włączając instalację systemu od zera), aktualizacji i
161 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
162 interaktywnym. Tryb interaktywny posiada interfejs readline z
163 dopełnianiem komend i historią, podobny do trybu shell perlowego
166 %{?with_static:Ta wersja jest konsolidowana statycznie.}
168 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
171 Summary: poldek libraries
172 Summary(hu.UTF-8): A poldek könyvtárai
173 Summary(pl.UTF-8): Biblioteki poldka
179 %description libs -l hu.UTF-8
182 %description libs -l pl.UTF-8
186 Summary: Header files for poldek libraries
187 Summary(hu.UTF-8): A poldek könyvtár fejlesztői fájljai
188 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
189 Group: Development/Libraries
190 Requires: %{name}-libs = %{version}-%{release}
191 Requires: rpm-devel >= %{ver_rpm}
194 Header files for poldek libraries.
196 %description devel -l hu.UTF-8
197 A poldek könyvtár fejlesztői fájljai.
199 %description devel -l pl.UTF-8
200 Pliki nagłówkowe bibliotek poldka.
203 Summary: poldek static libraries
204 Summary(hu.UTF-8): poldek statikus könyvtárak
205 Summary(pl.UTF-8): Biblioteki statyczne poldka
206 Group: Development/Libraries
207 Requires: %{name}-devel = %{version}-%{release}
210 poldek static libraries.
212 %description static -l hu.UTF-8
213 poldek statikus könyvtárak.
215 %description static -l pl.UTF-8
216 Biblioteki statyczne poldka.
218 %package -n python-poldek
219 Summary: Python modules for poldek
220 Summary(hu.UTF-8): Python modulok poldek-hez
221 Summary(pl.UTF-8): Moduły języka Python dla poldka
222 Group: Libraries/Python
223 Requires: %{name}-libs = %{version}-%{release}
224 Requires: python-libs
226 %description -n python-poldek
227 Python modules for poldek.
229 %description -n python-poldek -l hu.UTF-8
230 Python modulok poldek-hez.
232 %description -n python-poldek -l pl.UTF-8
233 Moduły języka Python dla poldka.
248 %{__rm} doc/poldek.info
249 %{__rm} m4/libtool.m4 m4/lt*.m4
251 # cleanup backups after patching
252 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
253 chmod u+x ./configure ./doc/conf-xml2.sh
277 %{?with_static:--enable-static --disable-shared} \
278 %{!?with_imode:--disable-imode} \
279 --with-pkglibdir=%{pkglibexecdir} \
281 %{?with_python:--with-python}
284 %{__make} -C doc poldek.info
295 rm -rf $RPM_BUILD_ROOT
296 install -d $RPM_BUILD_ROOT/var/cache/%{name}
299 DESTDIR=$RPM_BUILD_ROOT
301 install -p %{SOURCE3} $RPM_BUILD_ROOT%{_bindir}/poldek-config
304 %{__make} -C python install \
305 DESTDIR=$RPM_BUILD_ROOT \
306 py_sitedir=%{py_sitedir}
309 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
311 %ifarch i486 i686 ppc sparc alpha athlon aarch64
312 %define ftp_arch %{_target_cpu}
315 %define ftp_arch x86_64
316 %define ftp_alt_arch i686
317 %define ftp_alt2_arch x32
321 %define ftp_alt_arch x86_64
322 %define ftp_alt2_arch i686
325 %define ftp_arch i486
327 %ifarch pentium2 pentium3 pentium4
328 %define ftp_arch i686
330 %ifarch sparcv9 sparc64
331 %define ftp_arch sparc
332 %define ftp_arch %{_target_cpu}
334 %define ftp_alt_arch sparcv9
338 %define pld_conf %{SOURCE1}
339 %define pld_debuginfo_conf %{SOURCE8}
340 %define pld_archive_conf %{SOURCE11}
343 %define pld_multilib_conf %{SOURCE2}
344 %define pld_multilib2_conf %{SOURCE2}
348 %ifarch sparcv9 sparc64
349 %define pld_conf %{SOURCE9}
350 %undefine pld_archive_conf
353 %define pld_multilib_conf %{SOURCE10}
356 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
358 %if 0%{?pld_multilib_conf:1}
359 %{__sed} 's|%%ARCH%%|%{ftp_alt_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
362 %if 0%{?pld_multilib2_conf:1}
363 %{__sed} 's|%%ARCH%%|%{ftp_alt2_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt2_arch}.conf
366 %if 0%{?pld_debuginfo_conf:1}
367 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
370 %if 0%{?pld_archive_conf:1}
371 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_archive_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-archive.conf
374 # Always install snapshot configs
375 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
376 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE100} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
377 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
378 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE102} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-debuginfo.conf
380 %{__sed} -e 's|%%ARCH%%|%{ftp_alt_arch}|g' \
381 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
382 %{__sed} -e 's|%%ARCH%%|%{ftp_alt2_arch}|g' \
383 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt2_arch}.conf
387 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
388 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
390 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
391 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
394 # create "all" meta repo
395 %if 0%{?ftp_alt_arch:1}%{?ftp_alt2_arch:1}
396 cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-all.conf
397 # group source for referring th+th-multiarch sources together, i.e poldek -n th-all
401 sources = th %{?ftp_alt_arch:th-%{ftp_alt_arch}} %{?ftp_alt2_arch:th-%{ftp_alt2_arch}}
405 # th-2014 snap does not exist for x32 yet
406 %if "%{ftp_arch}" == "x32"
407 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
409 %if "%{ftp_alt2_arch}" == "x32"
410 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-x32.conf
413 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
416 # add desktop file and icon
417 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
418 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
419 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
422 # sources we don't package
423 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
424 # include them in %doc
427 %{__rm} -f configs/Makefile*
431 %{__rm} $RPM_BUILD_ROOT%{_libdir}/_poldekmod.{la,so}
437 rm -rf $RPM_BUILD_ROOT
440 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
441 if [ "$1" = "1" ]; then
442 # remove ignore = vserver-packages inside vserver on first install
445 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
446 done </proc/self/status
448 if [ -z "$ctx" -o "$ctx" = "0" ]; then
453 if [ "$VSERVER" = "yes" ]; then
454 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
458 %postun -p /sbin/postshell
459 -/usr/sbin/fix-info-dir -c %{_infodir}
461 %post libs -p /sbin/ldconfig
462 %postun libs -p /sbin/ldconfig
464 %triggerpostun -- poldek < 0.30.1-8
465 # poldek < 0.30-0.20080225.00.1
466 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
467 %{__sed} -i -e '/^%%include source.conf/{
469 a# /etc/poldek/repos.d/*.conf
470 a%%includedir repos.d
471 }' %{_sysconfdir}/%{name}/poldek.conf
474 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
475 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
477 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
478 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
479 %{__mv} -v %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
483 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
484 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
485 %{__mv} -v %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
489 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave ]; then
490 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf{,.rpmnew}
491 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
493 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave ]; then
494 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf{,.rpmnew}
495 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
498 if [ $1 -le 1 ]; then
499 # revert change on --downgrade
500 %{__sed} -i -re 's,^pm command = %{pkglibexecdir}/pm-command.sh,#&,' %{_sysconfdir}/%{name}/%{name}.conf
503 %{__sed} -i -re 's,#?(pm command =).*,\1 %{pkglibexecdir}/pm-command.sh,' %{_sysconfdir}/%{name}/%{name}.conf
506 %files -f %{name}.lang
507 %defattr(644,root,root,755)
508 %doc ChangeLog README* NEWS configs
509 %dir %{_sysconfdir}/%{name}
510 %dir %{_sysconfdir}/%{name}/pre-install.d
511 %{_sysconfdir}/%{name}/pre-install.d/README
512 %dir %{_sysconfdir}/%{name}/post-install.d
513 %{_sysconfdir}/%{name}/post-install.d/README
514 %dir %{_sysconfdir}/%{name}/repos.d
515 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
516 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
517 %attr(755,root,root) %{_bindir}/ipoldek
518 %attr(755,root,root) %{_bindir}/poldek
519 %attr(755,root,root) %{_bindir}/poldek-config
520 %attr(755,root,root) %{_bindir}/rpmvercmp
521 %dir %{pkglibexecdir}
522 %attr(755,root,root) %{pkglibexecdir}/pm-command.sh
523 %attr(755,root,root) %{pkglibexecdir}/poldekuser-setup.sh
524 %attr(755,root,root) %{pkglibexecdir}/vfcompr
525 %attr(755,root,root) %{pkglibexecdir}/vfjuggle
526 %attr(755,root,root) %{pkglibexecdir}/vfsmb
527 %attr(755,root,root) %{pkglibexecdir}/zlib-in-rpm.sh
528 %{_mandir}/man1/%{name}*.1*
529 %lang(pl) %{_mandir}/pl/man1/%{name}*
530 %{_infodir}/poldek.info*
532 %{_desktopdir}/%{name}.desktop
533 %{_pixmapsdir}/%{name}.png
535 %dir /var/cache/%{name}
537 %if %{without static}
539 %defattr(644,root,root,755)
540 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
541 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
542 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
543 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
544 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
545 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.1
546 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.3
547 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
548 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
549 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
553 %defattr(644,root,root,755)
554 %if %{without static}
555 %attr(755,root,root) %{_libdir}/libpoclidek.so
556 %attr(755,root,root) %{_libdir}/libpoldek.so
557 %attr(755,root,root) %{_libdir}/libtndb.so
558 %attr(755,root,root) %{_libdir}/libtrurl.so
559 %attr(755,root,root) %{_libdir}/libvfile.so
561 %{_libdir}/libpoclidek.la
562 %{_libdir}/libpoldek.la
563 %{_libdir}/libtndb.la
564 %{_libdir}/libtrurl.la
565 %{_libdir}/libvfile.la
566 %{_includedir}/poldek
570 %{_pkgconfigdir}/tndb.pc
571 %{_pkgconfigdir}/trurlib.pc
574 %defattr(644,root,root,755)
576 %{_libdir}/libtrurl.a
579 %files -n python-poldek
580 %defattr(644,root,root,755)
581 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
582 %{py_sitescriptdir}/poldek.py[co]
583 %{py_sitescriptdir}/poldekmod.py[co]