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