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