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