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