]> TLD Linux GIT Repositories - packages/poldek.git/blob - poldek.spec
- merged changes from PLD
[packages/poldek.git] / poldek.spec
1 # Conditional build:
2 %bcond_with     static  # don't use shared libraries
3 %bcond_without  imode   # don't build interactive mode
4 %bcond_without  python  # don't build python bindings
5
6 # required versions (forced to avoid SEGV with mixed db used by rpm and poldek)
7 %define ver_db          4.5.20
8 %define ver_db_rel      8
9 %define ver_rpm         4.5-49
10
11 %define         snap    rc6
12 %define         rel     4
13 Summary:        RPM packages management helper tool
14 Summary(hu.UTF-8):      RPM csomagkezelést segítő eszköz
15 Summary(pl.UTF-8):      Pomocnicze narzędzie do zarządzania pakietami RPM
16 Name:           poldek
17 Version:        0.30
18 Release:        0.%{snap}.%{rel}
19 License:        GPL v2
20 Group:          Applications/System
21 #Source0:       http://poldek.pld-linux.org/download/snapshots/%{name}-%{version}-cvs%{snap}.tar.bz2
22 Source0:        http://carme.pld-linux.org/~megabajt/snaps/poldek/%{name}-%{version}%{snap}.tar.xz
23 # Source0-md5:  4b528ad356b02efdd72b81f1ecaceb83
24 Source1:        %{name}.conf
25 Source2:        %{name}-multilib.conf
26 Source5:        %{name}-aliases.conf
27 Source6:        %{name}.desktop
28 Source7:        %{name}.png
29 Patch0:         %{name}-vserver-packages.patch
30 Patch1:         %{name}-config.patch
31 Patch2:         %{name}-size-type.patch
32 Patch3:         %{name}-Os-fail-workaround.patch
33 Patch4:         %{name}-link-rpmio.patch
34 Patch5:         %{name}-vrpmlog.patch
35 Patch6:         %{name}-git.patch
36 URL:            http://poldek.pld-linux.org/
37 BuildRequires:  autoconf
38 BuildRequires:  automake
39 BuildRequires:  bzip2-devel
40 BuildRequires:  check-devel
41 BuildRequires:  db-devel >= %{ver_db}-%{ver_db_rel}
42 BuildRequires:  docbook-dtd412-xml
43 BuildRequires:  gettext-devel
44 BuildRequires:  libtool
45 BuildRequires:  libxml2-devel
46 BuildRequires:  neon-devel
47 BuildRequires:  openssl-devel >= 0.9.7d
48 BuildRequires:  pcre-devel
49 BuildRequires:  pkgconfig
50 BuildRequires:  popt-devel
51 %{?with_python:BuildRequires:   python-devel}
52 BuildRequires:  readline-devel >= 5.0
53 BuildRequires:  rpm-devel >= %{ver_rpm}
54 %{?with_python:BuildRequires:   rpm-pythonprov}
55 BuildRequires:  swig-python
56 BuildRequires:  xmlto
57 BuildRequires:  zlib-devel
58 %if %{with static}
59 BuildRequires:  bzip2-static
60 BuildRequires:  db-static >= %{ver_db}-%{ver_db_rel}
61 BuildRequires:  glibc-static
62 BuildRequires:  libselinux-static
63 BuildRequires:  libxml2-static
64 BuildRequires:  ncurses-static
65 BuildRequires:  openssl-static
66 BuildRequires:  pcre-static
67 BuildRequires:  popt-static
68 BuildRequires:  readline-static
69 BuildRequires:  rpm-static
70 BuildRequires:  zlib-static
71 %endif
72 Requires(triggerpostun):        awk
73 Requires(triggerpostun):        sed >= 4.0
74 Requires:       %{name}-libs = %{version}-%{release}
75 Requires:       db >= %{ver_db}-%{ver_db_rel}
76 Requires:       rpm >= %{ver_rpm}
77 Requires:       rpm-db-ver = %{ver_db}
78 Requires:       rpm-lib = %(rpm -q --qf '%{V}' rpm-lib)
79 # vf* scripts use sed
80 Requires:       sed
81 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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 %pyrequires_eq  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 %patch2 -p1
196 %patch3 -p1
197 %patch4 -p1
198 %patch5 -p1
199 %patch6 -p1
200
201 %{__rm} m4/libtool.m4 m4/lt*.m4
202
203 # cleanup backups after patching
204 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
205 chmod u+x ./configure ./doc/conf-xml2.sh
206
207 %build
208 %{__libtoolize}
209 %{__aclocal} -I m4
210 %{__autoheader}
211 %{__autoconf}
212 %{__automake}
213 cd tndb
214 %{__libtoolize}
215 %{__aclocal}
216 %{__autoheader}
217 %{__autoconf}
218 %{__automake}
219 cd ../trurlib
220 %{__libtoolize}
221 %{__aclocal}
222 %{__autoheader}
223 %{__autoconf}
224 %{__automake}
225 cd ..
226
227 CPPFLAGS="%{rpmcppflags} -std=gnu99"
228 %configure \
229         %{?with_static:--enable-static --disable-shared} \
230         %{!?with_imode:--disable-imode} \
231         --enable-nls \
232         %{?with_python:--with-python}
233 %{__make} -j1
234 #       --enable-trace
235
236 %install
237 rm -rf $RPM_BUILD_ROOT
238 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name}/repos.d,/var/cache/%{name}}
239
240 %{__make} install -j1 \
241         DESTDIR=$RPM_BUILD_ROOT
242
243 %if %{with python}
244 %{__make} -C python -j1 install \
245         DESTDIR=$RPM_BUILD_ROOT \
246         libdir=%{py_sitedir}
247 %endif
248
249 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
250
251 %ifarch i586 i686 ppc sparc alpha athlon
252         %define         _ftp_arch       %{_target_cpu}
253 %endif
254 %ifarch %{x8664}
255         %define         _ftp_arch       x86_64
256         %define         _ftp_alt_arch   i686
257 %endif
258 %ifarch i586
259         %define         _ftp_arch       i586
260 %endif
261 %ifarch pentium2 pentium3 pentium4
262         %define         _ftp_arch       i686
263 %endif
264
265 %define tld_conf %{SOURCE1}
266
267 %ifarch %{x8664}
268         %define tld_multilib_conf %{SOURCE2}
269 %endif
270
271 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{tld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld.conf
272
273 %if 0%{?tld_multilib_conf:1}
274         %{__sed} 's|%%ARCH%%|%{_ftp_alt_arch}|g' < %{tld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
275 %endif
276
277 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
278
279 %if %{with imode}
280 # add desktop file and icon
281 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
282 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
283 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
284 %endif
285
286 # sources we don't package
287 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{{rh,fedora,centos}-source,repos.d/pld}.conf
288 # include them in %doc
289 %{__rm} -rf configs
290 cp -a conf configs
291 %{__rm} -f configs/Makefile*
292
293 %if %{with python}
294 %py_postclean
295 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
296 %endif
297
298 %find_lang %{name}
299
300 %clean
301 rm -rf $RPM_BUILD_ROOT
302
303 %post
304 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
305 if [ "$1" = "1" ]; then
306         # remove ignore = vserver-packages inside vserver on first install
307         {
308                 while read f ctx; do
309                         [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
310                 done </proc/self/status
311         } 2>/dev/null
312         if [ -z "$ctx" -o "$ctx" = "0" ]; then
313                 VSERVER=no
314         else
315                 VSERVER=yes
316         fi
317         if [ "$VSERVER" = "yes" ]; then
318                 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
319         fi
320 fi
321
322 %postun -p      /sbin/postshell
323 -/usr/sbin/fix-info-dir -c %{_infodir}
324
325 %post   libs -p /sbin/ldconfig
326 %postun libs -p /sbin/ldconfig
327
328 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
329 if [ -f /etc/poldek.conf.rpmsave ]; then
330         awk '/^source/ {
331         name = $3;
332         path = $4;
333         auto = "yes";
334         autoup = "yes";
335         type = "pdir";
336         pri = "";
337
338         if (sub(",noauto", "", name)) {
339                 auto = "no";
340         }
341
342         # process pri=\d+
343         if (match(name, /,pri=[0-9]+/)) {
344                 pri = substr(name, RSTART + 5, RLENGTH - 5);
345                 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
346         }
347
348         # skip ac sources. already in new config.
349         if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
350                 print "";
351                 print "[source]";
352                 print "name = " name;
353                 print "type = " type;
354                 print "path = " path;
355                 print "auto = " auto;
356                 print "autoup = " autoup;
357                 if (pri) {
358                         print "pri = " pri;
359                 }
360         }
361
362         }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
363         echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
364
365         # copy hold=
366         hold=$(grep ^hold /etc/poldek.conf.rpmsave)
367         if [ "$hold" ]; then
368                 %{__sed} -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
369         fi
370 fi
371
372 %triggerpostun -- poldek < 0.30-0.20080225.00.1
373 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
374         %{__sed} -i -e '/^%%include source.conf/{
375                 a
376                 a# /etc/poldek/repos.d/*.conf
377                 a%%includedir repos.d
378         }' %{_sysconfdir}/%{name}/poldek.conf
379 fi
380
381 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
382 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
383
384 if [ -f %{_sysconfdir}/%{name}/tld-source.conf.rpmsave ]; then
385         cp -f %{_sysconfdir}/%{name}/repos.d/tld.conf{,.rpmnew}
386         cp -f %{_sysconfdir}/%{name}/tld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld.conf
387 fi
388
389 %ifarch %{x8664}
390 if [ -f %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave ]; then
391         cp -f %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf{,.rpmnew}
392         cp -f %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
393 fi
394 %endif
395
396 %files -f %{name}.lang
397 %defattr(644,root,root,755)
398 %doc ChangeLog README* NEWS TODO configs
399 %dir %{_sysconfdir}/%{name}
400 %dir %{_sysconfdir}/%{name}/repos.d
401 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
402 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
403 %attr(755,root,root) %{_bindir}/ipoldek
404 %attr(755,root,root) %{_bindir}/poldek
405 %attr(755,root,root) %{_bindir}/rpmvercmp
406 %dir %{_libdir}/%{name}
407 %attr(755,root,root) %{_libdir}/%{name}/*
408 %{_mandir}/man1/%{name}*.1*
409 %lang(pl) %{_mandir}/pl/man1/%{name}*
410 %{_infodir}/poldek.info*
411 %if %{with imode}
412 %{_desktopdir}/%{name}.desktop
413 %{_pixmapsdir}/%{name}.png
414 %endif
415 %dir /var/cache/%{name}
416
417 %if %{without static}
418 %files libs
419 %defattr(644,root,root,755)
420 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
421 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
422 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
423 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
424 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
425 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
426 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
427 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
428 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
429 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
430 %endif
431
432 %files devel
433 %defattr(644,root,root,755)
434 %if %{without static}
435 %attr(755,root,root) %{_libdir}/libpoclidek.so
436 %attr(755,root,root) %{_libdir}/libpoldek.so
437 %attr(755,root,root) %{_libdir}/libtndb.so
438 %attr(755,root,root) %{_libdir}/libtrurl.so
439 %attr(755,root,root) %{_libdir}/libvfile.so
440 %endif
441 %{_libdir}/libpoclidek.la
442 %{_libdir}/libpoldek.la
443 %{_libdir}/libtndb.la
444 %{_libdir}/libtrurl.la
445 %{_libdir}/libvfile.la
446 %{_includedir}/poldek
447 %{_includedir}/tndb
448 %{_includedir}/trurl
449 %{_includedir}/vfile
450 %{_pkgconfigdir}/tndb.pc
451
452 %files static
453 %defattr(644,root,root,755)
454 %{_libdir}/libtndb.a
455 %{_libdir}/libtrurl.a
456
457 %if %{with python}
458 %files -n python-poldek
459 %defattr(644,root,root,755)
460 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
461 %{py_sitescriptdir}/poldek.py[co]
462 %{py_sitescriptdir}/poldekmod.py[co]
463 %endif