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