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 URL: http://poldek.pld-linux.org/
60 BuildRequires: %{db_pkg}-devel >= %{ver_db}-%{ver_db_rel}
61 BuildRequires: autoconf
62 BuildRequires: automake >= 1:1.11
63 BuildRequires: bzip2-devel
64 BuildRequires: check-devel
65 BuildRequires: docbook-dtd412-xml
66 BuildRequires: gettext-tools
67 BuildRequires: libtool
68 BuildRequires: libxml2-devel
69 BuildRequires: neon-devel
70 BuildRequires: openssl-devel >= 0.9.7d
71 BuildRequires: pcre-devel
72 BuildRequires: pkgconfig
73 BuildRequires: popt-devel
74 %{?with_python:BuildRequires: python-devel}
75 BuildRequires: readline-devel >= 5.0
76 BuildRequires: rpm-devel >= %{ver_rpm}
77 %{?with_python:BuildRequires: rpm-pythonprov}
78 BuildRequires: swig-python
79 BuildRequires: tar >= 1:1.22
82 BuildRequires: zlib-devel
84 BuildRequires: %{db_pkg}-static >= %{ver_db}-%{ver_db_rel}
85 BuildRequires: bzip2-static
86 BuildRequires: glibc-static
87 BuildRequires: libxml2-static
88 BuildRequires: ncurses-static
89 BuildRequires: openssl-static
90 BuildRequires: pcre-static
91 BuildRequires: popt-static
92 BuildRequires: readline-static
93 BuildRequires: rpm-static
94 BuildRequires: zlib-static
96 Requires(triggerpostun): awk
97 Requires(triggerpostun): sed >= 4.0
98 Requires: %{db_pkg} >= %{ver_db}-%{ver_db_rel}
99 Requires: %{name}-libs = %{version}-%{release}
100 Requires: rpm >= %{ver_rpm}
101 Requires: rpm-db-ver = %{ver_db}
102 Requires: rpm-lib >= %{ver_rpm}
103 # vf* scripts use sed
105 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
107 %define _libexecdir %{_prefix}/lib/%{name}
110 poldek is an RPM package management tool which allows you to easily
111 perform package verification, installation (including system
112 installation from scratch), upgrading, and removal.
114 Program can be used in batch (like apt-get from Debian's APT) or
115 interactive mode. The interactive mode puts you into a readline
116 interface with command line autocompletion and history, similar to the
117 shell mode of Perl's CPAN.
119 %{?with_static:This version is statically linked.}
121 %{!?with_imode:This version hasn't got interactive mode.}
124 %description -l hu.UTF-8
125 poldek egy RPM csomagkezelő eszköz, amely megkönnyíti a
126 csomagellenőrzést, telepítést (beleértve a rendszertelepítést a
127 nulláról), frissítést és eltávolítást.
129 A program használható parancssorból (mint a Debian apt-get programja)
130 vagy interaktív módban. Az interaktív mód egy readline környezetet
131 jelent, parancskiegészítéssel és előzményekkel, hasonlóan a Perl CPAN
134 %{?with_static:Ez a verzió statikusan linkelt.}
136 %{!?with_imode:Ennek a verziónak nincs interaktív módja.}
138 %description -l pl.UTF-8
139 poldek jest narzędziem linii poleceń służącym do weryfikacji,
140 instalacji (włączając instalację systemu od zera), aktualizacji i
143 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
144 interaktywnym. Tryb interaktywny posiada interfejs readline z
145 dopełnianiem komend i historią, podobny do trybu shell perlowego
148 %{?with_static:Ta wersja jest konsolidowana statycznie.}
150 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
153 Summary: poldek libraries
154 Summary(hu.UTF-8): A poldek könyvtárai
155 Summary(pl.UTF-8): Biblioteki poldka
161 %description libs -l hu.UTF-8
164 %description libs -l pl.UTF-8
168 Summary: Header files for poldek libraries
169 Summary(hu.UTF-8): A poldek könyvtár fejlesztői fájljai
170 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
171 Group: Development/Libraries
172 Requires: %{name}-libs = %{version}-%{release}
173 Requires: rpm-devel >= %{ver_rpm}
176 Header files for poldek libraries.
178 %description devel -l hu.UTF-8
179 A poldek könyvtár fejlesztői fájljai.
181 %description devel -l pl.UTF-8
182 Pliki nagłówkowe bibliotek poldka.
185 Summary: poldek static libraries
186 Summary(hu.UTF-8): poldek statikus könyvtárak
187 Summary(pl.UTF-8): Biblioteki statyczne poldka
188 Group: Development/Libraries
189 Requires: %{name}-devel = %{version}-%{release}
192 poldek static libraries.
194 %description static -l hu.UTF-8
195 poldek statikus könyvtárak.
197 %description static -l pl.UTF-8
198 Biblioteki statyczne poldka.
200 %package -n python-poldek
201 Summary: Python modules for poldek
202 Summary(hu.UTF-8): Python modulok poldek-hez
203 Summary(pl.UTF-8): Moduły języka Python dla poldka
204 Group: Libraries/Python
205 Requires: %{name}-libs = %{version}-%{release}
206 Requires: python-libs
208 %description -n python-poldek
209 Python modules for poldek.
211 %description -n python-poldek -l hu.UTF-8
212 Python modulok poldek-hez.
214 %description -n python-poldek -l pl.UTF-8
215 Moduły języka Python dla poldka.
222 %{__rm} m4/libtool.m4 m4/lt*.m4
224 # cleanup backups after patching
225 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
226 chmod u+x ./configure ./doc/conf-xml2.sh
249 CPPFLAGS="%{rpmcppflags} -std=gnu99 -fgnu89-inline"
251 %{?with_static:--enable-static --disable-shared} \
252 %{!?with_imode:--disable-imode} \
253 --with-pkglibdir=%{_libexecdir} \
255 %{?with_python:--with-python}
260 rm -rf $RPM_BUILD_ROOT
261 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name}/repos.d,/var/cache/%{name}}
263 %{__make} install -j1 \
264 DESTDIR=$RPM_BUILD_ROOT
267 %{__make} -C python -j1 install \
268 DESTDIR=$RPM_BUILD_ROOT \
272 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
274 %ifarch i486 i686 ppc sparc alpha athlon
275 %define _ftp_arch %{_target_cpu}
278 %define _ftp_arch x86_64
279 %define _ftp_alt_arch i686
280 %define _ftp_alt2_arch x32
283 %define _ftp_arch x32
284 %define _ftp_alt_arch x86_64
285 %define _ftp_alt2_arch i686
288 %define _ftp_arch i486
290 %ifarch pentium2 pentium3 pentium4
291 %define _ftp_arch i686
293 %ifarch sparcv9 sparc64
294 %define _ftp_arch sparc
295 %define _ftp_arch %{_target_cpu}
297 %define _ftp_alt_arch sparcv9
301 %define pld_conf %{SOURCE1}
302 %define pld_debuginfo_conf %{SOURCE8}
303 %define pld_archive_conf %{SOURCE11}
306 %define pld_multilib_conf %{SOURCE2}
307 %define pld_multilib2_conf %{SOURCE2}
311 %ifarch sparcv9 sparc64
312 %define pld_conf %{SOURCE9}
313 %undefine pld_archive_conf
316 %define pld_multilib_conf %{SOURCE10}
319 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{pld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
321 %if 0%{?pld_multilib_conf:1}
322 %{__sed} 's|%%ARCH%%|%{_ftp_alt_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
325 %if 0%{?pld_multilib2_conf:1}
326 %{__sed} 's|%%ARCH%%|%{_ftp_alt2_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib2.conf
329 %if 0%{?pld_debuginfo_conf:1}
330 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{pld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
333 %if 0%{?pld_archive_conf:1}
334 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{pld_archive_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-archive.conf
337 # Always install snapshot configs
338 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' \
339 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE100} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
340 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' \
341 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE102} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-debuginfo.conf
343 %{__sed} -e 's|%%ARCH%%|%{_ftp_alt_arch}|g' \
344 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf
345 %{__sed} -e 's|%%ARCH%%|%{_ftp_alt2_arch}|g' \
346 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib2.conf
350 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
351 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
353 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
354 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
357 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
360 # add desktop file and icon
361 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
362 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
363 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
366 # sources we don't package
367 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
368 # include them in %doc
371 %{__rm} -f configs/Makefile*
375 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
381 rm -rf $RPM_BUILD_ROOT
384 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
385 if [ "$1" = "1" ]; then
386 # remove ignore = vserver-packages inside vserver on first install
389 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
390 done </proc/self/status
392 if [ -z "$ctx" -o "$ctx" = "0" ]; then
397 if [ "$VSERVER" = "yes" ]; then
398 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
402 %postun -p /sbin/postshell
403 -/usr/sbin/fix-info-dir -c %{_infodir}
405 %post libs -p /sbin/ldconfig
406 %postun libs -p /sbin/ldconfig
408 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
409 if [ -f /etc/poldek.conf.rpmsave ]; then
418 if (sub(",noauto", "", name)) {
423 if (match(name, /,pri=[0-9]+/)) {
424 pri = substr(name, RSTART + 5, RLENGTH - 5);
425 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
428 # skip ac sources. already in new config.
429 if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
432 print "name = " name;
433 print "type = " type;
434 print "path = " path;
435 print "auto = " auto;
436 print "autoup = " autoup;
442 }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
443 echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
446 hold=$(grep ^hold /etc/poldek.conf.rpmsave)
448 %{__sed} -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
452 %triggerpostun -- poldek < 0.30-0.20080225.00.1
453 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
454 %{__sed} -i -e '/^%%include source.conf/{
456 a# /etc/poldek/repos.d/*.conf
457 a%%includedir repos.d
458 }' %{_sysconfdir}/%{name}/poldek.conf
461 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
462 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
464 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
465 cp -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
466 cp -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
470 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
471 cp -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
472 cp -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
476 %files -f %{name}.lang
477 %defattr(644,root,root,755)
478 %doc ChangeLog README* NEWS TODO configs
479 %dir %{_sysconfdir}/%{name}
480 %dir %{_sysconfdir}/%{name}/repos.d
481 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
482 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
483 %attr(755,root,root) %{_bindir}/ipoldek
484 %attr(755,root,root) %{_bindir}/poldek
485 %attr(755,root,root) %{_bindir}/rpmvercmp
487 %attr(755,root,root) %{_libexecdir}/*
488 %{_mandir}/man1/%{name}*.1*
489 %lang(pl) %{_mandir}/pl/man1/%{name}*
490 %{_infodir}/poldek.info*
492 %{_desktopdir}/%{name}.desktop
493 %{_pixmapsdir}/%{name}.png
495 %dir /var/cache/%{name}
497 %if %{without static}
499 %defattr(644,root,root,755)
500 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
501 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
502 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
503 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
504 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
505 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
506 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
507 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
508 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
509 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
513 %defattr(644,root,root,755)
514 %if %{without static}
515 %attr(755,root,root) %{_libdir}/libpoclidek.so
516 %attr(755,root,root) %{_libdir}/libpoldek.so
517 %attr(755,root,root) %{_libdir}/libtndb.so
518 %attr(755,root,root) %{_libdir}/libtrurl.so
519 %attr(755,root,root) %{_libdir}/libvfile.so
521 %{_libdir}/libpoclidek.la
522 %{_libdir}/libpoldek.la
523 %{_libdir}/libtndb.la
524 %{_libdir}/libtrurl.la
525 %{_libdir}/libvfile.la
526 %{_includedir}/poldek
530 %{_pkgconfigdir}/tndb.pc
531 %{_pkgconfigdir}/trurlib.pc
534 %defattr(644,root,root,755)
536 %{_libdir}/libtrurl.a
539 %files -n python-poldek
540 %defattr(644,root,root,755)
541 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
542 %{py_sitescriptdir}/poldek.py[co]
543 %{py_sitescriptdir}/poldekmod.py[co]