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