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