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