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 rpm5 # use rpm5 instead of rpm4
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 Patch12: rpm4-rpmvercmp.patch
67 Patch13: trurlib-shared.patch
68 Patch14: rpm4-script-req-workaround.patch
69 Patch15: skip-buildid-obsoletes.patch
70 Patch16: verify-signature.patch
71 URL: http://poldek.pld-linux.org/
72 BuildRequires: %{db_pkg}-devel >= %{ver_db}
73 BuildRequires: autoconf >= 2.63
74 BuildRequires: automake >= 1:1.11
75 BuildRequires: bzip2-devel
76 BuildRequires: check-devel
77 BuildRequires: docbook-dtd412-xml
78 BuildRequires: docbook2X
79 BuildRequires: gettext-tools >= 0.11.5
80 BuildRequires: libgomp-devel
81 BuildRequires: libtool
82 BuildRequires: libxml2-devel >= 2
83 BuildRequires: lua54-devel
84 BuildRequires: ncurses-devel
85 BuildRequires: openssl-devel >= 0.9.7d
86 BuildRequires: pcre-devel
87 BuildRequires: perl-XML-Simple
88 BuildRequires: perl-base
89 BuildRequires: perl-modules
90 BuildRequires: pkgconfig
91 BuildRequires: popt-devel
92 %{?with_python:BuildRequires: python-devel}
93 BuildRequires: readline-devel >= 5.0
94 BuildRequires: rpm-devel >= %{ver_rpm}
95 %{?with_python:BuildRequires: rpm-pythonprov}
96 BuildRequires: tar >= 1:1.22
97 BuildRequires: texinfo
100 BuildRequires: zlib-devel
101 BuildRequires: zstd-devel
103 BuildRequires: %{db_pkg}-static >= %{ver_db}
104 BuildRequires: bzip2-static
105 BuildRequires: glibc-static
106 BuildRequires: libxml2-static
107 BuildRequires: ncurses-static
108 BuildRequires: openssl-static
109 BuildRequires: pcre-static
110 BuildRequires: popt-static
111 BuildRequires: readline-static
112 BuildRequires: rpm-static
113 BuildRequires: zlib-static
114 BuildRequires: zstd-static
116 Requires(postun): awk
117 Requires(postun): sed >= 4.0
119 Requires: %{db_pkg} >= %{ver_db_devel}
121 Requires: %{db_pkg} >= %{ver_db}
122 Requires: rpm-db-ver = %{ver_db}
124 Requires: %{name}-libs = %{version}-%{release}
125 Requires: /bin/run-parts
126 Requires: rpm >= %{ver_rpm}
127 Requires: rpm-lib >= %{ver_rpm}
129 Conflicts: etckeeper < 1.18-2
130 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
132 # it could be %{_libexecdir}/%{name}, but beware of compatibility (path hardcoded in configurations)
133 %define pkglibexecdir %{_prefix}/lib/%{name}
136 poldek is an RPM package management tool which allows you to easily
137 perform package verification, installation (including system
138 installation from scratch), upgrading, and removal.
140 Program can be used in batch (like apt-get from Debian's APT) or
141 interactive mode. The interactive mode puts you into a readline
142 interface with command line autocompletion and history, similar to the
143 shell mode of Perl's CPAN.
145 %{?with_static:This version is statically linked.}
147 %{!?with_imode:This version hasn't got interactive mode.}
150 %description -l hu.UTF-8
151 poldek egy RPM csomagkezelő eszköz, amely megkönnyíti a
152 csomagellenőrzést, telepítést (beleértve a rendszertelepítést a
153 nulláról), frissítést és eltávolítást.
155 A program használható parancssorból (mint a Debian apt-get programja)
156 vagy interaktív módban. Az interaktív mód egy readline környezetet
157 jelent, parancskiegészítéssel és előzményekkel, hasonlóan a Perl CPAN
160 %{?with_static:Ez a verzió statikusan linkelt.}
162 %{!?with_imode:Ennek a verziónak nincs interaktív módja.}
164 %description -l pl.UTF-8
165 poldek jest narzędziem linii poleceń służącym do weryfikacji,
166 instalacji (włączając instalację systemu od zera), aktualizacji i
169 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
170 interaktywnym. Tryb interaktywny posiada interfejs readline z
171 dopełnianiem komend i historią, podobny do trybu shell perlowego
174 %{?with_static:Ta wersja jest konsolidowana statycznie.}
176 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
179 Summary: poldek libraries
180 Summary(hu.UTF-8): A poldek könyvtárai
181 Summary(pl.UTF-8): Biblioteki poldka
187 %description libs -l hu.UTF-8
190 %description libs -l pl.UTF-8
194 Summary: Header files for poldek libraries
195 Summary(hu.UTF-8): A poldek könyvtár fejlesztői fájljai
196 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
197 Group: Development/Libraries
198 Requires: %{name}-libs = %{version}-%{release}
199 Requires: rpm-devel >= %{ver_rpm}
202 Header files for poldek libraries.
204 %description devel -l hu.UTF-8
205 A poldek könyvtár fejlesztői fájljai.
207 %description devel -l pl.UTF-8
208 Pliki nagłówkowe bibliotek poldka.
211 Summary: poldek static libraries
212 Summary(hu.UTF-8): poldek statikus könyvtárak
213 Summary(pl.UTF-8): Biblioteki statyczne poldka
214 Group: Development/Libraries
215 Requires: %{name}-devel = %{version}-%{release}
218 poldek static libraries.
220 %description static -l hu.UTF-8
221 poldek statikus könyvtárak.
223 %description static -l pl.UTF-8
224 Biblioteki statyczne poldka.
226 %package -n python-poldek
227 Summary: Python modules for poldek
228 Summary(hu.UTF-8): Python modulok poldek-hez
229 Summary(pl.UTF-8): Moduły języka Python dla poldka
230 Group: Libraries/Python
231 Requires: %{name}-libs = %{version}-%{release}
232 Requires: python-libs
234 %description -n python-poldek
235 Python modules for poldek.
237 %description -n python-poldek -l hu.UTF-8
238 Python modulok poldek-hez.
240 %description -n python-poldek -l pl.UTF-8
241 Moduły języka Python dla poldka.
265 %{__rm} doc/poldek.info
266 %{__rm} m4/libtool.m4 m4/lt*.m4
268 # cleanup backups after patching
269 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
270 chmod u+x ./configure ./doc/conf-xml2.sh
294 %{?with_static:--enable-static --disable-shared} \
295 %{!?with_imode:--disable-imode} \
296 --with-pkglibdir=%{pkglibexecdir} \
298 %{?with_python:--with-python}
301 %{__make} -C doc poldek.info
312 rm -rf $RPM_BUILD_ROOT
313 install -d $RPM_BUILD_ROOT/var/cache/%{name}
316 DESTDIR=$RPM_BUILD_ROOT
318 install -p %{SOURCE3} $RPM_BUILD_ROOT%{_bindir}/poldek-config
321 %{__make} -C python install \
322 DESTDIR=$RPM_BUILD_ROOT \
323 py_sitedir=%{py_sitedir}
326 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
328 %ifarch i486 i686 ppc sparc alpha athlon aarch64 %{arm}
329 %define ftp_arch %{_target_cpu}
332 %define ftp_arch x86_64
333 %define ftp_alt_arch i686
334 %define ftp_alt2_arch x32
338 %define ftp_alt_arch x86_64
339 %define ftp_alt2_arch i686
342 %define ftp_arch i486
344 %ifarch pentium2 pentium3 pentium4
345 %define ftp_arch i686
347 %ifarch sparcv9 sparc64
348 %define ftp_arch sparc
349 %define ftp_arch %{_target_cpu}
351 %define ftp_alt_arch sparcv9
355 %define pld_conf %{SOURCE1}
356 %define pld_debuginfo_conf %{SOURCE8}
357 %define pld_archive_conf %{SOURCE11}
360 %define pld_multilib_conf %{SOURCE2}
361 %define pld_multilib2_conf %{SOURCE2}
365 %ifarch sparcv9 sparc64
366 %define pld_conf %{SOURCE9}
367 %undefine pld_archive_conf
370 %define pld_multilib_conf %{SOURCE10}
373 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
375 %if 0%{?pld_multilib_conf:1}
376 %{__sed} 's|%%ARCH%%|%{ftp_alt_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
379 %if 0%{?pld_multilib2_conf:1}
380 %{__sed} 's|%%ARCH%%|%{ftp_alt2_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt2_arch}.conf
383 %if 0%{?pld_debuginfo_conf:1}
384 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
387 %if 0%{?pld_archive_conf:1}
388 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_archive_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-archive.conf
391 # Always install snapshot configs
392 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
393 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE100} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
394 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
395 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE102} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-debuginfo.conf
397 %{__sed} -e 's|%%ARCH%%|%{ftp_alt_arch}|g' \
398 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
399 %{__sed} -e 's|%%ARCH%%|%{ftp_alt2_arch}|g' \
400 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt2_arch}.conf
404 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
405 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
407 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
408 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
411 # create "all" meta repo
412 %if 0%{?ftp_alt_arch:1}%{?ftp_alt2_arch:1}
413 cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-all.conf
414 # group source for referring th+th-multiarch sources together, i.e poldek -n th-all
418 sources = th %{?ftp_alt_arch:th-%{ftp_alt_arch}} %{?ftp_alt2_arch:th-%{ftp_alt2_arch}}
422 # th-2014 snap does not exist for x32 yet
423 %if "%{ftp_arch}" == "x32"
424 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
426 %if "%{ftp_alt2_arch}" == "x32"
427 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-x32.conf
430 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
433 # add desktop file and icon
434 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
435 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
436 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
439 # sources we don't package
440 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
441 # include them in %doc
444 %{__rm} -f configs/Makefile*
448 %{__rm} $RPM_BUILD_ROOT%{_libdir}/_poldekmod.{la,so}
454 rm -rf $RPM_BUILD_ROOT
457 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
458 if [ "$1" = "1" ]; then
459 # remove ignore = vserver-packages inside vserver on first install
462 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
463 done </proc/self/status
465 if [ -z "$ctx" -o "$ctx" = "0" ]; then
470 if [ "$VSERVER" = "yes" ]; then
471 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
475 %postun -p /sbin/postshell
476 -/usr/sbin/fix-info-dir -c %{_infodir}
478 %post libs -p /sbin/ldconfig
479 %postun libs -p /sbin/ldconfig
481 %triggerpostun -- poldek < 0.30.1-8
482 # poldek < 0.30-0.20080225.00.1
483 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
484 %{__sed} -i -e '/^%%include source.conf/{
486 a# /etc/poldek/repos.d/*.conf
487 a%%includedir repos.d
488 }' %{_sysconfdir}/%{name}/poldek.conf
491 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
492 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
494 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
495 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
496 %{__mv} -v %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
500 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
501 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
502 %{__mv} -v %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
506 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave ]; then
507 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf{,.rpmnew}
508 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
510 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave ]; then
511 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf{,.rpmnew}
512 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
515 if [ $1 -le 1 ]; then
516 # revert change on --downgrade
517 %{__sed} -i -re 's,^pm command = %{pkglibexecdir}/pm-command.sh,#&,' %{_sysconfdir}/%{name}/%{name}.conf
520 %{__sed} -i -re 's,#?(pm command =).*,\1 %{pkglibexecdir}/pm-command.sh,' %{_sysconfdir}/%{name}/%{name}.conf
523 %files -f %{name}.lang
524 %defattr(644,root,root,755)
525 %doc ChangeLog README* NEWS configs
526 %dir %{_sysconfdir}/%{name}
527 %dir %{_sysconfdir}/%{name}/pre-install.d
528 %{_sysconfdir}/%{name}/pre-install.d/README
529 %dir %{_sysconfdir}/%{name}/post-install.d
530 %{_sysconfdir}/%{name}/post-install.d/README
531 %dir %{_sysconfdir}/%{name}/repos.d
532 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
533 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
534 %attr(755,root,root) %{_bindir}/ipoldek
535 %attr(755,root,root) %{_bindir}/poldek
536 %attr(755,root,root) %{_bindir}/poldek-config
537 %attr(755,root,root) %{_bindir}/rpmvercmp
538 %dir %{pkglibexecdir}
539 %attr(755,root,root) %{pkglibexecdir}/pm-command.sh
540 %attr(755,root,root) %{pkglibexecdir}/poldekuser-setup.sh
541 %attr(755,root,root) %{pkglibexecdir}/vfcompr
542 %attr(755,root,root) %{pkglibexecdir}/vfjuggle
543 %attr(755,root,root) %{pkglibexecdir}/vfsmb
544 %attr(755,root,root) %{pkglibexecdir}/zlib-in-rpm.sh
545 %{_mandir}/man1/%{name}*.1*
546 %lang(pl) %{_mandir}/pl/man1/%{name}*
547 %{_infodir}/poldek.info*
549 %{_desktopdir}/%{name}.desktop
550 %{_pixmapsdir}/%{name}.png
552 %dir /var/cache/%{name}
554 %if %{without static}
556 %defattr(644,root,root,755)
557 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
558 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
559 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
560 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
561 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
562 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.1
563 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.3
564 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
565 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
566 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
570 %defattr(644,root,root,755)
571 %if %{without static}
572 %attr(755,root,root) %{_libdir}/libpoclidek.so
573 %attr(755,root,root) %{_libdir}/libpoldek.so
574 %attr(755,root,root) %{_libdir}/libtndb.so
575 %attr(755,root,root) %{_libdir}/libtrurl.so
576 %attr(755,root,root) %{_libdir}/libvfile.so
578 %{_libdir}/libpoclidek.la
579 %{_libdir}/libpoldek.la
580 %{_libdir}/libtndb.la
581 %{_libdir}/libtrurl.la
582 %{_libdir}/libvfile.la
583 %{_includedir}/poldek
587 %{_pkgconfigdir}/tndb.pc
588 %{_pkgconfigdir}/trurlib.pc
591 %defattr(644,root,root,755)
593 %{_libdir}/libtrurl.a
596 %files -n python-poldek
597 %defattr(644,root,root,755)
598 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
599 %{py_sitescriptdir}/poldek.py[co]
600 %{py_sitescriptdir}/poldekmod.py[co]