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