]> TLD Linux GIT Repositories - packages/poldek.git/blob - poldek.spec
- restored libdb patch, force compilation with db4.7
[packages/poldek.git] / poldek.spec
1 # TODO
2 # - fix config having escaped html entities:
3 #   # package A requires capability foo >= 1.0 while package B provides "foo"
4
5 # Conditional build:
6 %bcond_with     static  # don't use shared libraries
7 %bcond_without  imode   # don't build interactive mode
8 %bcond_without  python  # don't build python bindings
9
10 # required versions (forced to avoid SEGV with mixed db used by rpm and poldek)
11 # NOTE: poldek links with "system db" (-ldb) anyway if it exists
12 %define         db_pkg          db4.7
13 %define         ver_db          4.7.25
14 %define         ver_db_rel      1
15 %define         ver_rpm         4.5-49
16
17 %define         rel     2
18 Summary:        RPM packages management helper tool
19 Summary(hu.UTF-8):      RPM csomagkezelést segítő eszköz
20 Summary(pl.UTF-8):      Pomocnicze narzędzie do zarządzania pakietami RPM
21 Name:           poldek
22 Version:        0.32.2
23 Release:        %{rel}
24 License:        GPL v2
25 Group:          Applications/System
26 Source0:        https://launchpad.net/poldek/0.32/%{version}/+download/%{name}-%{version}.tar.xz
27 # Source0-md5:  60b964723880569531f88f084cd3ae65
28 Source1:        %{name}.conf
29 Source2:        %{name}-multilib.conf
30 Source3:        %{name}-config.sh
31 Source5:        %{name}-aliases.conf
32 Source6:        %{name}.desktop
33 Source7:        %{name}.png
34 Patch0:         %{name}-size-type.patch
35 Patch1:         %{name}-config.patch
36 Patch2:         pm-hooks.patch
37 Patch3:         WTERMSIG.patch
38 Patch4:         %{name}-no_local_stdint.patch
39 Patch5:         %{name}-libdb.patch
40 URL:            http://poldek.pld-linux.org/
41 BuildRequires:  %{db_pkg}-devel >= %{ver_db}-%{ver_db_rel}
42 BuildRequires:  autoconf
43 BuildRequires:  automake >= 1:1.11
44 BuildRequires:  bzip2-devel
45 BuildRequires:  check-devel
46 BuildRequires:  docbook-dtd412-xml
47 BuildRequires:  gettext-tools
48 BuildRequires:  libgomp-devel
49 BuildRequires:  libtool
50 BuildRequires:  libxml2-devel
51 BuildRequires:  openssl-devel >= 0.9.7d
52 BuildRequires:  pcre-devel
53 BuildRequires:  pkgconfig
54 BuildRequires:  popt-devel
55 %{?with_python:BuildRequires:   python-devel}
56 BuildRequires:  readline-devel >= 5.0
57 BuildRequires:  rpm-devel >= %{ver_rpm}
58 %{?with_python:BuildRequires:   rpm-pythonprov}
59 BuildRequires:  tar >= 1:1.22
60 BuildRequires:  xmlto
61 BuildRequires:  xz
62 BuildRequires:  zlib-devel
63 %if %{with static}
64 BuildRequires:  %{db_pkg}-static >= %{ver_db}-%{ver_db_rel}
65 BuildRequires:  bzip2-static
66 BuildRequires:  glibc-static
67 BuildRequires:  libxml2-static
68 BuildRequires:  ncurses-static
69 BuildRequires:  openssl-static
70 BuildRequires:  pcre-static
71 BuildRequires:  popt-static
72 BuildRequires:  readline-static
73 BuildRequires:  rpm-static
74 BuildRequires:  zlib-static
75 %endif
76 Requires(triggerpostun):        awk
77 Requires(triggerpostun):        sed >= 4.0
78 Requires:       %{db_pkg} >= %{ver_db}-%{ver_db_rel}
79 Requires:       %{name}-libs = %{version}-%{release}
80 Requires:       /bin/run-parts
81 Requires:       rpm >= %{ver_rpm}
82 Requires:       rpm-db-ver = %{ver_db}
83 Requires:       rpm-lib >= %{ver_rpm}
84 Requires:       sed
85 Conflicts:      etckeeper < 1.18-2
86 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
87
88 %define         _libexecdir     %{_prefix}/lib/%{name}
89
90 %description
91 poldek is an RPM package management tool which allows you to easily
92 perform package verification, installation (including system
93 installation from scratch), upgrading, and removal.
94
95 Program can be used in batch (like apt-get from Debian's APT) or
96 interactive mode. The interactive mode puts you into a readline
97 interface with command line autocompletion and history, similar to the
98 shell mode of Perl's CPAN.
99
100 %{?with_static:This version is statically linked.}
101
102 %{!?with_imode:This version hasn't got interactive mode.}
103 #'vim
104
105 %description -l hu.UTF-8
106 poldek egy RPM csomagkezelő eszköz, amely megkönnyíti a
107 csomagellenőrzést, telepítést (beleértve a rendszertelepítést a
108 nulláról), frissítést és eltávolítást.
109
110 A program használható parancssorból (mint a Debian apt-get programja)
111 vagy interaktív módban. Az interaktív mód egy readline környezetet
112 jelent, parancskiegészítéssel és előzményekkel, hasonlóan a Perl CPAN
113 shell módjához.
114
115 %{?with_static:Ez a verzió statikusan linkelt.}
116
117 %{!?with_imode:Ennek a verziónak nincs interaktív módja.}
118
119 %description -l pl.UTF-8
120 poldek jest narzędziem linii poleceń służącym do weryfikacji,
121 instalacji (włączając instalację systemu od zera), aktualizacji i
122 usuwania pakietów.
123
124 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
125 interaktywnym. Tryb interaktywny posiada interfejs readline z
126 dopełnianiem komend i historią, podobny do trybu shell perlowego
127 modułu CPAN.
128
129 %{?with_static:Ta wersja jest konsolidowana statycznie.}
130
131 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
132
133 %package libs
134 Summary:        poldek libraries
135 Summary(hu.UTF-8):      A poldek könyvtárai
136 Summary(pl.UTF-8):      Biblioteki poldka
137 Group:          Libraries
138
139 %description libs
140 poldek libraries.
141
142 %description libs -l hu.UTF-8
143 A poldek könyvtárai.
144
145 %description libs -l pl.UTF-8
146 Biblioteki poldka.
147
148 %package devel
149 Summary:        Header files for poldek libraries
150 Summary(hu.UTF-8):      A poldek könyvtár fejlesztői fájljai
151 Summary(pl.UTF-8):      Pliki nagłówkowe bibliotek poldka
152 Group:          Development/Libraries
153 Requires:       %{name}-libs = %{version}-%{release}
154 Requires:       rpm-devel >= %{ver_rpm}
155
156 %description devel
157 Header files for poldek libraries.
158
159 %description devel -l hu.UTF-8
160 A poldek könyvtár fejlesztői fájljai.
161
162 %description devel -l pl.UTF-8
163 Pliki nagłówkowe bibliotek poldka.
164
165 %package static
166 Summary:        poldek static libraries
167 Summary(hu.UTF-8):      poldek statikus könyvtárak
168 Summary(pl.UTF-8):      Biblioteki statyczne poldka
169 Group:          Development/Libraries
170 Requires:       %{name}-devel = %{version}-%{release}
171
172 %description static
173 poldek static libraries.
174
175 %description static -l hu.UTF-8
176 poldek statikus könyvtárak.
177
178 %description static -l pl.UTF-8
179 Biblioteki statyczne poldka.
180
181 %package -n python-poldek
182 Summary:        Python modules for poldek
183 Summary(hu.UTF-8):      Python modulok poldek-hez
184 Summary(pl.UTF-8):      Moduły języka Python dla poldka
185 Group:          Libraries/Python
186 Requires:       %{name}-libs = %{version}-%{release}
187 Requires:       python-libs
188
189 %description -n python-poldek
190 Python modules for poldek.
191
192 %description -n python-poldek -l hu.UTF-8
193 Python modulok poldek-hez.
194
195 %description -n python-poldek -l pl.UTF-8
196 Moduły języka Python dla poldka.
197
198 %prep
199 %setup -q
200 %patch0 -p1
201 %patch1 -p1
202 %patch2 -p1
203 %patch3 -p1
204 %patch4 -p1
205 %patch5 -p1
206
207 %{__rm} m4/libtool.m4 m4/lt*.m4
208
209 # cleanup backups after patching
210 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
211 chmod u+x ./configure ./doc/conf-xml2.sh
212
213 %build
214 %{__gettextize}
215 %{__libtoolize}
216 %{__aclocal} -I m4
217 %{__autoheader}
218 %{__autoconf}
219 %{__automake}
220 cd tndb
221 %{__libtoolize}
222 %{__aclocal}
223 %{__autoheader}
224 %{__autoconf}
225 %{__automake}
226 cd ../trurlib
227 %{__libtoolize}
228 %{__aclocal}
229 %{__autoheader}
230 %{__autoconf}
231 %{__automake}
232 cd ..
233
234 CPPFLAGS="%{rpmcppflags} -std=gnu99 -fgnu89-inline"
235 %configure \
236         %{?with_static:--enable-static --disable-shared} \
237         %{!?with_imode:--disable-imode} \
238         --with-pkglibdir=%{_libexecdir} \
239         --enable-nls \
240         %{?with_python:--with-python}
241 %{__make} -j1
242 #       --enable-trace
243
244 %install
245 rm -rf $RPM_BUILD_ROOT
246 install -d $RPM_BUILD_ROOT/var/cache/%{name}
247
248 %{__make} install -j1 \
249         DESTDIR=$RPM_BUILD_ROOT
250
251 install -p %{SOURCE3} $RPM_BUILD_ROOT%{_bindir}/poldek-config
252
253 %if %{with python}
254 %{__make} -C python -j1 install \
255         DESTDIR=$RPM_BUILD_ROOT \
256         libdir=%{py_sitedir}
257 %endif
258
259 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
260
261 %ifarch i686
262         %define         ftp_arch        %{_target_cpu}
263 %endif
264 %ifarch %{x8664}
265         %define         ftp_arch        x86_64
266         %define         ftp_alt_arch    i686
267 %endif
268 %ifarch pentium2 pentium3 pentium4
269         %define         ftp_arch        i686
270 %endif
271
272 %define tld_conf %{SOURCE1}
273
274 %ifarch %{x8664}
275         %define tld_multilib_conf %{SOURCE2}
276 %endif
277
278 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{tld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld.conf
279
280 %if 0%{?tld_multilib_conf:1}
281         %{__sed} 's|%%ARCH%%|%{ftp_alt_arch}|g' < %{tld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
282 %endif
283
284 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
285
286 %if %{with imode}
287 # add desktop file and icon
288 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
289 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
290 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
291 %endif
292
293 # sources we don't package
294 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
295 # include them in %doc
296 %{__rm} -rf configs
297 cp -a conf configs
298 %{__rm} -f configs/Makefile*
299
300 %if %{with python}
301 %py_postclean
302 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
303 %endif
304
305
306 %find_lang %{name}
307
308 %clean
309 rm -rf $RPM_BUILD_ROOT
310
311 %post
312 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
313 if [ "$1" = "1" ]; then
314         # remove ignore = vserver-packages inside vserver on first install
315         {
316                 while read f ctx; do
317                         [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
318                 done </proc/self/status
319         } 2>/dev/null
320         if [ -z "$ctx" -o "$ctx" = "0" ]; then
321                 VSERVER=no
322         else
323                 VSERVER=yes
324         fi
325         if [ "$VSERVER" = "yes" ]; then
326                 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
327         fi
328 fi
329
330 %postun -p      /sbin/postshell
331 -/usr/sbin/fix-info-dir -c %{_infodir}
332
333 %post   libs -p /sbin/ldconfig
334 %postun libs -p /sbin/ldconfig
335
336 %triggerpostun -- poldek < 0.30-0.20080225.00.1
337 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
338         %{__sed} -i -e '/^%%include source.conf/{
339                 a
340                 a# /etc/poldek/repos.d/*.conf
341                 a%%includedir repos.d
342         }' %{_sysconfdir}/%{name}/poldek.conf
343 fi
344
345 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
346 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
347
348 if [ -f %{_sysconfdir}/%{name}/tld-source.conf.rpmsave ]; then
349         %{__mv} -f %{_sysconfdir}/%{name}/repos.d/tld.conf{,.rpmnew}
350         %{__mv} -v %{_sysconfdir}/%{name}/tld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld.conf
351 fi
352
353 %ifarch %{x8664}
354 if [ -f %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave ]; then
355         %{__mv} -f %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf{,.rpmnew}
356         %{__mv} -v %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
357 fi
358 %endif
359
360 %triggerpostun -- %{name} < 0.30.1-8
361 if [ $1 -le 1 ]; then
362         # revert change on  --downgrade
363         %{__sed} -i -re 's,^pm command = %{_libexecdir}/pm-command.sh,#&,' %{_sysconfdir}/%{name}/%{name}.conf
364 else
365         # setup pm command
366         %{__sed} -i -re 's,#?(pm command =).*,\1 %{_libexecdir}/pm-command.sh,' %{_sysconfdir}/%{name}/%{name}.conf
367 fi
368
369 %files -f %{name}.lang
370 %defattr(644,root,root,755)
371 %doc ChangeLog README* NEWS TODO configs
372 %dir %{_sysconfdir}/%{name}
373 %dir %{_sysconfdir}/%{name}/pre-install.d
374 %{_sysconfdir}/%{name}/pre-install.d/README
375 %dir %{_sysconfdir}/%{name}/post-install.d
376 %{_sysconfdir}/%{name}/post-install.d/README
377 %dir %{_sysconfdir}/%{name}/repos.d
378 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/cli.conf
379 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/fetch.conf
380 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/poldek.conf
381 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/source.conf
382 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/tld.conf
383 %if 0%{?tld_multilib_conf:1}
384 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
385 %endif
386 %attr(755,root,root) %{_bindir}/ipoldek
387 %attr(755,root,root) %{_bindir}/poldek
388 %attr(755,root,root) %{_bindir}/poldek-config
389 %attr(755,root,root) %{_bindir}/rpmvercmp
390 %dir %{_libexecdir}
391 %attr(755,root,root) %{_libexecdir}/pm-command.sh
392 %attr(755,root,root) %{_libexecdir}/poldekuser-setup.sh
393 %attr(755,root,root) %{_libexecdir}/vfcompr
394 %attr(755,root,root) %{_libexecdir}/vfjuggle
395 %attr(755,root,root) %{_libexecdir}/vfsmb
396 %attr(755,root,root) %{_libexecdir}/zlib-in-rpm.sh
397 %{_mandir}/man1/%{name}*.1*
398 %lang(pl) %{_mandir}/pl/man1/%{name}*
399 %{_infodir}/poldek.info*
400 %if %{with imode}
401 %{_desktopdir}/%{name}.desktop
402 %{_pixmapsdir}/%{name}.png
403 %endif
404 %dir /var/cache/%{name}
405
406 %if %{without static}
407 %files libs
408 %defattr(644,root,root,755)
409 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
410 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
411 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
412 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
413 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
414 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
415 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
416 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
417 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
418 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
419 %endif
420
421 %files devel
422 %defattr(644,root,root,755)
423 %if %{without static}
424 %attr(755,root,root) %{_libdir}/libpoclidek.so
425 %attr(755,root,root) %{_libdir}/libpoldek.so
426 %attr(755,root,root) %{_libdir}/libtndb.so
427 %attr(755,root,root) %{_libdir}/libtrurl.so
428 %attr(755,root,root) %{_libdir}/libvfile.so
429 %endif
430 %{_libdir}/libpoclidek.la
431 %{_libdir}/libpoldek.la
432 %{_libdir}/libtndb.la
433 %{_libdir}/libtrurl.la
434 %{_libdir}/libvfile.la
435 %{_includedir}/poldek
436 %{_includedir}/tndb
437 %{_includedir}/trurl
438 %{_includedir}/vfile
439 %{_pkgconfigdir}/tndb.pc
440 %{_pkgconfigdir}/trurlib.pc
441
442 %files static
443 %defattr(644,root,root,755)
444 %{_libdir}/libtndb.a
445 %{_libdir}/libtrurl.a
446
447 %if %{with python}
448 %files -n python-poldek
449 %defattr(644,root,root,755)
450 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
451 %{py_sitescriptdir}/poldek.py[co]
452 %{py_sitescriptdir}/poldekmod.py[co]
453 %endif