3 %bcond_with static # don't use shared libraries
4 %bcond_without imode # don't build interactive mode
5 %bcond_without python # don't build python bindings
6 %bcond_with snap # install configs for official Th snapshot
7 %bcond_with db61 # DB 6.1 instead of 5.2
8 %bcond_with rpm4 # use rpm4/db4.7 instead of rpm5
10 # current snapshot name
13 # required versions (forced to avoid SEGV with mixed db used by rpm and poldek)
14 # NOTE: poldek links with "system db" (-ldb) anyway if it exists
28 %define ver_rpm 4.5-49
30 %define ver_rpm 5.4.10
34 Summary: RPM packages management helper tool
35 Summary(hu.UTF-8): RPM csomagkezelést segítő eszköz
36 Summary(pl.UTF-8): Pomocnicze narzędzie do zarządzania pakietami RPM
39 Release: %{rel}%{?with_snap:.%{SNAP}}
41 Group: Applications/System
42 #Source0: http://poldek.pld-linux.org/download/snapshots/%{name}-%{version}-cvs%{snap}.tar.bz2
43 Source0: http://carme.pld-linux.org/~megabajt/releases/poldek/%{name}-%{version}.tar.xz
44 # Source0-md5: e569c8454df0932df53b09cee9998927
46 Source2: %{name}-multilib.conf
47 Source5: %{name}-aliases.conf
48 Source6: %{name}.desktop
50 Source8: %{name}-debuginfo.conf
51 Source9: %{name}-aidath.conf
52 Source10: %{name}-multilib-aidath.conf
53 Source11: %{name}-archive.conf
54 Source100: %{name}-snap.conf
55 Source101: %{name}-multilib-snap.conf
56 Source102: %{name}-debuginfo-snap.conf
57 Patch0: %{name}-size-type.patch
58 Patch1: %{name}-config.patch
59 Patch2: %{name}-missing-include.patch
60 Patch3: pm-hooks.patch
61 URL: http://poldek.pld-linux.org/
62 BuildRequires: %{db_pkg}-devel >= %{ver_db}-%{ver_db_rel}
63 BuildRequires: autoconf
64 BuildRequires: automake >= 1:1.11
65 BuildRequires: bzip2-devel
66 BuildRequires: check-devel
67 BuildRequires: docbook-dtd412-xml
68 BuildRequires: gettext-tools
69 BuildRequires: libtool
70 BuildRequires: libxml2-devel
71 BuildRequires: neon-devel
72 BuildRequires: openssl-devel >= 0.9.7d
73 BuildRequires: pcre-devel
74 BuildRequires: pkgconfig
75 BuildRequires: popt-devel
76 %{?with_python:BuildRequires: python-devel}
77 BuildRequires: readline-devel >= 5.0
78 BuildRequires: rpm-devel >= %{ver_rpm}
79 %{?with_python:BuildRequires: rpm-pythonprov}
80 BuildRequires: swig-python
81 BuildRequires: tar >= 1:1.22
84 BuildRequires: zlib-devel
86 BuildRequires: %{db_pkg}-static >= %{ver_db}-%{ver_db_rel}
87 BuildRequires: bzip2-static
88 BuildRequires: glibc-static
89 BuildRequires: libxml2-static
90 BuildRequires: ncurses-static
91 BuildRequires: openssl-static
92 BuildRequires: pcre-static
93 BuildRequires: popt-static
94 BuildRequires: readline-static
95 BuildRequires: rpm-static
96 BuildRequires: zlib-static
98 Requires(triggerpostun): awk
99 Requires(triggerpostun): sed >= 4.0
100 Requires: %{db_pkg} >= %{ver_db}-%{ver_db_rel}
101 Requires: %{name}-libs = %{version}-%{release}
102 Requires: rpm >= %{ver_rpm}
103 Requires: rpm-db-ver = %{ver_db}
104 Requires: rpm-lib >= %{ver_rpm}
106 Conflicts: etckeeper < 1.18-2
107 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
109 %define _libexecdir %{_prefix}/lib/%{name}
112 poldek is an RPM package management tool which allows you to easily
113 perform package verification, installation (including system
114 installation from scratch), upgrading, and removal.
116 Program can be used in batch (like apt-get from Debian's APT) or
117 interactive mode. The interactive mode puts you into a readline
118 interface with command line autocompletion and history, similar to the
119 shell mode of Perl's CPAN.
121 %{?with_static:This version is statically linked.}
123 %{!?with_imode:This version hasn't got interactive mode.}
126 %description -l hu.UTF-8
127 poldek egy RPM csomagkezelő eszköz, amely megkönnyíti a
128 csomagellenőrzést, telepítést (beleértve a rendszertelepítést a
129 nulláról), frissítést és eltávolítást.
131 A program használható parancssorból (mint a Debian apt-get programja)
132 vagy interaktív módban. Az interaktív mód egy readline környezetet
133 jelent, parancskiegészítéssel és előzményekkel, hasonlóan a Perl CPAN
136 %{?with_static:Ez a verzió statikusan linkelt.}
138 %{!?with_imode:Ennek a verziónak nincs interaktív módja.}
140 %description -l pl.UTF-8
141 poldek jest narzędziem linii poleceń służącym do weryfikacji,
142 instalacji (włączając instalację systemu od zera), aktualizacji i
145 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
146 interaktywnym. Tryb interaktywny posiada interfejs readline z
147 dopełnianiem komend i historią, podobny do trybu shell perlowego
150 %{?with_static:Ta wersja jest konsolidowana statycznie.}
152 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
155 Summary: poldek libraries
156 Summary(hu.UTF-8): A poldek könyvtárai
157 Summary(pl.UTF-8): Biblioteki poldka
163 %description libs -l hu.UTF-8
166 %description libs -l pl.UTF-8
170 Summary: Header files for poldek libraries
171 Summary(hu.UTF-8): A poldek könyvtár fejlesztői fájljai
172 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
173 Group: Development/Libraries
174 Requires: %{name}-libs = %{version}-%{release}
175 Requires: rpm-devel >= %{ver_rpm}
178 Header files for poldek libraries.
180 %description devel -l hu.UTF-8
181 A poldek könyvtár fejlesztői fájljai.
183 %description devel -l pl.UTF-8
184 Pliki nagłówkowe bibliotek poldka.
187 Summary: poldek static libraries
188 Summary(hu.UTF-8): poldek statikus könyvtárak
189 Summary(pl.UTF-8): Biblioteki statyczne poldka
190 Group: Development/Libraries
191 Requires: %{name}-devel = %{version}-%{release}
194 poldek static libraries.
196 %description static -l hu.UTF-8
197 poldek statikus könyvtárak.
199 %description static -l pl.UTF-8
200 Biblioteki statyczne poldka.
202 %package -n python-poldek
203 Summary: Python modules for poldek
204 Summary(hu.UTF-8): Python modulok poldek-hez
205 Summary(pl.UTF-8): Moduły języka Python dla poldka
206 Group: Libraries/Python
207 Requires: %{name}-libs = %{version}-%{release}
208 Requires: python-libs
210 %description -n python-poldek
211 Python modules for poldek.
213 %description -n python-poldek -l hu.UTF-8
214 Python modulok poldek-hez.
216 %description -n python-poldek -l pl.UTF-8
217 Moduły języka Python dla poldka.
226 %{__rm} m4/libtool.m4 m4/lt*.m4
228 # cleanup backups after patching
229 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
230 chmod u+x ./configure ./doc/conf-xml2.sh
253 CPPFLAGS="%{rpmcppflags} -std=gnu99 -fgnu89-inline"
255 %{?with_static:--enable-static --disable-shared} \
256 %{!?with_imode:--disable-imode} \
257 --with-pkglibdir=%{_libexecdir} \
259 %{?with_python:--with-python}
264 rm -rf $RPM_BUILD_ROOT
265 install -d $RPM_BUILD_ROOT/var/cache/%{name}
267 %{__make} install -j1 \
268 DESTDIR=$RPM_BUILD_ROOT
271 %{__make} -C python -j1 install \
272 DESTDIR=$RPM_BUILD_ROOT \
276 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
278 %ifarch i486 i686 ppc sparc alpha athlon
279 %define ftp_arch %{_target_cpu}
282 %define ftp_arch x86_64
283 %define ftp_alt_arch i686
284 %define ftp_alt2_arch x32
288 %define ftp_alt_arch x86_64
289 %define ftp_alt2_arch i686
292 %define ftp_arch i486
294 %ifarch pentium2 pentium3 pentium4
295 %define ftp_arch i686
297 %ifarch sparcv9 sparc64
298 %define ftp_arch sparc
299 %define ftp_arch %{_target_cpu}
301 %define ftp_alt_arch sparcv9
305 %define pld_conf %{SOURCE1}
306 %define pld_debuginfo_conf %{SOURCE8}
307 %define pld_archive_conf %{SOURCE11}
310 %define pld_multilib_conf %{SOURCE2}
311 %define pld_multilib2_conf %{SOURCE2}
315 %ifarch sparcv9 sparc64
316 %define pld_conf %{SOURCE9}
317 %undefine pld_archive_conf
320 %define pld_multilib_conf %{SOURCE10}
323 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
325 %if 0%{?pld_multilib_conf:1}
326 %{__sed} 's|%%ARCH%%|%{ftp_alt_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
329 %if 0%{?pld_multilib2_conf:1}
330 %{__sed} 's|%%ARCH%%|%{ftp_alt2_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt2_arch}.conf
333 %if 0%{?pld_debuginfo_conf:1}
334 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
337 %if 0%{?pld_archive_conf:1}
338 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_archive_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-archive.conf
341 # Always install snapshot configs
342 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
343 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE100} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
344 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
345 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE102} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-debuginfo.conf
347 %{__sed} -e 's|%%ARCH%%|%{ftp_alt_arch}|g' \
348 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
349 %{__sed} -e 's|%%ARCH%%|%{ftp_alt2_arch}|g' \
350 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt2_arch}.conf
354 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
355 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
357 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
358 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
361 # create "all" meta repo
362 %if 0%{?ftp_alt_arch:1}%{?ftp_alt2_arch:1}
363 cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-all.conf
364 # group source for referring th+th-multiarch sources together, i.e poldek -n th-all
368 sources = th %{?ftp_alt_arch:th-%{ftp_alt_arch}} %{?ftp_alt2_arch:th-%{ftp_alt2_arch}}
372 # th-2014 snap does not exist for x32 yet
373 %if "%{ftp_arch}" == "x32"
374 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
376 %if "%{ftp_alt2_arch}" == "x32"
377 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-x32.conf
380 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
383 # add desktop file and icon
384 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
385 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
386 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
389 # sources we don't package
390 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
391 # include them in %doc
394 %{__rm} -f configs/Makefile*
398 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
404 rm -rf $RPM_BUILD_ROOT
407 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
408 if [ "$1" = "1" ]; then
409 # remove ignore = vserver-packages inside vserver on first install
412 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
413 done </proc/self/status
415 if [ -z "$ctx" -o "$ctx" = "0" ]; then
420 if [ "$VSERVER" = "yes" ]; then
421 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
425 %postun -p /sbin/postshell
426 -/usr/sbin/fix-info-dir -c %{_infodir}
428 %post libs -p /sbin/ldconfig
429 %postun libs -p /sbin/ldconfig
431 %triggerpostun -- poldek < 0.30-0.20080225.00.1
432 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
433 %{__sed} -i -e '/^%%include source.conf/{
435 a# /etc/poldek/repos.d/*.conf
436 a%%includedir repos.d
437 }' %{_sysconfdir}/%{name}/poldek.conf
440 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
441 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
443 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
444 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
445 %{__mv} -v %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
449 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
450 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
451 %{__mv} -v %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
455 %triggerpostun -- poldek < 0.30.1-3
456 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave ]; then
457 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf{,.rpmnew}
458 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
460 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave ]; then
461 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf{,.rpmnew}
462 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
465 %triggerpostun -- %{name} < 0.30.1-8
466 if [ $1 -le 1 ]; then
467 # revert change on --downgrade
468 %{__sed} -i -re 's,^pm command = %{_libexecdir}/pm-command.sh,#&,' /etc/poldek/poldek.conf
471 %{__sed} -i -re 's,#?(pm command =).*,\1 %{_libexecdir}/pm-command.sh,' /etc/poldek/poldek.conf
474 %files -f %{name}.lang
475 %defattr(644,root,root,755)
476 %doc ChangeLog README* NEWS TODO configs
477 %dir %{_sysconfdir}/%{name}
478 %dir %{_sysconfdir}/%{name}/pre-install.d
479 %{_sysconfdir}/%{name}/pre-install.d/README
480 %dir %{_sysconfdir}/%{name}/post-install.d
481 %{_sysconfdir}/%{name}/post-install.d/README
482 %dir %{_sysconfdir}/%{name}/repos.d
483 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
484 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
485 %attr(755,root,root) %{_bindir}/ipoldek
486 %attr(755,root,root) %{_bindir}/poldek
487 %attr(755,root,root) %{_bindir}/rpmvercmp
489 %attr(755,root,root) %{_libexecdir}/pm-command.sh
490 %attr(755,root,root) %{_libexecdir}/poldekuser-setup.sh
491 %attr(755,root,root) %{_libexecdir}/vfcompr
492 %attr(755,root,root) %{_libexecdir}/vfjuggle
493 %attr(755,root,root) %{_libexecdir}/vfsmb
494 %attr(755,root,root) %{_libexecdir}/zlib-in-rpm.sh
495 %{_mandir}/man1/%{name}*.1*
496 %lang(pl) %{_mandir}/pl/man1/%{name}*
497 %{_infodir}/poldek.info*
499 %{_desktopdir}/%{name}.desktop
500 %{_pixmapsdir}/%{name}.png
502 %dir /var/cache/%{name}
504 %if %{without static}
506 %defattr(644,root,root,755)
507 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
508 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
509 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
510 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
511 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
512 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
513 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
514 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
515 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
516 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
520 %defattr(644,root,root,755)
521 %if %{without static}
522 %attr(755,root,root) %{_libdir}/libpoclidek.so
523 %attr(755,root,root) %{_libdir}/libpoldek.so
524 %attr(755,root,root) %{_libdir}/libtndb.so
525 %attr(755,root,root) %{_libdir}/libtrurl.so
526 %attr(755,root,root) %{_libdir}/libvfile.so
528 %{_libdir}/libpoclidek.la
529 %{_libdir}/libpoldek.la
530 %{_libdir}/libtndb.la
531 %{_libdir}/libtrurl.la
532 %{_libdir}/libvfile.la
533 %{_includedir}/poldek
537 %{_pkgconfigdir}/tndb.pc
538 %{_pkgconfigdir}/trurlib.pc
541 %defattr(644,root,root,755)
543 %{_libdir}/libtrurl.a
546 %files -n python-poldek
547 %defattr(644,root,root,755)
548 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
549 %{py_sitescriptdir}/poldek.py[co]
550 %{py_sitescriptdir}/poldekmod.py[co]