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