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