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