]> TLD Linux GIT Repositories - packages/poldek.git/blob - poldek.spec
be41b6ec6bb13c0c4effea97e30800280a65e87f
[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:  xmlto
59 BuildRequires:  zlib-devel
60 %if %{with static}
61 BuildRequires:  bzip2-static
62 BuildRequires:  db-static >= %{ver_db}-%{ver_db_rel}
63 BuildRequires:  glibc-static
64 BuildRequires:  libselinux-static
65 BuildRequires:  libxml2-static
66 BuildRequires:  ncurses-static
67 BuildRequires:  openssl-static
68 BuildRequires:  pcre-static
69 BuildRequires:  popt-static
70 BuildRequires:  readline-static
71 BuildRequires:  rpm-static
72 BuildRequires:  zlib-static
73 %endif
74 Requires(triggerpostun):        awk
75 Requires(triggerpostun):        sed >= 4.0
76 Requires:       %{name}-libs = %{version}-%{release}
77 Requires:       db >= %{ver_db}-%{ver_db_rel}
78 Requires:       rpm >= %{ver_rpm}
79 Requires:       rpm-db-ver = %{ver_db}
80 Requires:       rpm-lib = %(rpm -q --qf '%{V}' rpm-lib)
81 # vf* scripts use sed
82 Requires:       sed
83 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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 %pyrequires_eq  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 %patch3 -p1
199
200 rm -f m4/libtool.m4 m4/lt*.m4
201
202 # cleanup backups after patching
203 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
204 chmod u+x ./configure ./doc/conf-xml2.sh
205
206 %build
207 %{__libtoolize}
208 %{__aclocal} -I m4
209 %{__autoheader}
210 %{__autoconf}
211 %{__automake}
212 cp -f config.sub trurlib
213
214 CPPFLAGS="-std=gnu99"
215 %configure \
216         %{?with_static:--enable-static --disable-shared} \
217         %{!?with_imode:--disable-imode} \
218         --enable-nls \
219         %{?with_python:--with-python}
220 %{__make}
221 #       --enable-trace
222
223 %install
224 rm -rf $RPM_BUILD_ROOT
225 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d
226
227 %{__make} install \
228         DESTDIR=$RPM_BUILD_ROOT
229
230 %if %{with python}
231 %{__make} -C python install \
232         DESTDIR=$RPM_BUILD_ROOT \
233         libdir=%{py_sitedir}
234 %endif
235
236 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
237
238 %ifarch i486 i686 ppc sparc alpha athlon
239         %define         _ftp_arch       %{_target_cpu}
240 %endif
241 %ifarch %{x8664}
242         %define         _ftp_arch       x86_64
243         %define         _ftp_alt_arch   i686
244 %endif
245 %ifarch i586
246         %define         _ftp_arch       i586
247 %endif
248 %ifarch pentium2 pentium3 pentium4
249         %define         _ftp_arch       i686
250 %endif
251
252 %define tld_conf %{SOURCE1}
253 %ifarch %{x8664}
254         %define tld_multilib_conf %{SOURCE2}
255 %endif
256
257 sed -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{tld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld.conf
258
259 %if 0%{?tld_multilib_conf:1}
260         sed 's|%%ARCH%%|%{_ftp_alt_arch}|g' < %{tld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
261 %endif
262
263 cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
264
265 %if %{with imode}
266 # add desktop file and icon
267 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
268 cp -a %{SOURCE4} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
269 cp -a %{SOURCE5} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
270 %endif
271
272 # sources we don't package
273 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{{rh,pld,fedora,centos}-source,repos.d/pld}.conf
274 # include them in %doc
275 rm -rf configs
276 cp -a conf configs
277 rm -f configs/Makefile*
278
279 %if %{with python}
280 %py_postclean
281 rm -f $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
282 %endif
283
284 %find_lang %{name}
285
286 %clean
287 rm -rf $RPM_BUILD_ROOT
288
289 %post
290 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
291 if [ "$1" = "1" ]; then
292         # remove ignore = vserver-packages inside vserver on first install
293         {
294                 while read f ctx; do
295                         [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
296                 done </proc/self/status
297         } 2>/dev/null
298         if [ -z "$ctx" -o "$ctx" = "0" ]; then
299                 VSERVER=no
300         else
301                 VSERVER=yes
302         fi
303         if [ "$VSERVER" = "yes" ]; then
304                 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
305         fi
306 fi
307
308 %postun -p      /sbin/postshell
309 -/usr/sbin/fix-info-dir -c %{_infodir}
310
311 %post   libs -p /sbin/ldconfig
312 %postun libs -p /sbin/ldconfig
313
314 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
315 if [ -f /etc/poldek.conf.rpmsave ]; then
316         awk '/^source/ {
317         name = $3;
318         path = $4;
319         auto = "yes";
320         autoup = "yes";
321         type = "pdir";
322         pri = "";
323
324         if (sub(",noauto", "", name)) {
325                 auto = "no";
326         }
327
328         # process pri=\d+
329         if (match(name, /,pri=[0-9]+/)) {
330                 pri = substr(name, RSTART + 5, RLENGTH - 5);
331                 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
332         }
333
334         # skip ac sources. already in new config.
335         if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
336                 print "";
337                 print "[source]";
338                 print "name = " name;
339                 print "type = " type;
340                 print "path = " path;
341                 print "auto = " auto;
342                 print "autoup = " autoup;
343                 if (pri) {
344                         print "pri = " pri;
345                 }
346         }
347
348         }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
349         echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
350
351         # copy hold=
352         hold=$(grep ^hold /etc/poldek.conf.rpmsave)
353         if [ "$hold" ]; then
354                 sed -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
355         fi
356 fi
357
358 %triggerpostun -- poldek < 0.30-0.20080225.00.1
359 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
360         %{__sed} -i -e '/^%%include source.conf/{
361                 a
362                 a# /etc/poldek/repos.d/*.conf
363                 a%%includedir repos.d
364         }' %{_sysconfdir}/%{name}/poldek.conf
365 fi
366
367 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
368 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
369
370 if [ -f %{_sysconfdir}/%{name}/tld-source.conf.rpmsave ]; then
371         cp -f %{_sysconfdir}/%{name}/repos.d/tld.conf{,.rpmnew}
372         cp -f %{_sysconfdir}/%{name}/tld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld.conf
373 fi
374
375 %ifarch %{x8664}
376 if [ -f %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave ]; then
377         cp -f %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf{,.rpmnew}
378         cp -f %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
379 fi
380 %endif
381
382 %files -f %{name}.lang
383 %defattr(644,root,root,755)
384 %doc ChangeLog README* NEWS TODO configs
385 %dir %{_sysconfdir}/%{name}
386 %dir %{_sysconfdir}/%{name}/repos.d
387 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
388 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
389 %attr(755,root,root) %{_bindir}/*
390 %dir %{_libdir}/%{name}
391 %attr(755,root,root) %{_libdir}/%{name}/*
392 %{_mandir}/man1/%{name}*
393 %lang(pl) %{_mandir}/pl/man1/%{name}*
394 %{_infodir}/poldek.info*
395 %if %{with imode}
396 %{_desktopdir}/%{name}.desktop
397 %{_pixmapsdir}/%{name}.png
398 %endif
399
400 %if %{without static}
401 %files libs
402 %defattr(644,root,root,755)
403 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
404 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
405 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
406 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
407 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
408 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
409 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
410 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
411 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
412 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
413 %endif
414
415 %files devel
416 %defattr(644,root,root,755)
417 %{!?with_static:%attr(755,root,root) %{_libdir}/lib*.so}
418 %{_libdir}/lib*.la
419 %{_includedir}/*
420
421 %files static
422 %defattr(644,root,root,755)
423 %{_libdir}/lib*.a
424
425 %if %{with python}
426 %files -n python-poldek
427 %defattr(644,root,root,755)
428 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
429 %{py_sitescriptdir}/poldek.py[co]
430 %{py_sitescriptdir}/poldekmod.py[co]
431 %endif