]> git.pld-linux.org Git - packages/poldek.git/blob - poldek.spec
8014395b3d4bfe2a378488baa273f2cf78c154e2
[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     8
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}-glibc-internal.patch
51 Patch2:         %{name}-config.patch
52 Patch3:         at-char-completion.patch
53 Patch4:         %{name}-ignore-too-long-paths.patch
54 Patch5:         %{name}-noorder.patch
55 URL:            http://poldek.pld-linux.org/
56 BuildRequires:  %{db_pkg}-devel >= %{ver_db}-%{ver_db_rel}
57 BuildRequires:  autoconf
58 BuildRequires:  automake >= 1:1.11
59 BuildRequires:  bzip2-devel
60 BuildRequires:  check-devel
61 BuildRequires:  docbook-dtd412-xml
62 BuildRequires:  gettext-devel
63 BuildRequires:  libsemanage-devel
64 BuildRequires:  libtool
65 BuildRequires:  libxml2-devel
66 BuildRequires:  neon-devel
67 BuildRequires:  openssl-devel >= 0.9.7d
68 BuildRequires:  pcre-devel
69 BuildRequires:  pkgconfig
70 BuildRequires:  popt-devel
71 %{?with_python:BuildRequires:   python-devel}
72 BuildRequires:  readline-devel >= 5.0
73 BuildRequires:  rpm-devel >= %{ver_rpm}
74 %{?with_python:BuildRequires:   rpm-pythonprov}
75 BuildRequires:  swig-python
76 BuildRequires:  tar >= 1:1.22
77 BuildRequires:  xmlto
78 BuildRequires:  xz
79 BuildRequires:  zlib-devel
80 %if %{with static}
81 BuildRequires:  %{db_pkg}-static >= %{ver_db}-%{ver_db_rel}
82 BuildRequires:  bzip2-static
83 BuildRequires:  glibc-static
84 BuildRequires:  libselinux-static
85 BuildRequires:  libsemanage-static
86 BuildRequires:  libxml2-static
87 BuildRequires:  ncurses-static
88 BuildRequires:  openssl-static
89 BuildRequires:  pcre-static
90 BuildRequires:  popt-static
91 BuildRequires:  readline-static
92 BuildRequires:  rpm-static
93 BuildRequires:  zlib-static
94 %endif
95 Requires(triggerpostun):        awk
96 Requires(triggerpostun):        sed >= 4.0
97 Requires:       %{db_pkg} >= %{ver_db}-%{ver_db_rel}
98 Requires:       %{name}-libs = %{version}-%{release}
99 Requires:       rpm >= %{ver_rpm}
100 Requires:       rpm-db-ver = %{ver_db}
101 #Requires:      rpm-lib = %(rpm -q --qf '%{V}' rpm-lib)
102 Requires:       rpm-lib >= 5.4.10
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 %patch2 -p1
222 %patch3 -p1
223 %patch4 -p1
224 %patch5 -p1
225
226 %{__rm} m4/libtool.m4 m4/lt*.m4
227
228 # cleanup backups after patching
229 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
230 chmod u+x ./configure ./doc/conf-xml2.sh
231
232 %build
233 %{__gettextize}
234 %{__libtoolize}
235 %{__aclocal} -I m4
236 %{__autoheader}
237 %{__autoconf}
238 %{__automake}
239 cd tndb
240 %{__libtoolize}
241 %{__aclocal}
242 %{__autoheader}
243 %{__autoconf}
244 %{__automake}
245 cd ../trurlib
246 %{__libtoolize}
247 %{__aclocal}
248 %{__autoheader}
249 %{__autoconf}
250 %{__automake}
251 cd ..
252
253 CPPFLAGS="%{rpmcppflags} -std=gnu99 -fgnu89-inline"
254 %configure \
255         %{?with_static:--enable-static --disable-shared} \
256         %{!?with_imode:--disable-imode} \
257         --with-pkglibdir=%{_libexecdir} \
258         --enable-nls \
259         %{?with_python:--with-python}
260 %{__make} -j1
261 #       --enable-trace
262
263 %install
264 rm -rf $RPM_BUILD_ROOT
265 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name}/repos.d,/var/cache/%{name}}
266
267 %{__make} install -j1 \
268         DESTDIR=$RPM_BUILD_ROOT
269
270 %if %{with python}
271 %{__make} -C python -j1 install \
272         DESTDIR=$RPM_BUILD_ROOT \
273         libdir=%{py_sitedir}
274 %endif
275
276 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
277
278 %ifarch i486 i686 ppc sparc alpha athlon
279         %define         _ftp_arch       %{_target_cpu}
280 %endif
281 %ifarch %{x8664}
282         %define         _ftp_arch       x86_64
283         %define         _ftp_alt_arch   i686
284 %endif
285 %ifarch i586
286         %define         _ftp_arch       i486
287 %endif
288 %ifarch pentium2 pentium3 pentium4
289         %define         _ftp_arch       i686
290 %endif
291 %ifarch sparcv9 sparc64
292         %define         _ftp_arch       sparc
293         %define         _ftp_arch       %{_target_cpu}
294         %ifarch sparc64
295                 %define         _ftp_alt_arch   sparcv9
296         %endif
297 %endif
298
299 %define pld_conf %{SOURCE1}
300 %define pld_debuginfo_conf %{SOURCE8}
301 %define pld_archive_conf %{SOURCE11}
302
303 %ifarch %{x8664}
304         %define pld_multilib_conf %{SOURCE2}
305 %endif
306
307 # aidath
308 %ifarch sparcv9 sparc64
309         %define pld_conf %{SOURCE9}
310         %undefine pld_archive_conf
311 %endif
312 %ifarch sparc64
313         %define pld_multilib_conf %{SOURCE10}
314 %endif
315
316 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{pld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
317
318 %if 0%{?pld_multilib_conf:1}
319         %{__sed} 's|%%ARCH%%|%{_ftp_alt_arch}|g' < %{pld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
320 %endif
321
322 %if 0%{?pld_debuginfo_conf:1}
323 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{pld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
324 %endif
325
326 %if 0%{?pld_archive_conf:1}
327 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' < %{pld_archive_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-archive.conf
328 %endif
329
330 # Always install snapshot configs
331 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' \
332         -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE100} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
333 %{__sed} -e 's|%%ARCH%%|%{_ftp_arch}|g' \
334         -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE102} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-debuginfo.conf
335 %ifarch %{x8664}
336         %{__sed} -e 's|%%ARCH%%|%{_ftp_alt_arch}|g' \
337                 -e 's|%%SNAP%%|%{SNAP}|g' < %{SOURCE101} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}-multilib.conf
338 %endif
339
340 %if %{with snap}
341 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
342 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
343 %else
344 %{__sed} -i -e 's|@@SNAP@@||g' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-%{SNAP}.conf
345 %{__sed} -i '/@@SNAP@@.*/d' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
346 %endif
347
348 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
349
350 %if %{with imode}
351 # add desktop file and icon
352 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
353 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
354 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
355 %endif
356
357 # sources we don't package
358 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
359 # include them in %doc
360 %{__rm} -rf configs
361 cp -a conf configs
362 %{__rm} -f configs/Makefile*
363
364 %if %{with python}
365 %py_postclean
366 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
367 %endif
368
369 %find_lang %{name}
370
371 %clean
372 rm -rf $RPM_BUILD_ROOT
373
374 %post
375 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
376 if [ "$1" = "1" ]; then
377         # remove ignore = vserver-packages inside vserver on first install
378         {
379                 while read f ctx; do
380                         [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
381                 done </proc/self/status
382         } 2>/dev/null
383         if [ -z "$ctx" -o "$ctx" = "0" ]; then
384                 VSERVER=no
385         else
386                 VSERVER=yes
387         fi
388         if [ "$VSERVER" = "yes" ]; then
389                 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
390         fi
391 fi
392
393 %postun -p      /sbin/postshell
394 -/usr/sbin/fix-info-dir -c %{_infodir}
395
396 %post   libs -p /sbin/ldconfig
397 %postun libs -p /sbin/ldconfig
398
399 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
400 if [ -f /etc/poldek.conf.rpmsave ]; then
401         awk '/^source/ {
402         name = $3;
403         path = $4;
404         auto = "yes";
405         autoup = "yes";
406         type = "pdir";
407         pri = "";
408
409         if (sub(",noauto", "", name)) {
410                 auto = "no";
411         }
412
413         # process pri=\d+
414         if (match(name, /,pri=[0-9]+/)) {
415                 pri = substr(name, RSTART + 5, RLENGTH - 5);
416                 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
417         }
418
419         # skip ac sources. already in new config.
420         if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
421                 print "";
422                 print "[source]";
423                 print "name = " name;
424                 print "type = " type;
425                 print "path = " path;
426                 print "auto = " auto;
427                 print "autoup = " autoup;
428                 if (pri) {
429                         print "pri = " pri;
430                 }
431         }
432
433         }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
434         echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
435
436         # copy hold=
437         hold=$(grep ^hold /etc/poldek.conf.rpmsave)
438         if [ "$hold" ]; then
439                 %{__sed} -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
440         fi
441 fi
442
443 %triggerpostun -- poldek < 0.30-0.20080225.00.1
444 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
445         %{__sed} -i -e '/^%%include source.conf/{
446                 a
447                 a# /etc/poldek/repos.d/*.conf
448                 a%%includedir repos.d
449         }' %{_sysconfdir}/%{name}/poldek.conf
450 fi
451
452 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
453 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
454
455 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
456         cp -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
457         cp -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
458 fi
459
460 %ifarch %{x8664}
461 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
462         cp -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
463         cp -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
464 fi
465 %endif
466
467 %files -f %{name}.lang
468 %defattr(644,root,root,755)
469 %doc ChangeLog README* NEWS TODO configs
470 %dir %{_sysconfdir}/%{name}
471 %dir %{_sysconfdir}/%{name}/repos.d
472 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
473 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
474 %attr(755,root,root) %{_bindir}/ipoldek
475 %attr(755,root,root) %{_bindir}/poldek
476 %attr(755,root,root) %{_bindir}/rpmvercmp
477 %dir %{_libexecdir}
478 %attr(755,root,root) %{_libexecdir}/*
479 %{_mandir}/man1/%{name}*.1*
480 %lang(pl) %{_mandir}/pl/man1/%{name}*
481 %{_infodir}/poldek.info*
482 %if %{with imode}
483 %{_desktopdir}/%{name}.desktop
484 %{_pixmapsdir}/%{name}.png
485 %endif
486 %dir /var/cache/%{name}
487
488 %if %{without static}
489 %files libs
490 %defattr(644,root,root,755)
491 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
492 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
493 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
494 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
495 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
496 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
497 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
498 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
499 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
500 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
501 %endif
502
503 %files devel
504 %defattr(644,root,root,755)
505 %if %{without static}
506 %attr(755,root,root) %{_libdir}/libpoclidek.so
507 %attr(755,root,root) %{_libdir}/libpoldek.so
508 %attr(755,root,root) %{_libdir}/libtndb.so
509 %attr(755,root,root) %{_libdir}/libtrurl.so
510 %attr(755,root,root) %{_libdir}/libvfile.so
511 %endif
512 %{_libdir}/libpoclidek.la
513 %{_libdir}/libpoldek.la
514 %{_libdir}/libtndb.la
515 %{_libdir}/libtrurl.la
516 %{_libdir}/libvfile.la
517 %{_includedir}/poldek
518 %{_includedir}/tndb
519 %{_includedir}/trurl
520 %{_includedir}/vfile
521 %{_pkgconfigdir}/tndb.pc
522 %{_pkgconfigdir}/trurlib.pc
523
524 %files static
525 %defattr(644,root,root,755)
526 %{_libdir}/libtndb.a
527 %{_libdir}/libtrurl.a
528
529 %if %{with python}
530 %files -n python-poldek
531 %defattr(644,root,root,755)
532 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
533 %{py_sitescriptdir}/poldek.py[co]
534 %{py_sitescriptdir}/poldekmod.py[co]
535 %endif
This page took 0.059872 seconds and 3 git commands to generate.