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