]> TLD Linux GIT Repositories - packages/poldek.git/blob - poldek.spec
- ehh, too much on my head these days...
[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      2
11 %define         ver_rpm         4.5-71
12
13 %define         rel     5
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 Patch2:         %{name}-libdb.patch
33 URL:            http://poldek.pld-linux.org/
34 BuildRequires:  %{db_pkg}-devel >= %{ver_db}-%{ver_db_rel}
35 BuildRequires:  autoconf
36 BuildRequires:  automake >= 1:1.11
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:  libxml2-static
62 BuildRequires:  ncurses-static
63 BuildRequires:  openssl-static
64 BuildRequires:  pcre-static
65 BuildRequires:  popt-static
66 BuildRequires:  readline-static
67 BuildRequires:  rpm-static
68 BuildRequires:  zlib-static
69 %endif
70 Requires(triggerpostun):        awk
71 Requires(triggerpostun):        sed >= 4.0
72 Requires:       %{db_pkg} >= %{ver_db}-%{ver_db_rel}
73 Requires:       %{name}-libs = %{version}-%{release}
74 Requires:       rpm >= %{ver_rpm}
75 Requires:       rpm-db-ver = %{ver_db}
76 #Requires:      rpm-lib = %(rpm -q --qf '%{V}' rpm-lib)
77 Requires:       rpm-lib >= %{ver_rpm}
78 # vf* scripts use sed
79 Requires:       sed
80 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
81
82 %define         _libexecdir     %{_prefix}/lib/%{name}
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 Requires:       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
198 %{__rm} m4/libtool.m4 m4/lt*.m4
199
200 # cleanup backups after patching
201 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
202 chmod u+x ./configure ./doc/conf-xml2.sh
203
204 %build
205 %{__gettextize}
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 -fgnu89-inline"
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
234 %install
235 rm -rf $RPM_BUILD_ROOT
236 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name}/repos.d,/var/cache/%{name}}
237
238 %{__make} install -j1 \
239         DESTDIR=$RPM_BUILD_ROOT
240
241 %if %{with python}
242 %{__make} -C python -j1 install \
243         DESTDIR=$RPM_BUILD_ROOT \
244         libdir=%{py_sitedir}
245 %endif
246
247 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
248
249 %ifarch i686
250         %define         _ftp_arch       %{_target_cpu}
251 %endif
252 %ifarch %{x8664}
253         %define         _ftp_arch       x86_64
254         %define         _ftp_alt_arch   i686
255 %endif
256 %ifarch pentium2 pentium3 pentium4
257         %define         _ftp_arch       i686
258 %endif
259
260 %define tld_conf %{SOURCE1}
261
262 %ifarch %{x8664}
263         %define tld_multilib_conf %{SOURCE2}
264 %endif
265
266 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{tld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld.conf
267
268 %if 0%{?tld_multilib_conf:1}
269         %{__sed} 's|%%ARCH%%|%{_ftp_alt_arch}|g' < %{tld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
270 %endif
271
272 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
273
274 %if %{with imode}
275 # add desktop file and icon
276 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
277 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
278 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
279 %endif
280
281 # sources we don't package
282 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{{rh,fedora,centos}-source,repos.d/pld}.conf
283 # include them in %doc
284 %{__rm} -rf configs
285 cp -a conf configs
286 %{__rm} -f configs/Makefile*
287
288 %if %{with python}
289 %py_postclean
290 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
291 %endif
292
293 %find_lang %{name}
294
295 %clean
296 rm -rf $RPM_BUILD_ROOT
297
298 %post
299 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
300 if [ "$1" = "1" ]; then
301         # remove ignore = vserver-packages inside vserver on first install
302         {
303                 while read f ctx; do
304                         [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
305                 done </proc/self/status
306         } 2>/dev/null
307         if [ -z "$ctx" -o "$ctx" = "0" ]; then
308                 VSERVER=no
309         else
310                 VSERVER=yes
311         fi
312         if [ "$VSERVER" = "yes" ]; then
313                 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
314         fi
315 fi
316
317 %postun -p      /sbin/postshell
318 -/usr/sbin/fix-info-dir -c %{_infodir}
319
320 %post   libs -p /sbin/ldconfig
321 %postun libs -p /sbin/ldconfig
322
323 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
324 if [ -f /etc/poldek.conf.rpmsave ]; then
325         awk '/^source/ {
326         name = $3;
327         path = $4;
328         auto = "yes";
329         autoup = "yes";
330         type = "pdir";
331         pri = "";
332
333         if (sub(",noauto", "", name)) {
334                 auto = "no";
335         }
336
337         # process pri=\d+
338         if (match(name, /,pri=[0-9]+/)) {
339                 pri = substr(name, RSTART + 5, RLENGTH - 5);
340                 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
341         }
342
343         # skip ac sources. already in new config.
344         if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
345                 print "";
346                 print "[source]";
347                 print "name = " name;
348                 print "type = " type;
349                 print "path = " path;
350                 print "auto = " auto;
351                 print "autoup = " autoup;
352                 if (pri) {
353                         print "pri = " pri;
354                 }
355         }
356
357         }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
358         echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
359
360         # copy hold=
361         hold=$(grep ^hold /etc/poldek.conf.rpmsave)
362         if [ "$hold" ]; then
363                 %{__sed} -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
364         fi
365 fi
366
367 %triggerpostun -- poldek < 0.30-0.20080225.00.1
368 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
369         %{__sed} -i -e '/^%%include source.conf/{
370                 a
371                 a# /etc/poldek/repos.d/*.conf
372                 a%%includedir repos.d
373         }' %{_sysconfdir}/%{name}/poldek.conf
374 fi
375
376 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
377 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
378
379 if [ -f %{_sysconfdir}/%{name}/tld-source.conf.rpmsave ]; then
380         cp -f %{_sysconfdir}/%{name}/repos.d/tld.conf{,.rpmnew}
381         cp -f %{_sysconfdir}/%{name}/tld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld.conf
382 fi
383
384 %ifarch %{x8664}
385 if [ -f %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave ]; then
386         cp -f %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf{,.rpmnew}
387         cp -f %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
388 fi
389 %endif
390
391 %files -f %{name}.lang
392 %defattr(644,root,root,755)
393 %doc ChangeLog README* NEWS TODO configs
394 %dir %{_sysconfdir}/%{name}
395 %dir %{_sysconfdir}/%{name}/repos.d
396 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
397 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
398 %attr(755,root,root) %{_bindir}/ipoldek
399 %attr(755,root,root) %{_bindir}/poldek
400 %attr(755,root,root) %{_bindir}/rpmvercmp
401 %dir %{_libexecdir}
402 %attr(755,root,root) %{_libexecdir}/*
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