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