]> git.pld-linux.org Git - packages/poldek.git/blob - poldek.spec
- remove ignore = vserver-packages inside vserver on first install
[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 %if "%{pld_release}" == "ti"
9 %define ver_db  4.5.20
10 %define ver_db_rel      8
11 %else
12 %define ver_db  4.7.25
13 %define ver_db_rel      1
14 %endif
15 %define ver_rpm 4.5-5
16 #
17 %define         snap    20080820.23
18 %define         rel             29
19 Summary:        RPM packages management helper tool
20 Summary(pl.UTF-8):      Pomocnicze narzędzie do zarządzania pakietami RPM
21 Name:           poldek
22 Version:        0.30
23 Release:        0.%{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}-cvs%{snap}.tar.bz2
28 # Source0-md5:  2738eb3996f1cdf1e5d74b913d6e7414
29 Source1:        %{name}.conf
30 Source2:        %{name}-multilib.conf
31 Source3:        %{name}-ti.conf
32 Source4:        %{name}-multilib-ti.conf
33 Source5:        %{name}-aliases.conf
34 Source6:        %{name}.desktop
35 Source7:        %{name}.png
36 Source8:        %{name}-debuginfo.conf
37 Patch0:         %{name}-vserver-packages.patch
38 Patch1:         %{name}-config.patch
39 Patch2:         %{name}-abort-on-upgrade.patch
40 Patch3:         %{name}-inline.patch
41 Patch4:         %{name}-ls-llu.patch
42 Patch5:         %{name}-op-ldalldesc.patch
43 Patch6:         %{name}-nocolor-upgrade.patch
44 Patch7:         %{name}-upgrade-dist.patch
45 Patch8:         %{name}-keep-reinstalled-provides.patch
46 Patch9:         %{name}-dont-ask-for-suggests-on-errors.patch
47 Patch10:        %{name}-crash-on-invalid-locale.patch
48 Patch11:        %{name}-noutf8.patch
49 Patch12:        %{name}-dont-suggests-required-packages.patch
50 Patch13:        %{name}-tty-for-erasures.patch
51 Patch14:        %{name}-both_langs.patch
52 Patch15:        %{name}-317130.patch
53 Patch16:        %{name}-321546.patch
54 Patch17:        %{name}-size-type.patch
55 Patch18:        %{name}-no-inlines.patch
56 Patch19:        %{name}-export-missing-symbol.patch
57 Patch20:        %{name}-skip-suggests-on-upgrade.patch
58 Patch21:        %{name}-po.patch
59 Patch22:        %{name}-refcnt.patch
60 Patch23:        %{name}-assertion-failed.patch
61 URL:            http://poldek.pld-linux.org/
62 BuildRequires:  autoconf
63 BuildRequires:  automake
64 BuildRequires:  bzip2-devel
65 BuildRequires:  check
66 BuildRequires:  db-devel >= %{ver_db}-%{ver_db_rel}
67 BuildRequires:  gettext-autopoint
68 BuildRequires:  libtool
69 BuildRequires:  libxml2-devel
70 BuildRequires:  openssl-devel >= 0.9.7d
71 BuildRequires:  pcre-devel
72 BuildRequires:  perl-tools-pod
73 BuildRequires:  pkgconfig
74 BuildRequires:  popt-devel
75 %{?with_python:BuildRequires:   python-devel}
76 BuildRequires:  readline-devel >= 5.0
77 BuildRequires:  rpm-devel >= %{ver_rpm}
78 %{?with_python:BuildRequires:   rpm-pythonprov}
79 BuildRequires:  xmlto
80 BuildRequires:  zlib-devel
81 %if %{with static}
82 BuildRequires:  bzip2-static
83 BuildRequires:  db-static >= %{ver_db}-%{ver_db_rel}
84 BuildRequires:  glibc-static
85 BuildRequires:  libselinux-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:       %{name}-libs = %{version}-%{release}
98 Requires:       db >= %{ver_db}-%{ver_db_rel}
99 Requires:       rpm >= %{ver_rpm}
100 Requires:       rpm-db-ver = %{ver_db}
101 Requires:       rpm-lib = %(rpm -q --qf '%{V}' rpm-lib)
102 # vf* scripts use sed
103 Requires:       sed
104 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
105
106 %description
107 poldek is an RPM package management tool which allows you to easily
108 perform package verification, installation (including system
109 installation from scratch), upgrading, and removal.
110
111 Program can be used in batch (like apt-get from Debian's APT) or
112 interactive mode. The interactive mode puts you into a readline
113 interface with command line autocompletion and history, similar to the
114 shell mode of Perl's CPAN.
115
116 %{?with_static:This version is statically linked.}
117
118 %{!?with_imode:This version hasn't got interactive mode.}
119 #'vim
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(pl.UTF-8):      Biblioteki poldka
138 Group:          Libraries
139
140 %description libs
141 poldek libraries.
142
143 %description libs -l pl.UTF-8
144 Biblioteki poldka.
145
146 %package devel
147 Summary:        Header files for poldek libraries
148 Summary(pl.UTF-8):      Pliki nagłówkowe bibliotek poldka
149 Group:          Development/Libraries
150 Requires:       %{name}-libs = %{version}-%{release}
151 Requires:       rpm-devel >= %{ver_rpm}
152
153 %description devel
154 Header files for poldek libraries.
155
156 %description devel -l pl.UTF-8
157 Pliki nagłówkowe bibliotek poldka.
158
159 %package static
160 Summary:        poldek static libraries
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 pl.UTF-8
169 Biblioteki statyczne poldka.
170
171 %package -n python-poldek
172 Summary:        Python modules for poldek
173 Summary(pl.UTF-8):      Moduły języka Python dla poldka
174 Group:          Libraries/Python
175 Requires:       %{name}-libs = %{version}-%{release}
176 %pyrequires_eq  python-libs
177
178 %description -n python-poldek
179 Python modules for poldek.
180
181 %description -n python-poldek -l pl.UTF-8
182 Moduły języka Python dla poldka.
183
184 %prep
185 %setup -q -n %{name}-%{version}%{?snap:-cvs%{snap}}
186 %patch0 -p1
187 %patch1 -p1
188 %patch2 -p1
189 %patch3 -p1
190 %patch4 -p1
191 %patch5 -p1
192 %patch6 -p0
193 %patch7 -p0
194 %patch8 -p0
195 %patch9 -p0
196 %patch10 -p1
197 %patch11 -p1
198 %patch12 -p1
199 %patch13 -p1
200 %patch14 -p1
201 %patch15 -p1
202 %patch16 -p1
203 %patch17 -p1
204 %patch18 -p1
205 %patch19 -p0
206 %patch20 -p1
207 %patch21 -p1
208 %patch22 -p0
209 %patch23 -p1
210
211 # cleanup backups after patching
212 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
213
214 %build
215 %{__libtoolize}
216 %{__aclocal} -I m4
217 %{__autoconf}
218 %{__automake}
219 cp -f config.sub trurlib
220
221 CPPFLAGS="-std=gnu99"
222 %configure \
223         %{?with_static:--enable-static --disable-shared} \
224         %{!?with_imode:--disable-imode} \
225         --enable-nls \
226         %{?with_python:--with-python}
227 %{__make}
228
229 %install
230 rm -rf $RPM_BUILD_ROOT
231 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d
232
233 %{__make} install \
234         DESTDIR=$RPM_BUILD_ROOT
235
236 %if %{with python}
237 %{__make} -C python install \
238         DESTDIR=$RPM_BUILD_ROOT \
239         libdir=%{py_sitedir}
240 %endif
241
242 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
243
244 %ifarch i486 i686 ppc sparc alpha athlon
245 %define         _ftp_arch       %{_target_cpu}
246 %endif
247 %ifarch %{x8664}
248 %define         _ftp_arch       x86_64
249 %define         _ftp_alt_arch   i686
250 %endif
251 %ifarch i586
252 %if "%{pld_release}" == "ti"
253 %define         _ftp_arch       i586
254 %else
255 %define         _ftp_arch       i486
256 %endif
257 %endif
258 %ifarch pentium2 pentium3 pentium4
259 %define         _ftp_arch       i686
260 %endif
261 %ifarch sparcv9 sparc64
262 %define         _ftp_arch       sparc
263 %endif
264
265 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
266
267 %if "%{pld_release}" == "ti"
268 sed -e '
269         s|%%ARCH%%|%{_ftp_arch}|g
270 ' < %{SOURCE3} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
271
272 %ifarch %{x8664}
273 sed '
274         s|%%ARCH%%|%{_ftp_alt_arch}|g
275 ' < %{SOURCE4} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
276 %endif
277 %else
278 # pld_release = th
279 sed -e '
280         s|%%ARCH%%|%{_ftp_arch}|g
281 ' < %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
282 sed -e '
283         s|%%ARCH%%|%{_ftp_arch}|g
284 ' < %{SOURCE8} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
285
286 %ifarch %{x8664}
287 sed '
288         s|%%ARCH%%|%{_ftp_alt_arch}|g
289 ' < %{SOURCE2} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
290 %endif
291 %endif
292
293 install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
294
295 %if %{with imode}
296 # add desktop file and icon
297 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
298 install %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
299 install %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
300 %endif
301
302 # sources we don't package
303 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,pld,fedora,centos}-source.conf
304 # include them in %doc
305 rm -rf configs
306 cp -a conf configs
307 rm -f configs/Makefile*
308
309 %if %{with python}
310 %py_postclean
311 rm -f $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
312 %endif
313
314 %find_lang %{name}
315
316 %clean
317 rm -rf $RPM_BUILD_ROOT
318
319 %post
320 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
321 if [ "$1" = "1" ]; then
322         # remove ignore = vserver-packages inside vserver on first install
323         {
324                 while read f ctx; do
325                         [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
326                 done </proc/self/status
327         } 2>/dev/null
328         if [ -z "$ctx" -o "$ctx" = "0" ]; then
329                 VSERVER=no
330         else
331                 VSERVER=yes
332         fi
333         if [ "$VSERVER" = "yes" ]; then
334                 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
335         fi
336 fi
337
338 %postun -p      /sbin/postshell
339 -/usr/sbin/fix-info-dir -c %{_infodir}
340
341 %post   libs -p /sbin/ldconfig
342 %postun libs -p /sbin/ldconfig
343
344 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
345 if [ -f /etc/poldek.conf.rpmsave ]; then
346         awk '/^source/ {
347         name = $3;
348         path = $4;
349         auto = "yes";
350         autoup = "yes";
351         type = "pdir";
352         pri = "";
353
354         if (sub(",noauto", "", name)) {
355                 auto = "no";
356         }
357
358         # process pri=\d+
359         if (match(name, /,pri=[0-9]+/)) {
360                 pri = substr(name, RSTART + 5, RLENGTH - 5);
361                 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
362         }
363
364         # skip ac sources. already in new config.
365         if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
366                 print "";
367                 print "[source]";
368                 print "name = " name;
369                 print "type = " type;
370                 print "path = " path;
371                 print "auto = " auto;
372                 print "autoup = " autoup;
373                 if (pri) {
374                         print "pri = " pri;
375                 }
376         }
377
378         }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
379         echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
380
381         # copy hold=
382         hold=$(grep ^hold /etc/poldek.conf.rpmsave)
383         if [ "$hold" ]; then
384                 sed -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
385         fi
386 fi
387
388 %triggerpostun -- poldek < 0.30-0.20080225.00.1
389 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
390         %{__sed} -i -e '/^%%include source.conf/{
391                 a
392                 a# /etc/poldek/repos.d/*.conf
393                 a%%includedir repos.d
394         }' %{_sysconfdir}/%{name}/poldek.conf
395 fi
396
397 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
398 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
399
400 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
401         cp -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
402         cp -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
403 fi
404
405 %ifarch %{x8664}
406 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
407         cp -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
408         cp -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
409 fi
410 %endif
411
412 %files -f %{name}.lang
413 %defattr(644,root,root,755)
414 %doc README* NEWS TODO configs
415 %dir %{_sysconfdir}/%{name}
416 %dir %{_sysconfdir}/%{name}/repos.d
417 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
418 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
419 %attr(755,root,root) %{_bindir}/*
420 %dir %{_libdir}/%{name}
421 %attr(755,root,root) %{_libdir}/%{name}/*
422 %{_mandir}/man1/%{name}*
423 %lang(pl) %{_mandir}/pl/man1/%{name}*
424 %{_infodir}/poldek.info*
425 %if %{with imode}
426 %{_desktopdir}/%{name}.desktop
427 %{_pixmapsdir}/%{name}.png
428 %endif
429
430 %if %{without static}
431 %files libs
432 %defattr(644,root,root,755)
433 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
434 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
435 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
436 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
437 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
438 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
439 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
440 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
441 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
442 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
443 %endif
444
445 %files devel
446 %defattr(644,root,root,755)
447 %{!?with_static:%attr(755,root,root) %{_libdir}/lib*.so}
448 %{_libdir}/lib*.la
449 %{_includedir}/*
450
451 %files static
452 %defattr(644,root,root,755)
453 %{_libdir}/lib*.a
454
455 %if %{with python}
456 %files -n python-poldek
457 %defattr(644,root,root,755)
458 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
459 %{py_sitescriptdir}/poldek.py[co]
460 %{py_sitescriptdir}/poldekmod.py[co]
461 %endif
This page took 0.06196 seconds and 3 git commands to generate.