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 URL: http://poldek.pld-linux.org/
78 BuildRequires: autoconf
79 BuildRequires: automake
80 BuildRequires: bzip2-devel
81 BuildRequires: check-devel
82 BuildRequires: db-devel >= %{ver_db}-%{ver_db_rel}
83 BuildRequires: gettext-devel
84 BuildRequires: libtool
85 BuildRequires: libxml2-devel
86 BuildRequires: openssl-devel >= 0.9.7d
87 BuildRequires: pcre-devel
88 BuildRequires: perl-tools-pod
89 BuildRequires: pkgconfig
90 BuildRequires: popt-devel
91 %{?with_python:BuildRequires: python-devel}
92 BuildRequires: readline-devel >= 5.0
93 BuildRequires: rpm-devel >= %{ver_rpm}
94 %{?with_python:BuildRequires: rpm-pythonprov}
95 BuildRequires: zlib-devel
97 BuildRequires: bzip2-static
98 BuildRequires: db-static >= %{ver_db}-%{ver_db_rel}
99 BuildRequires: glibc-static
100 BuildRequires: libselinux-static
101 BuildRequires: libxml2-static
102 BuildRequires: ncurses-static
103 BuildRequires: openssl-static
104 BuildRequires: pcre-static
105 BuildRequires: popt-static
106 BuildRequires: readline-static
107 BuildRequires: rpm-static
108 BuildRequires: zlib-static
110 Requires(triggerpostun): awk
111 Requires(triggerpostun): sed >= 4.0
112 Requires: %{name}-libs = %{version}-%{release}
113 Requires: db >= %{ver_db}-%{ver_db_rel}
114 Requires: rpm >= %{ver_rpm}
115 Requires: rpm-db-ver = %{ver_db}
116 Requires: rpm-lib = %(rpm -q --qf '%{V}' rpm-lib)
117 # vf* scripts use sed
119 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
122 poldek is an RPM package management tool which allows you to easily
123 perform package verification, installation (including system
124 installation from scratch), upgrading, and removal.
126 Program can be used in batch (like apt-get from Debian's APT) or
127 interactive mode. The interactive mode puts you into a readline
128 interface with command line autocompletion and history, similar to the
129 shell mode of Perl's CPAN.
131 %{?with_static:This version is statically linked.}
133 %{!?with_imode:This version hasn't got interactive mode.}
136 %description -l pl.UTF-8
137 poldek jest narzędziem linii poleceń służącym do weryfikacji,
138 instalacji (włączając instalację systemu od zera), aktualizacji i
141 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
142 interaktywnym. Tryb interaktywny posiada interfejs readline z
143 dopełnianiem komend i historią, podobny do trybu shell perlowego
146 %{?with_static:Ta wersja jest konsolidowana statycznie.}
148 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
151 Summary: poldek libraries
152 Summary(pl.UTF-8): Biblioteki poldka
158 %description libs -l pl.UTF-8
162 Summary: Header files for poldek libraries
163 Summary(pl.UTF-8): Pliki nagłówkowe bibliotek poldka
164 Group: Development/Libraries
165 Requires: %{name}-libs = %{version}-%{release}
166 Requires: rpm-devel >= %{ver_rpm}
169 Header files for poldek libraries.
171 %description devel -l pl.UTF-8
172 Pliki nagłówkowe bibliotek poldka.
175 Summary: poldek static libraries
176 Summary(pl.UTF-8): Biblioteki statyczne poldka
177 Group: Development/Libraries
178 Requires: %{name}-devel = %{version}-%{release}
181 poldek static libraries.
183 %description static -l pl.UTF-8
184 Biblioteki statyczne poldka.
186 %package -n python-poldek
187 Summary: Python modules for poldek
188 Summary(pl.UTF-8): Moduły języka Python dla poldka
189 Group: Libraries/Python
190 Requires: %{name}-libs = %{version}-%{release}
191 %pyrequires_eq python-libs
193 %description -n python-poldek
194 Python modules for poldek.
196 %description -n python-poldek -l pl.UTF-8
197 Moduły języka Python dla poldka.
200 %setup -q -n %{name}-%{version}%{?snap:-cvs%{snap}}
226 # LP#392984: add source rpm to ls
232 # score reqs already marked to install
234 # dont be greedy if upgraded pkg has needed capabilities
236 # http://lists.pld-linux.org/mailman/pipermail/pld-devel-pl/2009-November/150519.html
238 # LP#392984: add query format to ls
244 # do not info. about amount of transaction space req. but relative to already installed
246 # fixes failures with zlib >= 1.2.3.7
249 # cleanup backups after patching
250 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
258 cp -f config.sub trurlib
260 CPPFLAGS="-std=gnu99"
262 %{?with_static:--enable-static --disable-shared} \
263 %{!?with_imode:--disable-imode} \
265 %{?with_python:--with-python}
270 rm -rf $RPM_BUILD_ROOT
271 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d
274 DESTDIR=$RPM_BUILD_ROOT
277 %{__make} -C python install \
278 DESTDIR=$RPM_BUILD_ROOT \
282 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
284 %ifarch i486 i686 ppc sparc alpha athlon
285 %define _ftp_arch %{_target_cpu}
288 %define _ftp_arch x86_64
289 %define _ftp_alt_arch i686
292 %if "%{pld_release}" == "ti"
293 %define _ftp_arch i586
295 %define _ftp_arch i486
298 %ifarch pentium2 pentium3 pentium4
299 %define _ftp_arch i686
301 %ifarch sparcv9 sparc64
302 %define _ftp_arch sparc
303 %if "%{pld_release}" == "th"
304 %define _ftp_arch %{_target_cpu}
306 %define _ftp_alt_arch sparcv9
311 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
313 %if "%{pld_release}" == "ti"
315 s|%%ARCH%%|%{_ftp_arch}|g
316 ' < %{SOURCE3} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
320 s|%%ARCH%%|%{_ftp_alt_arch}|g
321 ' < %{SOURCE4} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
325 %ifarch sparcv9 sparc64
327 s|%%ARCH%%|%{_ftp_arch}|g
328 ' < %{SOURCE9} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
332 s|%%ARCH%%|%{_ftp_alt_arch}|g
333 ' < %{SOURCE10} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
338 s|%%ARCH%%|%{_ftp_arch}|g
339 ' < %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
341 s|%%ARCH%%|%{_ftp_arch}|g
342 ' < %{SOURCE8} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
346 s|%%ARCH%%|%{_ftp_alt_arch}|g
347 ' < %{SOURCE2} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
352 install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
355 # add desktop file and icon
356 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
357 install %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
358 install %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
361 # sources we don't package
362 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,pld,fedora,centos}-source.conf
363 # include them in %doc
366 rm -f configs/Makefile*
370 rm -f $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
376 rm -rf $RPM_BUILD_ROOT
379 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
380 if [ "$1" = "1" ]; then
381 # remove ignore = vserver-packages inside vserver on first install
384 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
385 done </proc/self/status
387 if [ -z "$ctx" -o "$ctx" = "0" ]; then
392 if [ "$VSERVER" = "yes" ]; then
393 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
397 %postun -p /sbin/postshell
398 -/usr/sbin/fix-info-dir -c %{_infodir}
400 %post libs -p /sbin/ldconfig
401 %postun libs -p /sbin/ldconfig
403 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
404 if [ -f /etc/poldek.conf.rpmsave ]; then
413 if (sub(",noauto", "", name)) {
418 if (match(name, /,pri=[0-9]+/)) {
419 pri = substr(name, RSTART + 5, RLENGTH - 5);
420 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
423 # skip ac sources. already in new config.
424 if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
427 print "name = " name;
428 print "type = " type;
429 print "path = " path;
430 print "auto = " auto;
431 print "autoup = " autoup;
437 }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
438 echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
441 hold=$(grep ^hold /etc/poldek.conf.rpmsave)
443 sed -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
447 %triggerpostun -- poldek < 0.30-0.20080225.00.1
448 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
449 %{__sed} -i -e '/^%%include source.conf/{
451 a# /etc/poldek/repos.d/*.conf
452 a%%includedir repos.d
453 }' %{_sysconfdir}/%{name}/poldek.conf
456 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
457 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
459 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
460 cp -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
461 cp -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
465 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
466 cp -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
467 cp -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
471 %files -f %{name}.lang
472 %defattr(644,root,root,755)
473 %doc README* NEWS TODO configs
474 %dir %{_sysconfdir}/%{name}
475 %dir %{_sysconfdir}/%{name}/repos.d
476 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
477 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
478 %attr(755,root,root) %{_bindir}/*
479 %dir %{_libdir}/%{name}
480 %attr(755,root,root) %{_libdir}/%{name}/*
481 %{_mandir}/man1/%{name}*
482 %lang(pl) %{_mandir}/pl/man1/%{name}*
483 %{_infodir}/poldek.info*
485 %{_desktopdir}/%{name}.desktop
486 %{_pixmapsdir}/%{name}.png
489 %if %{without static}
491 %defattr(644,root,root,755)
492 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
493 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
494 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
495 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
496 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
497 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
498 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
499 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
500 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
501 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
505 %defattr(644,root,root,755)
506 %{!?with_static:%attr(755,root,root) %{_libdir}/lib*.so}
511 %defattr(644,root,root,755)
515 %files -n python-poldek
516 %defattr(644,root,root,755)
517 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
518 %{py_sitescriptdir}/poldek.py[co]
519 %{py_sitescriptdir}/poldekmod.py[co]