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: pkgconfig
91 BuildRequires: popt-devel
92 %{?with_python:BuildRequires: python-devel}
93 BuildRequires: readline-devel >= 5.0
94 BuildRequires: rpm-devel >= %{ver_rpm}
95 %{?with_python:BuildRequires: rpm-pythonprov}
96 BuildRequires: zlib-devel
98 BuildRequires: bzip2-static
99 BuildRequires: db-static >= %{ver_db}-%{ver_db_rel}
100 BuildRequires: glibc-static
101 BuildRequires: libselinux-static
102 BuildRequires: libxml2-static
103 BuildRequires: ncurses-static
104 BuildRequires: openssl-static
105 BuildRequires: pcre-static
106 BuildRequires: popt-static
107 BuildRequires: readline-static
108 BuildRequires: rpm-static
109 BuildRequires: zlib-static
111 Requires(triggerpostun): awk
112 Requires(triggerpostun): sed >= 4.0
113 Requires: %{name}-libs = %{version}-%{release}
114 Requires: db >= %{ver_db}-%{ver_db_rel}
115 Requires: rpm >= %{ver_rpm}
116 Requires: rpm-db-ver = %{ver_db}
117 Requires: rpm-lib = %(rpm -q --qf '%{V}' rpm-lib)
118 # vf* scripts use sed
120 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
123 poldek is an RPM package management tool which allows you to easily
124 perform package verification, installation (including system
125 installation from scratch), upgrading, and removal.
127 Program can be used in batch (like apt-get from Debian's APT) or
128 interactive mode. The interactive mode puts you into a readline
129 interface with command line autocompletion and history, similar to the
130 shell mode of Perl's CPAN.
132 %{?with_static:This version is statically linked.}
134 %{!?with_imode:This version hasn't got interactive mode.}
137 %description -l pl.UTF-8
138 poldek jest narzędziem linii poleceń służącym do weryfikacji,
139 instalacji (włączając instalację systemu od zera), aktualizacji i
142 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
143 interaktywnym. Tryb interaktywny posiada interfejs readline z
144 dopełnianiem komend i historią, podobny do trybu shell perlowego
147 %{?with_static:Ta wersja jest konsolidowana statycznie.}
149 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
152 Summary: poldek libraries
153 Summary(pl.UTF-8): Biblioteki poldka
159 %description libs -l pl.UTF-8
163 Summary: Header files for poldek libraries
164 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
165 Group: Development/Libraries
166 Requires: %{name}-libs = %{version}-%{release}
167 Requires: rpm-devel >= %{ver_rpm}
170 Header files for poldek libraries.
172 %description devel -l pl.UTF-8
173 Pliki nagłówkowe bibliotek poldka.
176 Summary: poldek static libraries
177 Summary(pl.UTF-8): Biblioteki statyczne poldka
178 Group: Development/Libraries
179 Requires: %{name}-devel = %{version}-%{release}
182 poldek static libraries.
184 %description static -l pl.UTF-8
185 Biblioteki statyczne poldka.
187 %package -n python-poldek
188 Summary: Python modules for poldek
189 Summary(pl.UTF-8): Moduły języka Python dla poldka
190 Group: Libraries/Python
191 Requires: %{name}-libs = %{version}-%{release}
192 %pyrequires_eq python-libs
194 %description -n python-poldek
195 Python modules for poldek.
197 %description -n python-poldek -l pl.UTF-8
198 Moduły języka Python dla poldka.
201 %setup -q -n %{name}-%{version}%{?snap:-cvs%{snap}}
227 # LP#392984: add source rpm to ls
233 # score reqs already marked to install
235 # dont be greedy if upgraded pkg has needed capabilities
237 # http://lists.pld-linux.org/mailman/pipermail/pld-devel-pl/2009-November/150519.html
239 # LP#392984: add query format to ls
245 # do not info. about amount of transaction space req. but relative to already installed
247 # fixes failures with zlib >= 1.2.3.7
252 # cleanup backups after patching
253 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
261 cp -f config.sub trurlib
263 CPPFLAGS="-std=gnu99"
265 %{?with_static:--enable-static --disable-shared} \
266 %{!?with_imode:--disable-imode} \
268 %{?with_python:--with-python}
273 rm -rf $RPM_BUILD_ROOT
274 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d
277 DESTDIR=$RPM_BUILD_ROOT
280 %{__make} -C python install \
281 DESTDIR=$RPM_BUILD_ROOT \
285 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
287 %ifarch i486 i686 ppc sparc alpha athlon
288 %define _ftp_arch %{_target_cpu}
291 %define _ftp_arch x86_64
292 %define _ftp_alt_arch i686
295 %if "%{pld_release}" == "ti"
296 %define _ftp_arch i586
298 %define _ftp_arch i486
301 %ifarch pentium2 pentium3 pentium4
302 %define _ftp_arch i686
304 %ifarch sparcv9 sparc64
305 %define _ftp_arch sparc
306 %if "%{pld_release}" == "th"
307 %define _ftp_arch %{_target_cpu}
309 %define _ftp_alt_arch sparcv9
314 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
316 %if "%{pld_release}" == "ti"
318 s|%%ARCH%%|%{_ftp_arch}|g
319 ' < %{SOURCE3} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
323 s|%%ARCH%%|%{_ftp_alt_arch}|g
324 ' < %{SOURCE4} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
328 %ifarch sparcv9 sparc64
330 s|%%ARCH%%|%{_ftp_arch}|g
331 ' < %{SOURCE9} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
335 s|%%ARCH%%|%{_ftp_alt_arch}|g
336 ' < %{SOURCE10} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
341 s|%%ARCH%%|%{_ftp_arch}|g
342 ' < %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
344 s|%%ARCH%%|%{_ftp_arch}|g
345 ' < %{SOURCE8} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
349 s|%%ARCH%%|%{_ftp_alt_arch}|g
350 ' < %{SOURCE2} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
355 install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
358 # add desktop file and icon
359 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
360 install %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
361 install %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
364 # sources we don't package
365 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,pld,fedora,centos}-source.conf
366 # include them in %doc
369 rm -f configs/Makefile*
373 rm -f $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
379 rm -rf $RPM_BUILD_ROOT
382 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
383 if [ "$1" = "1" ]; then
384 # remove ignore = vserver-packages inside vserver on first install
387 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
388 done </proc/self/status
390 if [ -z "$ctx" -o "$ctx" = "0" ]; then
395 if [ "$VSERVER" = "yes" ]; then
396 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
400 %postun -p /sbin/postshell
401 -/usr/sbin/fix-info-dir -c %{_infodir}
403 %post libs -p /sbin/ldconfig
404 %postun libs -p /sbin/ldconfig
406 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
407 if [ -f /etc/poldek.conf.rpmsave ]; then
416 if (sub(",noauto", "", name)) {
421 if (match(name, /,pri=[0-9]+/)) {
422 pri = substr(name, RSTART + 5, RLENGTH - 5);
423 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
426 # skip ac sources. already in new config.
427 if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
430 print "name = " name;
431 print "type = " type;
432 print "path = " path;
433 print "auto = " auto;
434 print "autoup = " autoup;
440 }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
441 echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
444 hold=$(grep ^hold /etc/poldek.conf.rpmsave)
446 sed -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
450 %triggerpostun -- poldek < 0.30-0.20080225.00.1
451 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
452 %{__sed} -i -e '/^%%include source.conf/{
454 a# /etc/poldek/repos.d/*.conf
455 a%%includedir repos.d
456 }' %{_sysconfdir}/%{name}/poldek.conf
459 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
460 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
462 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
463 cp -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
464 cp -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
468 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
469 cp -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
470 cp -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
474 %files -f %{name}.lang
475 %defattr(644,root,root,755)
476 %doc README* NEWS TODO configs
477 %dir %{_sysconfdir}/%{name}
478 %dir %{_sysconfdir}/%{name}/repos.d
479 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
480 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
481 %attr(755,root,root) %{_bindir}/*
482 %dir %{_libdir}/%{name}
483 %attr(755,root,root) %{_libdir}/%{name}/*
484 %{_mandir}/man1/%{name}*
485 %lang(pl) %{_mandir}/pl/man1/%{name}*
486 %{_infodir}/poldek.info*
488 %{_desktopdir}/%{name}.desktop
489 %{_pixmapsdir}/%{name}.png
492 %if %{without static}
494 %defattr(644,root,root,755)
495 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
496 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
497 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
498 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
499 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
500 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
501 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
502 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
503 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
504 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
508 %defattr(644,root,root,755)
509 %{!?with_static:%attr(755,root,root) %{_libdir}/lib*.so}
514 %defattr(644,root,root,755)
518 %files -n python-poldek
519 %defattr(644,root,root,755)
520 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
521 %{py_sitescriptdir}/poldek.py[co]
522 %{py_sitescriptdir}/poldekmod.py[co]