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