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 URL: http://poldek.pld-linux.org/
61 BuildRequires: %{db_pkg}-devel >= %{ver_db}-%{ver_db_rel}
62 BuildRequires: autoconf
63 BuildRequires: automake >= 1:1.11
64 BuildRequires: bzip2-devel
65 BuildRequires: check-devel
66 BuildRequires: docbook-dtd412-xml
67 BuildRequires: gettext-tools
68 BuildRequires: libtool
69 BuildRequires: libxml2-devel
70 BuildRequires: neon-devel
71 BuildRequires: openssl-devel >= 0.9.7d
72 BuildRequires: pcre-devel
73 BuildRequires: pkgconfig
74 BuildRequires: popt-devel
75 %{?with_python:BuildRequires: python-devel}
76 BuildRequires: readline-devel >= 5.0
77 BuildRequires: rpm-devel >= %{ver_rpm}
78 %{?with_python:BuildRequires: rpm-pythonprov}
79 BuildRequires: swig-python
80 BuildRequires: tar >= 1:1.22
83 BuildRequires: zlib-devel
85 BuildRequires: %{db_pkg}-static >= %{ver_db}-%{ver_db_rel}
86 BuildRequires: bzip2-static
87 BuildRequires: glibc-static
88 BuildRequires: libxml2-static
89 BuildRequires: ncurses-static
90 BuildRequires: openssl-static
91 BuildRequires: pcre-static
92 BuildRequires: popt-static
93 BuildRequires: readline-static
94 BuildRequires: rpm-static
95 BuildRequires: zlib-static
97 Requires(triggerpostun): awk
98 Requires(triggerpostun): sed >= 4.0
99 Requires: %{db_pkg} >= %{ver_db}-%{ver_db_rel}
100 Requires: %{name}-libs = %{version}-%{release}
101 Requires: rpm >= %{ver_rpm}
102 Requires: rpm-db-ver = %{ver_db}
103 Requires: rpm-lib >= %{ver_rpm}
104 # vf* scripts use sed
106 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
108 %define _libexecdir %{_prefix}/lib/%{name}
111 poldek is an RPM package management tool which allows you to easily
112 perform package verification, installation (including system
113 installation from scratch), upgrading, and removal.
115 Program can be used in batch (like apt-get from Debian's APT) or
116 interactive mode. The interactive mode puts you into a readline
117 interface with command line autocompletion and history, similar to the
118 shell mode of Perl's CPAN.
120 %{?with_static:This version is statically linked.}
122 %{!?with_imode:This version hasn't got interactive mode.}
125 %description -l hu.UTF-8
126 poldek egy RPM csomagkezelő eszköz, amely megkönnyíti a
127 csomagellenőrzést, telepítést (beleértve a rendszertelepítést a
128 nulláról), frissítést és eltávolítást.
130 A program használható parancssorból (mint a Debian apt-get programja)
131 vagy interaktív módban. Az interaktív mód egy readline környezetet
132 jelent, parancskiegészítéssel és előzményekkel, hasonlóan a Perl CPAN
135 %{?with_static:Ez a verzió statikusan linkelt.}
137 %{!?with_imode:Ennek a verziónak nincs interaktív módja.}
139 %description -l pl.UTF-8
140 poldek jest narzędziem linii poleceń służącym do weryfikacji,
141 instalacji (włączając instalację systemu od zera), aktualizacji i
144 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
145 interaktywnym. Tryb interaktywny posiada interfejs readline z
146 dopełnianiem komend i historią, podobny do trybu shell perlowego
149 %{?with_static:Ta wersja jest konsolidowana statycznie.}
151 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
154 Summary: poldek libraries
155 Summary(hu.UTF-8): A poldek könyvtárai
156 Summary(pl.UTF-8): Biblioteki poldka
162 %description libs -l hu.UTF-8
165 %description libs -l pl.UTF-8
169 Summary: Header files for poldek libraries
170 Summary(hu.UTF-8): A poldek könyvtár fejlesztői fájljai
171 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
172 Group: Development/Libraries
173 Requires: %{name}-libs = %{version}-%{release}
174 Requires: rpm-devel >= %{ver_rpm}
177 Header files for poldek libraries.
179 %description devel -l hu.UTF-8
180 A poldek könyvtár fejlesztői fájljai.
182 %description devel -l pl.UTF-8
183 Pliki nagłówkowe bibliotek poldka.
186 Summary: poldek static libraries
187 Summary(hu.UTF-8): poldek statikus könyvtárak
188 Summary(pl.UTF-8): Biblioteki statyczne poldka
189 Group: Development/Libraries
190 Requires: %{name}-devel = %{version}-%{release}
193 poldek static libraries.
195 %description static -l hu.UTF-8
196 poldek statikus könyvtárak.
198 %description static -l pl.UTF-8
199 Biblioteki statyczne poldka.
201 %package -n python-poldek
202 Summary: Python modules for poldek
203 Summary(hu.UTF-8): Python modulok poldek-hez
204 Summary(pl.UTF-8): Moduły języka Python dla poldka
205 Group: Libraries/Python
206 Requires: %{name}-libs = %{version}-%{release}
207 Requires: python-libs
209 %description -n python-poldek
210 Python modules for poldek.
212 %description -n python-poldek -l hu.UTF-8
213 Python modulok poldek-hez.
215 %description -n python-poldek -l pl.UTF-8
216 Moduły języka Python dla poldka.
224 %{__rm} m4/libtool.m4 m4/lt*.m4
226 # cleanup backups after patching
227 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
228 chmod u+x ./configure ./doc/conf-xml2.sh
251 CPPFLAGS="%{rpmcppflags} -std=gnu99 -fgnu89-inline"
253 %{?with_static:--enable-static --disable-shared} \
254 %{!?with_imode:--disable-imode} \
255 --with-pkglibdir=%{_libexecdir} \
257 %{?with_python:--with-python}
262 rm -rf $RPM_BUILD_ROOT
263 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name}/repos.d,/var/cache/%{name}}
265 %{__make} install -j1 \
266 DESTDIR=$RPM_BUILD_ROOT
269 %{__make} -C python -j1 install \
270 DESTDIR=$RPM_BUILD_ROOT \
274 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
276 %ifarch i486 i686 ppc sparc alpha athlon
277 %define _ftp_arch %{_target_cpu}
280 %define _ftp_arch x86_64
281 %define _ftp_alt_arch i686
282 %define _ftp_alt2_arch x32
285 %define _ftp_arch x32
286 %define _ftp_alt_arch x86_64
287 %define _ftp_alt2_arch i686
290 %define _ftp_arch i486
292 %ifarch pentium2 pentium3 pentium4
293 %define _ftp_arch i686
295 %ifarch sparcv9 sparc64
296 %define _ftp_arch sparc
297 %define _ftp_arch %{_target_cpu}
299 %define _ftp_alt_arch sparcv9
303 %define pld_conf %{SOURCE1}
304 %define pld_debuginfo_conf %{SOURCE8}
305 %define pld_archive_conf %{SOURCE11}
308 %define pld_multilib_conf %{SOURCE2}
309 %define pld_multilib2_conf %{SOURCE2}
313 %ifarch sparcv9 sparc64
314 %define pld_conf %{SOURCE9}
315 %undefine pld_archive_conf
318 %define pld_multilib_conf %{SOURCE10}
321 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{pld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
323 %if 0%{?pld_multilib_conf:1}
324 %{__sed} 's|%%ARCH%%|%{_ftp_alt_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{_ftp_alt_arch}.conf
327 %if 0%{?pld_multilib2_conf:1}
328 %{__sed} 's|%%ARCH%%|%{_ftp_alt2_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{_ftp_alt2_arch}.conf
331 %if 0%{?pld_debuginfo_conf:1}
332 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{pld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
335 %if 0%{?pld_archive_conf:1}
336 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{pld_archive_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-archive.conf
339 # Always install snapshot configs
340 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' \
341 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE100} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
342 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' \
343 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE102} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-debuginfo.conf
345 %{__sed} -e 's|%%ARCH%%|%{_ftp_alt_arch}|g' \
346 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{_ftp_alt_arch}.conf
347 %{__sed} -e 's|%%ARCH%%|%{_ftp_alt2_arch}|g' \
348 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{_ftp_alt2_arch}.conf
352 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
353 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
355 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
356 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
359 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
362 # add desktop file and icon
363 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
364 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
365 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
368 # sources we don't package
369 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
370 # include them in %doc
373 %{__rm} -f configs/Makefile*
377 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
383 rm -rf $RPM_BUILD_ROOT
386 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
387 if [ "$1" = "1" ]; then
388 # remove ignore = vserver-packages inside vserver on first install
391 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
392 done </proc/self/status
394 if [ -z "$ctx" -o "$ctx" = "0" ]; then
399 if [ "$VSERVER" = "yes" ]; then
400 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
404 %postun -p /sbin/postshell
405 -/usr/sbin/fix-info-dir -c %{_infodir}
407 %post libs -p /sbin/ldconfig
408 %postun libs -p /sbin/ldconfig
410 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
411 if [ -f /etc/poldek.conf.rpmsave ]; then
420 if (sub(",noauto", "", name)) {
425 if (match(name, /,pri=[0-9]+/)) {
426 pri = substr(name, RSTART + 5, RLENGTH - 5);
427 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
430 # skip ac sources. already in new config.
431 if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
434 print "name = " name;
435 print "type = " type;
436 print "path = " path;
437 print "auto = " auto;
438 print "autoup = " autoup;
444 }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
445 echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
448 hold=$(grep ^hold /etc/poldek.conf.rpmsave)
450 %{__sed} -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
454 %triggerpostun -- poldek < 0.30-0.20080225.00.1
455 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
456 %{__sed} -i -e '/^%%include source.conf/{
458 a# /etc/poldek/repos.d/*.conf
459 a%%includedir repos.d
460 }' %{_sysconfdir}/%{name}/poldek.conf
463 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
464 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
466 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
467 cp -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
468 cp -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
472 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
473 cp -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
474 cp -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
478 %triggerpostun -- poldek < 0.30.1-3
479 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave ]; then
480 cp -f %{_sysconfdir}/%{name}/repos.d/pld-%{_ftp_alt_arch}.conf{,.rpmnew}
481 cp -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{_ftp_alt_arch}.conf
483 if [ -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave ]; then
484 cp -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{_ftp_alt_arch}.conf{,.rpmnew}
485 cp -f %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-%{_ftp_alt_arch}.conf
488 %files -f %{name}.lang
489 %defattr(644,root,root,755)
490 %doc ChangeLog README* NEWS TODO configs
491 %dir %{_sysconfdir}/%{name}
492 %dir %{_sysconfdir}/%{name}/repos.d
493 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
494 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
495 %attr(755,root,root) %{_bindir}/ipoldek
496 %attr(755,root,root) %{_bindir}/poldek
497 %attr(755,root,root) %{_bindir}/rpmvercmp
499 %attr(755,root,root) %{_libexecdir}/*
500 %{_mandir}/man1/%{name}*.1*
501 %lang(pl) %{_mandir}/pl/man1/%{name}*
502 %{_infodir}/poldek.info*
504 %{_desktopdir}/%{name}.desktop
505 %{_pixmapsdir}/%{name}.png
507 %dir /var/cache/%{name}
509 %if %{without static}
511 %defattr(644,root,root,755)
512 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
513 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
514 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
515 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
516 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
517 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
518 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
519 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
520 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
521 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
525 %defattr(644,root,root,755)
526 %if %{without static}
527 %attr(755,root,root) %{_libdir}/libpoclidek.so
528 %attr(755,root,root) %{_libdir}/libpoldek.so
529 %attr(755,root,root) %{_libdir}/libtndb.so
530 %attr(755,root,root) %{_libdir}/libtrurl.so
531 %attr(755,root,root) %{_libdir}/libvfile.so
533 %{_libdir}/libpoclidek.la
534 %{_libdir}/libpoldek.la
535 %{_libdir}/libtndb.la
536 %{_libdir}/libtrurl.la
537 %{_libdir}/libvfile.la
538 %{_includedir}/poldek
542 %{_pkgconfigdir}/tndb.pc
543 %{_pkgconfigdir}/trurlib.pc
546 %defattr(644,root,root,755)
548 %{_libdir}/libtrurl.a
551 %files -n python-poldek
552 %defattr(644,root,root,755)
553 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
554 %{py_sitescriptdir}/poldek.py[co]
555 %{py_sitescriptdir}/poldekmod.py[co]