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