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