2 # - fails to build without poldek-devel - fix it !
5 %bcond_with static # don't use shared libraries
6 %bcond_without imode # don't build interactive mode
7 %bcond_without python # don't build python bindings
9 # required versions (forced to avoid SEGV with mixed db used by rpm and poldek)
10 %if "%{pld_release}" == "ti"
19 %define snap 20080820.23
21 Summary: RPM packages management helper tool
22 Summary(pl.UTF-8): Pomocnicze narzędzie do zarządzania pakietami RPM
25 Release: 0.%{snap}.%{rel}
27 Group: Applications/System
28 #Source0: http://poldek.pld-linux.org/download/snapshots/%{name}-%{version}-cvs%{snap}.tar.bz2
29 Source0: http://carme.pld-linux.org/~megabajt/snaps/poldek/%{name}-%{version}-cvs%{snap}.tar.bz2
30 # Source0-md5: 2738eb3996f1cdf1e5d74b913d6e7414
32 Source2: %{name}-multilib.conf
33 Source3: %{name}-ti.conf
34 Source4: %{name}-multilib-ti.conf
35 Source5: %{name}-aliases.conf
36 Source6: %{name}.desktop
38 Source8: %{name}-debuginfo.conf
39 Source9: %{name}-aidath.conf
40 Source10: %{name}-multilib-aidath.conf
41 Patch0: %{name}-vserver-packages.patch
42 Patch1: %{name}-config.patch
43 Patch2: %{name}-abort-on-upgrade.patch
44 Patch3: %{name}-inline.patch
45 Patch4: %{name}-ls-llu.patch
46 Patch5: %{name}-op-ldalldesc.patch
47 Patch6: %{name}-nocolor-upgrade.patch
48 Patch7: %{name}-upgrade-dist.patch
49 Patch8: %{name}-keep-reinstalled-provides.patch
50 Patch9: %{name}-dont-ask-for-suggests-on-errors.patch
51 Patch10: %{name}-crash-on-invalid-locale.patch
52 Patch11: %{name}-noutf8.patch
53 Patch12: %{name}-dont-suggests-required-packages.patch
54 Patch13: %{name}-tty-for-erasures.patch
55 Patch14: %{name}-both_langs.patch
56 Patch15: %{name}-317130.patch
57 Patch16: %{name}-321546.patch
58 Patch17: %{name}-size-type.patch
59 Patch18: %{name}-no-inlines.patch
60 Patch19: %{name}-export-missing-symbol.patch
61 Patch20: %{name}-skip-suggests-on-upgrade.patch
62 Patch21: %{name}-po.patch
63 Patch22: %{name}-refcnt.patch
64 Patch23: %{name}-assertion-failed.patch
65 Patch24: %{name}-unescape-urlencoded-strings.patch
66 Patch25: %{name}-ls-source-rpm.patch
67 Patch26: %{name}-add-arch-match.patch
68 Patch27: %{name}-multilib-upgrade.patch
69 Patch28: %{name}-score-reqs-marked-to-install.patch
70 Patch29: %{name}-dont-be-greedy.patch
71 Patch30: %{name}-dont-lose-deps.patch
72 Patch31: %{name}-ls-queryfmt.patch
73 Patch32: %{name}-prepare_url_fix.patch
74 Patch33: %{name}-noloop_on_terminal_loos.patch
75 Patch34: %{name}-show_only_relative_used_space.patch
76 Patch35: %{name}-zlib.patch
77 Patch36: %{name}-caplookup.patch
78 Patch37: %{name}-local_trurlib_check.patch
79 URL: http://poldek.pld-linux.org/
80 BuildRequires: autoconf
81 BuildRequires: automake
82 BuildRequires: bzip2-devel
83 BuildRequires: check-devel
84 BuildRequires: db-devel >= %{ver_db}-%{ver_db_rel}
85 BuildRequires: gettext-devel
86 BuildRequires: libtool
87 BuildRequires: libxml2-devel
88 BuildRequires: openssl-devel >= 0.9.7d
89 BuildRequires: pcre-devel
90 BuildRequires: perl-tools-pod
91 BuildRequires: pkgconfig
92 BuildRequires: popt-devel
93 %{?with_python:BuildRequires: python-devel}
94 BuildRequires: readline-devel >= 5.0
95 BuildRequires: rpm-devel >= %{ver_rpm}
96 %{?with_python:BuildRequires: rpm-pythonprov}
97 BuildRequires: zlib-devel
99 BuildRequires: bzip2-static
100 BuildRequires: db-static >= %{ver_db}-%{ver_db_rel}
101 BuildRequires: glibc-static
102 BuildRequires: libselinux-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
112 Requires(triggerpostun): awk
113 Requires(triggerpostun): sed >= 4.0
114 Requires: %{name}-libs = %{version}-%{release}
115 Requires: db >= %{ver_db}-%{ver_db_rel}
116 Requires: rpm >= %{ver_rpm}
117 Requires: rpm-db-ver = %{ver_db}
118 Requires: rpm-lib = %(rpm -q --qf '%{V}' rpm-lib)
119 # vf* scripts use sed
121 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
124 poldek is an RPM package management tool which allows you to easily
125 perform package verification, installation (including system
126 installation from scratch), upgrading, and removal.
128 Program can be used in batch (like apt-get from Debian's APT) or
129 interactive mode. The interactive mode puts you into a readline
130 interface with command line autocompletion and history, similar to the
131 shell mode of Perl's CPAN.
133 %{?with_static:This version is statically linked.}
135 %{!?with_imode:This version hasn't got interactive mode.}
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(pl.UTF-8): Biblioteki poldka
160 %description libs -l pl.UTF-8
164 Summary: Header files for poldek libraries
165 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
166 Group: Development/Libraries
167 Requires: %{name}-libs = %{version}-%{release}
168 Requires: rpm-devel >= %{ver_rpm}
171 Header files for poldek libraries.
173 %description devel -l pl.UTF-8
174 Pliki nagłówkowe bibliotek poldka.
177 Summary: poldek static libraries
178 Summary(pl.UTF-8): Biblioteki statyczne poldka
179 Group: Development/Libraries
180 Requires: %{name}-devel = %{version}-%{release}
183 poldek static libraries.
185 %description static -l pl.UTF-8
186 Biblioteki statyczne poldka.
188 %package -n python-poldek
189 Summary: Python modules for poldek
190 Summary(pl.UTF-8): Moduły języka Python dla poldka
191 Group: Libraries/Python
192 Requires: %{name}-libs = %{version}-%{release}
193 %pyrequires_eq python-libs
195 %description -n python-poldek
196 Python modules for poldek.
198 %description -n python-poldek -l pl.UTF-8
199 Moduły języka Python dla poldka.
202 %setup -q -n %{name}-%{version}%{?snap:-cvs%{snap}}
228 # LP#392984: add source rpm to ls
234 # score reqs already marked to install
236 # dont be greedy if upgraded pkg has needed capabilities
238 # http://lists.pld-linux.org/mailman/pipermail/pld-devel-pl/2009-November/150519.html
240 # LP#392984: add query format to ls
246 # do not info. about amount of transaction space req. but relative to already installed
248 # fixes failures with zlib >= 1.2.3.7
253 # cleanup backups after patching
254 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
262 cp -f config.sub trurlib
264 CPPFLAGS="-std=gnu99"
266 %{?with_static:--enable-static --disable-shared} \
267 %{!?with_imode:--disable-imode} \
269 %{?with_python:--with-python}
274 rm -rf $RPM_BUILD_ROOT
275 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d
278 DESTDIR=$RPM_BUILD_ROOT
281 %{__make} -C python install \
282 DESTDIR=$RPM_BUILD_ROOT \
286 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
288 %ifarch i486 i686 ppc sparc alpha athlon
289 %define _ftp_arch %{_target_cpu}
292 %define _ftp_arch x86_64
293 %define _ftp_alt_arch i686
296 %if "%{pld_release}" == "ti"
297 %define _ftp_arch i586
299 %define _ftp_arch i486
302 %ifarch pentium2 pentium3 pentium4
303 %define _ftp_arch i686
305 %ifarch sparcv9 sparc64
306 %define _ftp_arch sparc
307 %if "%{pld_release}" == "th"
308 %define _ftp_arch %{_target_cpu}
310 %define _ftp_alt_arch sparcv9
315 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
317 %if "%{pld_release}" == "ti"
319 s|%%ARCH%%|%{_ftp_arch}|g
320 ' < %{SOURCE3} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
324 s|%%ARCH%%|%{_ftp_alt_arch}|g
325 ' < %{SOURCE4} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
329 %ifarch sparcv9 sparc64
331 s|%%ARCH%%|%{_ftp_arch}|g
332 ' < %{SOURCE9} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
336 s|%%ARCH%%|%{_ftp_alt_arch}|g
337 ' < %{SOURCE10} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
342 s|%%ARCH%%|%{_ftp_arch}|g
343 ' < %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
345 s|%%ARCH%%|%{_ftp_arch}|g
346 ' < %{SOURCE8} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
350 s|%%ARCH%%|%{_ftp_alt_arch}|g
351 ' < %{SOURCE2} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
356 install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
359 # add desktop file and icon
360 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
361 install %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
362 install %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
365 # sources we don't package
366 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,pld,fedora,centos}-source.conf
367 # include them in %doc
370 rm -f configs/Makefile*
374 rm -f $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
380 rm -rf $RPM_BUILD_ROOT
383 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
384 if [ "$1" = "1" ]; then
385 # remove ignore = vserver-packages inside vserver on first install
388 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
389 done </proc/self/status
391 if [ -z "$ctx" -o "$ctx" = "0" ]; then
396 if [ "$VSERVER" = "yes" ]; then
397 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
401 %postun -p /sbin/postshell
402 -/usr/sbin/fix-info-dir -c %{_infodir}
404 %post libs -p /sbin/ldconfig
405 %postun libs -p /sbin/ldconfig
407 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
408 if [ -f /etc/poldek.conf.rpmsave ]; then
417 if (sub(",noauto", "", name)) {
422 if (match(name, /,pri=[0-9]+/)) {
423 pri = substr(name, RSTART + 5, RLENGTH - 5);
424 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
427 # skip ac sources. already in new config.
428 if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
431 print "name = " name;
432 print "type = " type;
433 print "path = " path;
434 print "auto = " auto;
435 print "autoup = " autoup;
441 }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
442 echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
445 hold=$(grep ^hold /etc/poldek.conf.rpmsave)
447 sed -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
451 %triggerpostun -- poldek < 0.30-0.20080225.00.1
452 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
453 %{__sed} -i -e '/^%%include source.conf/{
455 a# /etc/poldek/repos.d/*.conf
456 a%%includedir repos.d
457 }' %{_sysconfdir}/%{name}/poldek.conf
460 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
461 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
463 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
464 cp -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
465 cp -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
469 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
470 cp -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
471 cp -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
475 %files -f %{name}.lang
476 %defattr(644,root,root,755)
477 %doc README* NEWS TODO configs
478 %dir %{_sysconfdir}/%{name}
479 %dir %{_sysconfdir}/%{name}/repos.d
480 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
481 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
482 %attr(755,root,root) %{_bindir}/*
483 %dir %{_libdir}/%{name}
484 %attr(755,root,root) %{_libdir}/%{name}/*
485 %{_mandir}/man1/%{name}*
486 %lang(pl) %{_mandir}/pl/man1/%{name}*
487 %{_infodir}/poldek.info*
489 %{_desktopdir}/%{name}.desktop
490 %{_pixmapsdir}/%{name}.png
493 %if %{without static}
495 %defattr(644,root,root,755)
496 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
497 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
498 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
499 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
500 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
501 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
502 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
503 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
504 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
505 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
509 %defattr(644,root,root,755)
510 %{!?with_static:%attr(755,root,root) %{_libdir}/lib*.so}
515 %defattr(644,root,root,755)
519 %files -n python-poldek
520 %defattr(644,root,root,755)
521 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
522 %{py_sitescriptdir}/poldek.py[co]
523 %{py_sitescriptdir}/poldekmod.py[co]