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 URL: http://poldek.pld-linux.org/
70 BuildRequires: %{db_pkg}-devel >= %{ver_db}
71 BuildRequires: autoconf >= 2.63
72 BuildRequires: automake >= 1:1.11
73 BuildRequires: bzip2-devel
74 BuildRequires: check-devel
75 BuildRequires: docbook-dtd412-xml
76 BuildRequires: docbook2X
77 BuildRequires: gettext-tools >= 0.11.5
78 BuildRequires: libgomp-devel
79 BuildRequires: libtool
80 BuildRequires: libxml2-devel >= 2
81 BuildRequires: ncurses-devel
82 BuildRequires: openssl-devel >= 0.9.7d
83 BuildRequires: pcre-devel
84 BuildRequires: perl-XML-Simple
85 BuildRequires: perl-base
86 BuildRequires: perl-modules
87 BuildRequires: pkgconfig
88 BuildRequires: popt-devel
89 %{?with_python:BuildRequires: python-devel}
90 BuildRequires: readline-devel >= 5.0
91 BuildRequires: rpm-devel >= %{ver_rpm}
92 %{?with_python:BuildRequires: rpm-pythonprov}
93 BuildRequires: tar >= 1:1.22
94 BuildRequires: texinfo
97 BuildRequires: zlib-devel
98 BuildRequires: zstd-devel
100 BuildRequires: %{db_pkg}-static >= %{ver_db}
101 BuildRequires: bzip2-static
102 BuildRequires: glibc-static
103 BuildRequires: libxml2-static
104 BuildRequires: ncurses-static
105 BuildRequires: openssl-static
106 BuildRequires: pcre-static
107 BuildRequires: popt-static
108 BuildRequires: readline-static
109 BuildRequires: rpm-static
110 BuildRequires: zlib-static
111 BuildRequires: zstd-static
113 Requires(postun): awk
114 Requires(postun): sed >= 4.0
116 Requires: %{db_pkg} >= %{ver_db_devel}
118 Requires: %{db_pkg} >= %{ver_db}
119 Requires: rpm-db-ver = %{ver_db}
121 Requires: %{name}-libs = %{version}-%{release}
122 Requires: /bin/run-parts
123 Requires: rpm >= %{ver_rpm}
124 Requires: rpm-lib >= %{ver_rpm}
126 Conflicts: etckeeper < 1.18-2
127 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
129 # it could be %{_libexecdir}/%{name}, but beware of compatibility (path hardcoded in configurations)
130 %define pkglibexecdir %{_prefix}/lib/%{name}
133 poldek is an RPM package management tool which allows you to easily
134 perform package verification, installation (including system
135 installation from scratch), upgrading, and removal.
137 Program can be used in batch (like apt-get from Debian's APT) or
138 interactive mode. The interactive mode puts you into a readline
139 interface with command line autocompletion and history, similar to the
140 shell mode of Perl's CPAN.
142 %{?with_static:This version is statically linked.}
144 %{!?with_imode:This version hasn't got interactive mode.}
147 %description -l hu.UTF-8
148 poldek egy RPM csomagkezelő eszköz, amely megkönnyíti a
149 csomagellenőrzést, telepítést (beleértve a rendszertelepítést a
150 nulláról), frissítést és eltávolítást.
152 A program használható parancssorból (mint a Debian apt-get programja)
153 vagy interaktív módban. Az interaktív mód egy readline környezetet
154 jelent, parancskiegészítéssel és előzményekkel, hasonlóan a Perl CPAN
157 %{?with_static:Ez a verzió statikusan linkelt.}
159 %{!?with_imode:Ennek a verziónak nincs interaktív módja.}
161 %description -l pl.UTF-8
162 poldek jest narzędziem linii poleceń służącym do weryfikacji,
163 instalacji (włączając instalację systemu od zera), aktualizacji i
166 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
167 interaktywnym. Tryb interaktywny posiada interfejs readline z
168 dopełnianiem komend i historią, podobny do trybu shell perlowego
171 %{?with_static:Ta wersja jest konsolidowana statycznie.}
173 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
176 Summary: poldek libraries
177 Summary(hu.UTF-8): A poldek könyvtárai
178 Summary(pl.UTF-8): Biblioteki poldka
184 %description libs -l hu.UTF-8
187 %description libs -l pl.UTF-8
191 Summary: Header files for poldek libraries
192 Summary(hu.UTF-8): A poldek könyvtár fejlesztői fájljai
193 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
194 Group: Development/Libraries
195 Requires: %{name}-libs = %{version}-%{release}
196 Requires: rpm-devel >= %{ver_rpm}
199 Header files for poldek libraries.
201 %description devel -l hu.UTF-8
202 A poldek könyvtár fejlesztői fájljai.
204 %description devel -l pl.UTF-8
205 Pliki nagłówkowe bibliotek poldka.
208 Summary: poldek static libraries
209 Summary(hu.UTF-8): poldek statikus könyvtárak
210 Summary(pl.UTF-8): Biblioteki statyczne poldka
211 Group: Development/Libraries
212 Requires: %{name}-devel = %{version}-%{release}
215 poldek static libraries.
217 %description static -l hu.UTF-8
218 poldek statikus könyvtárak.
220 %description static -l pl.UTF-8
221 Biblioteki statyczne poldka.
223 %package -n python-poldek
224 Summary: Python modules for poldek
225 Summary(hu.UTF-8): Python modulok poldek-hez
226 Summary(pl.UTF-8): Moduły języka Python dla poldka
227 Group: Libraries/Python
228 Requires: %{name}-libs = %{version}-%{release}
229 Requires: python-libs
231 %description -n python-poldek
232 Python modules for poldek.
234 %description -n python-poldek -l hu.UTF-8
235 Python modulok poldek-hez.
237 %description -n python-poldek -l pl.UTF-8
238 Moduły języka Python dla poldka.
260 %{__rm} doc/poldek.info
261 %{__rm} m4/libtool.m4 m4/lt*.m4
263 # cleanup backups after patching
264 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
265 chmod u+x ./configure ./doc/conf-xml2.sh
289 %{?with_static:--enable-static --disable-shared} \
290 %{!?with_imode:--disable-imode} \
291 --with-pkglibdir=%{pkglibexecdir} \
293 %{?with_python:--with-python}
296 %{__make} -C doc poldek.info
307 rm -rf $RPM_BUILD_ROOT
308 install -d $RPM_BUILD_ROOT/var/cache/%{name}
311 DESTDIR=$RPM_BUILD_ROOT
313 install -p %{SOURCE3} $RPM_BUILD_ROOT%{_bindir}/poldek-config
316 %{__make} -C python install \
317 DESTDIR=$RPM_BUILD_ROOT \
318 py_sitedir=%{py_sitedir}
321 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
323 %ifarch i486 i686 ppc sparc alpha athlon aarch64
324 %define ftp_arch %{_target_cpu}
327 %define ftp_arch x86_64
328 %define ftp_alt_arch i686
329 %define ftp_alt2_arch x32
333 %define ftp_alt_arch x86_64
334 %define ftp_alt2_arch i686
337 %define ftp_arch i486
339 %ifarch pentium2 pentium3 pentium4
340 %define ftp_arch i686
342 %ifarch sparcv9 sparc64
343 %define ftp_arch sparc
344 %define ftp_arch %{_target_cpu}
346 %define ftp_alt_arch sparcv9
350 %define pld_conf %{SOURCE1}
351 %define pld_debuginfo_conf %{SOURCE8}
352 %define pld_archive_conf %{SOURCE11}
355 %define pld_multilib_conf %{SOURCE2}
356 %define pld_multilib2_conf %{SOURCE2}
360 %ifarch sparcv9 sparc64
361 %define pld_conf %{SOURCE9}
362 %undefine pld_archive_conf
365 %define pld_multilib_conf %{SOURCE10}
368 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
370 %if 0%{?pld_multilib_conf:1}
371 %{__sed} 's|%%ARCH%%|%{ftp_alt_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
374 %if 0%{?pld_multilib2_conf:1}
375 %{__sed} 's|%%ARCH%%|%{ftp_alt2_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt2_arch}.conf
378 %if 0%{?pld_debuginfo_conf:1}
379 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
382 %if 0%{?pld_archive_conf:1}
383 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_archive_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-archive.conf
386 # Always install snapshot configs
387 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
388 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE100} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
389 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
390 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE102} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-debuginfo.conf
392 %{__sed} -e 's|%%ARCH%%|%{ftp_alt_arch}|g' \
393 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
394 %{__sed} -e 's|%%ARCH%%|%{ftp_alt2_arch}|g' \
395 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt2_arch}.conf
399 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
400 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
402 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
403 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
406 # create "all" meta repo
407 %if 0%{?ftp_alt_arch:1}%{?ftp_alt2_arch:1}
408 cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-all.conf
409 # group source for referring th+th-multiarch sources together, i.e poldek -n th-all
413 sources = th %{?ftp_alt_arch:th-%{ftp_alt_arch}} %{?ftp_alt2_arch:th-%{ftp_alt2_arch}}
417 # th-2014 snap does not exist for x32 yet
418 %if "%{ftp_arch}" == "x32"
419 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
421 %if "%{ftp_alt2_arch}" == "x32"
422 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-x32.conf
425 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
428 # add desktop file and icon
429 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
430 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
431 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
434 # sources we don't package
435 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
436 # include them in %doc
439 %{__rm} -f configs/Makefile*
443 %{__rm} $RPM_BUILD_ROOT%{_libdir}/_poldekmod.{la,so}
449 rm -rf $RPM_BUILD_ROOT
452 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
453 if [ "$1" = "1" ]; then
454 # remove ignore = vserver-packages inside vserver on first install
457 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
458 done </proc/self/status
460 if [ -z "$ctx" -o "$ctx" = "0" ]; then
465 if [ "$VSERVER" = "yes" ]; then
466 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
470 %postun -p /sbin/postshell
471 -/usr/sbin/fix-info-dir -c %{_infodir}
473 %post libs -p /sbin/ldconfig
474 %postun libs -p /sbin/ldconfig
476 %triggerpostun -- poldek < 0.30.1-8
477 # poldek < 0.30-0.20080225.00.1
478 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
479 %{__sed} -i -e '/^%%include source.conf/{
481 a# /etc/poldek/repos.d/*.conf
482 a%%includedir repos.d
483 }' %{_sysconfdir}/%{name}/poldek.conf
486 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
487 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
489 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
490 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
491 %{__mv} -v %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
495 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
496 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
497 %{__mv} -v %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
501 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave ]; then
502 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf{,.rpmnew}
503 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
505 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave ]; then
506 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf{,.rpmnew}
507 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
510 if [ $1 -le 1 ]; then
511 # revert change on --downgrade
512 %{__sed} -i -re 's,^pm command = %{pkglibexecdir}/pm-command.sh,#&,' %{_sysconfdir}/%{name}/%{name}.conf
515 %{__sed} -i -re 's,#?(pm command =).*,\1 %{pkglibexecdir}/pm-command.sh,' %{_sysconfdir}/%{name}/%{name}.conf
518 %files -f %{name}.lang
519 %defattr(644,root,root,755)
520 %doc ChangeLog README* NEWS configs
521 %dir %{_sysconfdir}/%{name}
522 %dir %{_sysconfdir}/%{name}/pre-install.d
523 %{_sysconfdir}/%{name}/pre-install.d/README
524 %dir %{_sysconfdir}/%{name}/post-install.d
525 %{_sysconfdir}/%{name}/post-install.d/README
526 %dir %{_sysconfdir}/%{name}/repos.d
527 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
528 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
529 %attr(755,root,root) %{_bindir}/ipoldek
530 %attr(755,root,root) %{_bindir}/poldek
531 %attr(755,root,root) %{_bindir}/poldek-config
532 %attr(755,root,root) %{_bindir}/rpmvercmp
533 %dir %{pkglibexecdir}
534 %attr(755,root,root) %{pkglibexecdir}/pm-command.sh
535 %attr(755,root,root) %{pkglibexecdir}/poldekuser-setup.sh
536 %attr(755,root,root) %{pkglibexecdir}/vfcompr
537 %attr(755,root,root) %{pkglibexecdir}/vfjuggle
538 %attr(755,root,root) %{pkglibexecdir}/vfsmb
539 %attr(755,root,root) %{pkglibexecdir}/zlib-in-rpm.sh
540 %{_mandir}/man1/%{name}*.1*
541 %lang(pl) %{_mandir}/pl/man1/%{name}*
542 %{_infodir}/poldek.info*
544 %{_desktopdir}/%{name}.desktop
545 %{_pixmapsdir}/%{name}.png
547 %dir /var/cache/%{name}
549 %if %{without static}
551 %defattr(644,root,root,755)
552 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
553 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
554 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
555 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
556 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
557 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.1
558 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.3
559 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
560 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
561 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
565 %defattr(644,root,root,755)
566 %if %{without static}
567 %attr(755,root,root) %{_libdir}/libpoclidek.so
568 %attr(755,root,root) %{_libdir}/libpoldek.so
569 %attr(755,root,root) %{_libdir}/libtndb.so
570 %attr(755,root,root) %{_libdir}/libtrurl.so
571 %attr(755,root,root) %{_libdir}/libvfile.so
573 %{_libdir}/libpoclidek.la
574 %{_libdir}/libpoldek.la
575 %{_libdir}/libtndb.la
576 %{_libdir}/libtrurl.la
577 %{_libdir}/libvfile.la
578 %{_includedir}/poldek
582 %{_pkgconfigdir}/tndb.pc
583 %{_pkgconfigdir}/trurlib.pc
586 %defattr(644,root,root,755)
588 %{_libdir}/libtrurl.a
591 %files -n python-poldek
592 %defattr(644,root,root,755)
593 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
594 %{py_sitescriptdir}/poldek.py[co]
595 %{py_sitescriptdir}/poldekmod.py[co]