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