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
29 %define ver_rpm 4.5-49
31 %define ver_rpm 5.4.10
35 Summary: RPM packages management helper tool
36 Summary(hu.UTF-8): RPM csomagkezelést segítő eszköz
37 Summary(pl.UTF-8): Pomocnicze narzędzie do zarządzania pakietami RPM
40 Release: %{rel}%{?with_snap:.%{SNAP}}
42 Group: Applications/System
43 #Source0: http://poldek.pld-linux.org/download/snapshots/%{name}-%{version}-cvs%{snap}.tar.bz2
44 Source0: http://carme.pld-linux.org/~megabajt/releases/poldek/%{name}-%{version}.tar.xz
45 # Source0-md5: e569c8454df0932df53b09cee9998927
47 Source2: %{name}-multilib.conf
48 Source3: %{name}-config.sh
49 Source5: %{name}-aliases.conf
50 Source6: %{name}.desktop
52 # Source7-md5: ee487abede50874e9eceb6495d5ee150
53 Source8: %{name}-debuginfo.conf
54 Source9: %{name}-aidath.conf
55 Source10: %{name}-multilib-aidath.conf
56 Source11: %{name}-archive.conf
57 Source100: %{name}-snap.conf
58 Source101: %{name}-multilib-snap.conf
59 Source102: %{name}-debuginfo-snap.conf
60 Patch0: %{name}-size-type.patch
61 Patch1: %{name}-config.patch
62 Patch2: %{name}-missing-include.patch
63 Patch3: pm-hooks.patch
64 Patch4: %{name}-setenv-null.patch
65 Patch5: %{name}-assert-sigint.patch
66 Patch6: %{name}-upgrade-orphan.patch
67 Patch7: %{name}-largefile.patch
68 URL: http://poldek.pld-linux.org/
69 BuildRequires: %{db_pkg}-devel >= %{ver_db}-%{ver_db_rel}
70 BuildRequires: autoconf
71 BuildRequires: automake >= 1:1.11
72 BuildRequires: bzip2-devel
73 BuildRequires: check-devel
74 BuildRequires: docbook-dtd412-xml
75 BuildRequires: gettext-tools
76 BuildRequires: libgomp-devel
77 BuildRequires: libtool
78 BuildRequires: libxml2-devel
79 BuildRequires: openssl-devel >= 0.9.7d
80 BuildRequires: pcre-devel
81 BuildRequires: pkgconfig
82 BuildRequires: popt-devel
83 %{?with_python:BuildRequires: python-devel}
84 BuildRequires: readline-devel >= 5.0
85 BuildRequires: rpm-devel >= %{ver_rpm}
86 %{?with_python:BuildRequires: rpm-pythonprov}
87 BuildRequires: tar >= 1:1.22
90 BuildRequires: zlib-devel
92 BuildRequires: %{db_pkg}-static >= %{ver_db}-%{ver_db_rel}
93 BuildRequires: bzip2-static
94 BuildRequires: glibc-static
95 BuildRequires: libxml2-static
96 BuildRequires: ncurses-static
97 BuildRequires: openssl-static
98 BuildRequires: pcre-static
99 BuildRequires: popt-static
100 BuildRequires: readline-static
101 BuildRequires: rpm-static
102 BuildRequires: zlib-static
104 Requires(triggerpostun): awk
105 Requires(triggerpostun): sed >= 4.0
106 Requires: %{db_pkg} >= %{ver_db}-%{ver_db_rel}
107 Requires: %{name}-libs = %{version}-%{release}
108 Requires: /bin/run-parts
109 Requires: rpm >= %{ver_rpm}
110 Requires: rpm-db-ver = %{ver_db}
111 Requires: rpm-lib >= %{ver_rpm}
113 Conflicts: etckeeper < 1.18-2
114 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
116 %define _libexecdir %{_prefix}/lib/%{name}
119 poldek is an RPM package management tool which allows you to easily
120 perform package verification, installation (including system
121 installation from scratch), upgrading, and removal.
123 Program can be used in batch (like apt-get from Debian's APT) or
124 interactive mode. The interactive mode puts you into a readline
125 interface with command line autocompletion and history, similar to the
126 shell mode of Perl's CPAN.
128 %{?with_static:This version is statically linked.}
130 %{!?with_imode:This version hasn't got interactive mode.}
133 %description -l hu.UTF-8
134 poldek egy RPM csomagkezelő eszköz, amely megkönnyíti a
135 csomagellenőrzést, telepítést (beleértve a rendszertelepítést a
136 nulláról), frissítést és eltávolítást.
138 A program használható parancssorból (mint a Debian apt-get programja)
139 vagy interaktív módban. Az interaktív mód egy readline környezetet
140 jelent, parancskiegészítéssel és előzményekkel, hasonlóan a Perl CPAN
143 %{?with_static:Ez a verzió statikusan linkelt.}
145 %{!?with_imode:Ennek a verziónak nincs interaktív módja.}
147 %description -l pl.UTF-8
148 poldek jest narzędziem linii poleceń służącym do weryfikacji,
149 instalacji (włączając instalację systemu od zera), aktualizacji i
152 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
153 interaktywnym. Tryb interaktywny posiada interfejs readline z
154 dopełnianiem komend i historią, podobny do trybu shell perlowego
157 %{?with_static:Ta wersja jest konsolidowana statycznie.}
159 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
162 Summary: poldek libraries
163 Summary(hu.UTF-8): A poldek könyvtárai
164 Summary(pl.UTF-8): Biblioteki poldka
170 %description libs -l hu.UTF-8
173 %description libs -l pl.UTF-8
177 Summary: Header files for poldek libraries
178 Summary(hu.UTF-8): A poldek könyvtár fejlesztői fájljai
179 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
180 Group: Development/Libraries
181 Requires: %{name}-libs = %{version}-%{release}
182 Requires: rpm-devel >= %{ver_rpm}
185 Header files for poldek libraries.
187 %description devel -l hu.UTF-8
188 A poldek könyvtár fejlesztői fájljai.
190 %description devel -l pl.UTF-8
191 Pliki nagłówkowe bibliotek poldka.
194 Summary: poldek static libraries
195 Summary(hu.UTF-8): poldek statikus könyvtárak
196 Summary(pl.UTF-8): Biblioteki statyczne poldka
197 Group: Development/Libraries
198 Requires: %{name}-devel = %{version}-%{release}
201 poldek static libraries.
203 %description static -l hu.UTF-8
204 poldek statikus könyvtárak.
206 %description static -l pl.UTF-8
207 Biblioteki statyczne poldka.
209 %package -n python-poldek
210 Summary: Python modules for poldek
211 Summary(hu.UTF-8): Python modulok poldek-hez
212 Summary(pl.UTF-8): Moduły języka Python dla poldka
213 Group: Libraries/Python
214 Requires: %{name}-libs = %{version}-%{release}
215 Requires: python-libs
217 %description -n python-poldek
218 Python modules for poldek.
220 %description -n python-poldek -l hu.UTF-8
221 Python modulok poldek-hez.
223 %description -n python-poldek -l pl.UTF-8
224 Moduły języka Python dla poldka.
237 %{__rm} m4/libtool.m4 m4/lt*.m4
239 # cleanup backups after patching
240 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
241 chmod u+x ./configure ./doc/conf-xml2.sh
264 CPPFLAGS="%{rpmcppflags} -std=gnu99 -fgnu89-inline"
266 %{?with_static:--enable-static --disable-shared} \
267 %{!?with_imode:--disable-imode} \
268 --with-pkglibdir=%{_libexecdir} \
270 %{?with_python:--with-python}
275 rm -rf $RPM_BUILD_ROOT
276 install -d $RPM_BUILD_ROOT/var/cache/%{name}
278 %{__make} install -j1 \
279 DESTDIR=$RPM_BUILD_ROOT
281 install -p %{SOURCE3} $RPM_BUILD_ROOT%{_bindir}/poldek-config
284 %{__make} -C python -j1 install \
285 DESTDIR=$RPM_BUILD_ROOT \
289 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
291 %ifarch i486 i686 ppc sparc alpha athlon
292 %define ftp_arch %{_target_cpu}
295 %define ftp_arch x86_64
296 %define ftp_alt_arch i686
297 %define ftp_alt2_arch x32
301 %define ftp_alt_arch x86_64
302 %define ftp_alt2_arch i686
305 %define ftp_arch i486
307 %ifarch pentium2 pentium3 pentium4
308 %define ftp_arch i686
310 %ifarch sparcv9 sparc64
311 %define ftp_arch sparc
312 %define ftp_arch %{_target_cpu}
314 %define ftp_alt_arch sparcv9
318 %define pld_conf %{SOURCE1}
319 %define pld_debuginfo_conf %{SOURCE8}
320 %define pld_archive_conf %{SOURCE11}
323 %define pld_multilib_conf %{SOURCE2}
324 %define pld_multilib2_conf %{SOURCE2}
328 %ifarch sparcv9 sparc64
329 %define pld_conf %{SOURCE9}
330 %undefine pld_archive_conf
333 %define pld_multilib_conf %{SOURCE10}
336 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
338 %if 0%{?pld_multilib_conf:1}
339 %{__sed} 's|%%ARCH%%|%{ftp_alt_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
342 %if 0%{?pld_multilib2_conf:1}
343 %{__sed} 's|%%ARCH%%|%{ftp_alt2_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt2_arch}.conf
346 %if 0%{?pld_debuginfo_conf:1}
347 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
350 %if 0%{?pld_archive_conf:1}
351 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{pld_archive_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-archive.conf
354 # Always install snapshot configs
355 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
356 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE100} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
357 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' \
358 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE102} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-debuginfo.conf
360 %{__sed} -e 's|%%ARCH%%|%{ftp_alt_arch}|g' \
361 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
362 %{__sed} -e 's|%%ARCH%%|%{ftp_alt2_arch}|g' \
363 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt2_arch}.conf
367 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
368 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
370 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
371 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
374 # create "all" meta repo
375 %if 0%{?ftp_alt_arch:1}%{?ftp_alt2_arch:1}
376 cat <<'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-all.conf
377 # group source for referring th+th-multiarch sources together, i.e poldek -n th-all
381 sources = th %{?ftp_alt_arch:th-%{ftp_alt_arch}} %{?ftp_alt2_arch:th-%{ftp_alt2_arch}}
385 # th-2014 snap does not exist for x32 yet
386 %if "%{ftp_arch}" == "x32"
387 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
389 %if "%{ftp_alt2_arch}" == "x32"
390 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-x32.conf
393 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
396 # add desktop file and icon
397 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
398 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
399 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
402 # sources we don't package
403 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
404 # include them in %doc
407 %{__rm} -f configs/Makefile*
411 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
417 rm -rf $RPM_BUILD_ROOT
420 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
421 if [ "$1" = "1" ]; then
422 # remove ignore = vserver-packages inside vserver on first install
425 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
426 done </proc/self/status
428 if [ -z "$ctx" -o "$ctx" = "0" ]; then
433 if [ "$VSERVER" = "yes" ]; then
434 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
438 %postun -p /sbin/postshell
439 -/usr/sbin/fix-info-dir -c %{_infodir}
441 %post libs -p /sbin/ldconfig
442 %postun libs -p /sbin/ldconfig
444 %triggerpostun -- poldek < 0.30-0.20080225.00.1
445 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
446 %{__sed} -i -e '/^%%include source.conf/{
448 a# /etc/poldek/repos.d/*.conf
449 a%%includedir repos.d
450 }' %{_sysconfdir}/%{name}/poldek.conf
453 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
454 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
456 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
457 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
458 %{__mv} -v %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
462 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
463 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
464 %{__mv} -v %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
468 %triggerpostun -- poldek < 0.30.1-3
469 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave ]; then
470 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf{,.rpmnew}
471 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{ftp_alt_arch}.conf
473 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave ]; then
474 %{__mv} -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf{,.rpmnew}
475 %{__mv} -v %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{ftp_alt_arch}.conf
478 %triggerpostun -- %{name} < 0.30.1-8
479 if [ $1 -le 1 ]; then
480 # revert change on --downgrade
481 %{__sed} -i -re 's,^pm command = %{_libexecdir}/pm-command.sh,#&,' %{_sysconfdir}/%{name}/%{name}.conf
484 %{__sed} -i -re 's,#?(pm command =).*,\1 %{_libexecdir}/pm-command.sh,' %{_sysconfdir}/%{name}/%{name}.conf
487 %files -f %{name}.lang
488 %defattr(644,root,root,755)
489 %doc ChangeLog README* NEWS TODO configs
490 %dir %{_sysconfdir}/%{name}
491 %dir %{_sysconfdir}/%{name}/pre-install.d
492 %{_sysconfdir}/%{name}/pre-install.d/README
493 %dir %{_sysconfdir}/%{name}/post-install.d
494 %{_sysconfdir}/%{name}/post-install.d/README
495 %dir %{_sysconfdir}/%{name}/repos.d
496 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
497 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
498 %attr(755,root,root) %{_bindir}/ipoldek
499 %attr(755,root,root) %{_bindir}/poldek
500 %attr(755,root,root) %{_bindir}/poldek-config
501 %attr(755,root,root) %{_bindir}/rpmvercmp
503 %attr(755,root,root) %{_libexecdir}/pm-command.sh
504 %attr(755,root,root) %{_libexecdir}/poldekuser-setup.sh
505 %attr(755,root,root) %{_libexecdir}/vfcompr
506 %attr(755,root,root) %{_libexecdir}/vfjuggle
507 %attr(755,root,root) %{_libexecdir}/vfsmb
508 %attr(755,root,root) %{_libexecdir}/zlib-in-rpm.sh
509 %{_mandir}/man1/%{name}*.1*
510 %lang(pl) %{_mandir}/pl/man1/%{name}*
511 %{_infodir}/poldek.info*
513 %{_desktopdir}/%{name}.desktop
514 %{_pixmapsdir}/%{name}.png
516 %dir /var/cache/%{name}
518 %if %{without static}
520 %defattr(644,root,root,755)
521 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
522 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
523 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
524 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
525 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
526 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
527 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
528 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
529 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
530 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
534 %defattr(644,root,root,755)
535 %if %{without static}
536 %attr(755,root,root) %{_libdir}/libpoclidek.so
537 %attr(755,root,root) %{_libdir}/libpoldek.so
538 %attr(755,root,root) %{_libdir}/libtndb.so
539 %attr(755,root,root) %{_libdir}/libtrurl.so
540 %attr(755,root,root) %{_libdir}/libvfile.so
542 %{_libdir}/libpoclidek.la
543 %{_libdir}/libpoldek.la
544 %{_libdir}/libtndb.la
545 %{_libdir}/libtrurl.la
546 %{_libdir}/libvfile.la
547 %{_includedir}/poldek
551 %{_pkgconfigdir}/tndb.pc
552 %{_pkgconfigdir}/trurlib.pc
555 %defattr(644,root,root,755)
557 %{_libdir}/libtrurl.a
560 %files -n python-poldek
561 %defattr(644,root,root,755)
562 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
563 %{py_sitescriptdir}/poldek.py[co]
564 %{py_sitescriptdir}/poldekmod.py[co]