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