]> git.pld-linux.org Git - packages/poldek.git/blob - poldek.spec
- more fixes
[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             34
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 Source9:        %{name}-aidath.conf
38 Source10:       %{name}-multilib-aidath.conf
39 Patch0:         %{name}-vserver-packages.patch
40 Patch1:         %{name}-config.patch
41 Patch2:         %{name}-abort-on-upgrade.patch
42 Patch3:         %{name}-inline.patch
43 Patch4:         %{name}-ls-llu.patch
44 Patch5:         %{name}-op-ldalldesc.patch
45 Patch6:         %{name}-nocolor-upgrade.patch
46 Patch7:         %{name}-upgrade-dist.patch
47 Patch8:         %{name}-keep-reinstalled-provides.patch
48 Patch9:         %{name}-dont-ask-for-suggests-on-errors.patch
49 Patch10:        %{name}-crash-on-invalid-locale.patch
50 Patch11:        %{name}-noutf8.patch
51 Patch12:        %{name}-dont-suggests-required-packages.patch
52 Patch13:        %{name}-tty-for-erasures.patch
53 Patch14:        %{name}-both_langs.patch
54 Patch15:        %{name}-317130.patch
55 Patch16:        %{name}-321546.patch
56 Patch17:        %{name}-size-type.patch
57 Patch18:        %{name}-no-inlines.patch
58 Patch19:        %{name}-export-missing-symbol.patch
59 Patch20:        %{name}-skip-suggests-on-upgrade.patch
60 Patch21:        %{name}-po.patch
61 Patch22:        %{name}-refcnt.patch
62 Patch23:        %{name}-assertion-failed.patch
63 Patch24:        %{name}-unescape-urlencoded-strings.patch
64 Patch25:        %{name}-ls-source-rpm.patch
65 Patch26:        %{name}-add-arch-match.patch
66 Patch27:        %{name}-multilib-upgrade.patch
67 Patch28:        %{name}-score-reqs-marked-to-install.patch
68 Patch29:        %{name}-dont-be-greedy.patch
69 Patch30:        %{name}-dont-lose-deps.patch
70 URL:            http://poldek.pld-linux.org/
71 BuildRequires:  autoconf
72 BuildRequires:  automake
73 BuildRequires:  bzip2-devel
74 BuildRequires:  check
75 BuildRequires:  db-devel >= %{ver_db}-%{ver_db_rel}
76 BuildRequires:  gettext-autopoint
77 BuildRequires:  libtool
78 BuildRequires:  libxml2-devel
79 BuildRequires:  openssl-devel >= 0.9.7d
80 BuildRequires:  pcre-devel
81 BuildRequires:  perl-tools-pod
82 BuildRequires:  pkgconfig
83 BuildRequires:  popt-devel
84 %{?with_python:BuildRequires:   python-devel}
85 BuildRequires:  readline-devel >= 5.0
86 BuildRequires:  rpm-devel >= %{ver_rpm}
87 %{?with_python:BuildRequires:   rpm-pythonprov}
88 BuildRequires:  xmlto
89 BuildRequires:  zlib-devel
90 %if %{with static}
91 BuildRequires:  bzip2-static
92 BuildRequires:  db-static >= %{ver_db}-%{ver_db_rel}
93 BuildRequires:  glibc-static
94 BuildRequires:  libselinux-static
95 BuildRequires:  libxml2-static
96 BuildRequires:  ncurses-static
97 BuildRequires:  openssl-static
98 BuildRequires:  pcre-static
99 BuildRequires:  popt-static
100 BuildRequires:  readline-static
101 BuildRequires:  rpm-static
102 BuildRequires:  zlib-static
103 %endif
104 Requires(triggerpostun):        awk
105 Requires(triggerpostun):        sed >= 4.0
106 Requires:       %{name}-libs = %{version}-%{release}
107 Requires:       db >= %{ver_db}-%{ver_db_rel}
108 Requires:       rpm >= %{ver_rpm}
109 Requires:       rpm-db-ver = %{ver_db}
110 Requires:       rpm-lib = %(rpm -q --qf '%{V}' rpm-lib)
111 # vf* scripts use sed
112 Requires:       sed
113 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
114
115 %description
116 poldek is an RPM package management tool which allows you to easily
117 perform package verification, installation (including system
118 installation from scratch), upgrading, and removal.
119
120 Program can be used in batch (like apt-get from Debian's APT) or
121 interactive mode. The interactive mode puts you into a readline
122 interface with command line autocompletion and history, similar to the
123 shell mode of Perl's CPAN.
124
125 %{?with_static:This version is statically linked.}
126
127 %{!?with_imode:This version hasn't got interactive mode.}
128 #'vim
129
130 %description -l pl.UTF-8
131 poldek jest narzędziem linii poleceń służącym do weryfikacji,
132 instalacji (włączając instalację systemu od zera), aktualizacji i
133 usuwania pakietów.
134
135 Program może być używany w trybie wsadowym (jak debianowy apt-get) lub
136 interaktywnym. Tryb interaktywny posiada interfejs readline z
137 dopełnianiem komend i historią, podobny do trybu shell perlowego
138 modułu CPAN.
139
140 %{?with_static:Ta wersja jest konsolidowana statycznie.}
141
142 %{!?with_imode:Ta wersja nie posiada trybu interaktywnego.}
143
144 %package libs
145 Summary:        poldek libraries
146 Summary(pl.UTF-8):      Biblioteki poldka
147 Group:          Libraries
148
149 %description libs
150 poldek libraries.
151
152 %description libs -l pl.UTF-8
153 Biblioteki poldka.
154
155 %package devel
156 Summary:        Header files for poldek libraries
157 Summary(pl.UTF-8):      Pliki nagłówkowe bibliotek poldka
158 Group:          Development/Libraries
159 Requires:       %{name}-libs = %{version}-%{release}
160 Requires:       rpm-devel >= %{ver_rpm}
161
162 %description devel
163 Header files for poldek libraries.
164
165 %description devel -l pl.UTF-8
166 Pliki nagłówkowe bibliotek poldka.
167
168 %package static
169 Summary:        poldek static libraries
170 Summary(pl.UTF-8):      Biblioteki statyczne poldka
171 Group:          Development/Libraries
172 Requires:       %{name}-devel = %{version}-%{release}
173
174 %description static
175 poldek static libraries.
176
177 %description static -l pl.UTF-8
178 Biblioteki statyczne poldka.
179
180 %package -n python-poldek
181 Summary:        Python modules for poldek
182 Summary(pl.UTF-8):      Moduły języka Python dla poldka
183 Group:          Libraries/Python
184 Requires:       %{name}-libs = %{version}-%{release}
185 %pyrequires_eq  python-libs
186
187 %description -n python-poldek
188 Python modules for poldek.
189
190 %description -n python-poldek -l pl.UTF-8
191 Moduły języka Python dla poldka.
192
193 %prep
194 %setup -q -n %{name}-%{version}%{?snap:-cvs%{snap}}
195 %patch0 -p1
196 %patch1 -p1
197 %patch2 -p1
198 %patch3 -p1
199 %patch4 -p1
200 %patch5 -p1
201 %patch6 -p0
202 %patch7 -p0
203 %patch8 -p0
204 %patch9 -p0
205 %patch10 -p1
206 %patch11 -p1
207 %patch12 -p1
208 %patch13 -p1
209 %patch14 -p1
210 %patch15 -p1
211 %patch16 -p1
212 %patch17 -p1
213 %patch18 -p1
214 %patch19 -p0
215 %patch20 -p1
216 %patch21 -p1
217 %patch22 -p0
218 %patch23 -p1
219 %patch24 -p1
220 # LP#392984
221 %patch25 -p1
222 # LP#408036
223 %patch26 -p1
224 # LP#408034
225 %patch27 -p1
226 # score reqs already marked to install
227 %patch28 -p1
228 # dont be greedy if upgraded pkg has needed capabilities
229 %patch29 -p1
230 # http://lists.pld-linux.org/mailman/pipermail/pld-devel-pl/2009-November/150519.html
231 %patch30 -p1
232
233 # cleanup backups after patching
234 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
235
236 %build
237 %{__libtoolize}
238 %{__aclocal} -I m4
239 %{__autoconf}
240 %{__automake}
241 cp -f config.sub trurlib
242
243 CPPFLAGS="-std=gnu99"
244 %configure \
245         %{?with_static:--enable-static --disable-shared} \
246         %{!?with_imode:--disable-imode} \
247         --enable-nls \
248         %{?with_python:--with-python}
249 %{__make}
250 #       --enable-trace
251
252 %install
253 rm -rf $RPM_BUILD_ROOT
254 install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d
255
256 %{__make} install \
257         DESTDIR=$RPM_BUILD_ROOT
258
259 %if %{with python}
260 %{__make} -C python install \
261         DESTDIR=$RPM_BUILD_ROOT \
262         libdir=%{py_sitedir}
263 %endif
264
265 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
266
267 %ifarch i486 i686 ppc sparc alpha athlon
268 %define         _ftp_arch       %{_target_cpu}
269 %endif
270 %ifarch %{x8664}
271 %define         _ftp_arch       x86_64
272 %define         _ftp_alt_arch   i686
273 %endif
274 %ifarch i586
275 %if "%{pld_release}" == "ti"
276 %define         _ftp_arch       i586
277 %else
278 %define         _ftp_arch       i486
279 %endif
280 %endif
281 %ifarch pentium2 pentium3 pentium4
282 %define         _ftp_arch       i686
283 %endif
284 %ifarch sparcv9 sparc64
285 %define         _ftp_arch       sparc
286 %if "%{pld_release}" == "th"
287 %define         _ftp_arch       %{_target_cpu}
288 %ifarch sparc64
289 %define         _ftp_alt_arch   sparcv9
290 %endif
291 %endif
292 %endif
293
294 %{?with_static:rm -f $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
295
296 %if "%{pld_release}" == "ti"
297 sed -e '
298         s|%%ARCH%%|%{_ftp_arch}|g
299 ' < %{SOURCE3} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
300
301 %ifarch %{x8664}
302 sed '
303         s|%%ARCH%%|%{_ftp_alt_arch}|g
304 ' < %{SOURCE4} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
305 %endif
306 %else
307 # pld_release = th
308 %ifarch sparcv9 sparc64
309 sed -e '
310         s|%%ARCH%%|%{_ftp_arch}|g
311 ' < %{SOURCE9} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
312
313 %ifarch sparc64
314 sed '
315         s|%%ARCH%%|%{_ftp_alt_arch}|g
316 ' < %{SOURCE10} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
317 %endif
318
319 %else
320 sed -e '
321         s|%%ARCH%%|%{_ftp_arch}|g
322 ' < %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld.conf
323 sed -e '
324         s|%%ARCH%%|%{_ftp_arch}|g
325 ' < %{SOURCE8} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-debuginfo.conf
326
327 %ifarch %{x8664}
328 sed '
329         s|%%ARCH%%|%{_ftp_alt_arch}|g
330 ' < %{SOURCE2} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
331 %endif
332 %endif
333 %endif
334
335 install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
336
337 %if %{with imode}
338 # add desktop file and icon
339 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
340 install %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
341 install %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
342 %endif
343
344 # sources we don't package
345 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,pld,fedora,centos}-source.conf
346 # include them in %doc
347 rm -rf configs
348 cp -a conf configs
349 rm -f configs/Makefile*
350
351 %if %{with python}
352 %py_postclean
353 rm -f $RPM_BUILD_ROOT%{py_sitedir}/_poldekmod.la
354 %endif
355
356 %find_lang %{name}
357
358 %clean
359 rm -rf $RPM_BUILD_ROOT
360
361 %post
362 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
363 if [ "$1" = "1" ]; then
364         # remove ignore = vserver-packages inside vserver on first install
365         {
366                 while read f ctx; do
367                         [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
368                 done </proc/self/status
369         } 2>/dev/null
370         if [ -z "$ctx" -o "$ctx" = "0" ]; then
371                 VSERVER=no
372         else
373                 VSERVER=yes
374         fi
375         if [ "$VSERVER" = "yes" ]; then
376                 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
377         fi
378 fi
379
380 %postun -p      /sbin/postshell
381 -/usr/sbin/fix-info-dir -c %{_infodir}
382
383 %post   libs -p /sbin/ldconfig
384 %postun libs -p /sbin/ldconfig
385
386 %triggerpostun -- poldek < 0.19.0-1.20050613.22.0
387 if [ -f /etc/poldek.conf.rpmsave ]; then
388         awk '/^source/ {
389         name = $3;
390         path = $4;
391         auto = "yes";
392         autoup = "yes";
393         type = "pdir";
394         pri = "";
395
396         if (sub(",noauto", "", name)) {
397                 auto = "no";
398         }
399
400         # process pri=\d+
401         if (match(name, /,pri=[0-9]+/)) {
402                 pri = substr(name, RSTART + 5, RLENGTH - 5);
403                 name = substr(name, 1, RSTART - 1) substr(name, RSTART + RLENGTH);
404         }
405
406         # skip ac sources. already in new config.
407         if (name !~ /^ac(-(ready|test|supported|updates-(general|security)))?$/) {
408                 print "";
409                 print "[source]";
410                 print "name = " name;
411                 print "type = " type;
412                 print "path = " path;
413                 print "auto = " auto;
414                 print "autoup = " autoup;
415                 if (pri) {
416                         print "pri = " pri;
417                 }
418         }
419
420         }' < /etc/poldek.conf.rpmsave >> /etc/poldek/source.conf
421         echo "Converted old custom sources from /etc/poldek.conf.rpmsave to new poldek format in /etc/poldek/source.conf"
422
423         # copy hold=
424         hold=$(grep ^hold /etc/poldek.conf.rpmsave)
425         if [ "$hold" ]; then
426                 sed -i -e "/^#hold =/s/^.*/$hold/" /etc/poldek/poldek.conf
427         fi
428 fi
429
430 %triggerpostun -- poldek < 0.30-0.20080225.00.1
431 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
432         %{__sed} -i -e '/^%%include source.conf/{
433                 a
434                 a# /etc/poldek/repos.d/*.conf
435                 a%%includedir repos.d
436         }' %{_sysconfdir}/%{name}/poldek.conf
437 fi
438
439 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
440 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
441
442 if [ -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave ]; then
443         cp -f %{_sysconfdir}/%{name}/repos.d/pld.conf{,.rpmnew}
444         cp -f %{_sysconfdir}/%{name}/pld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld.conf
445 fi
446
447 %ifarch %{x8664}
448 if [ -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave ]; then
449         cp -f %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf{,.rpmnew}
450         cp -f %{_sysconfdir}/%{name}/pld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/pld-multilib.conf
451 fi
452 %endif
453
454 %files -f %{name}.lang
455 %defattr(644,root,root,755)
456 %doc README* NEWS TODO configs
457 %dir %{_sysconfdir}/%{name}
458 %dir %{_sysconfdir}/%{name}/repos.d
459 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
460 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/*.conf
461 %attr(755,root,root) %{_bindir}/*
462 %dir %{_libdir}/%{name}
463 %attr(755,root,root) %{_libdir}/%{name}/*
464 %{_mandir}/man1/%{name}*
465 %lang(pl) %{_mandir}/pl/man1/%{name}*
466 %{_infodir}/poldek.info*
467 %if %{with imode}
468 %{_desktopdir}/%{name}.desktop
469 %{_pixmapsdir}/%{name}.png
470 %endif
471
472 %if %{without static}
473 %files libs
474 %defattr(644,root,root,755)
475 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
476 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
477 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
478 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
479 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
480 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.0
481 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.2
482 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
483 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
484 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
485 %endif
486
487 %files devel
488 %defattr(644,root,root,755)
489 %{!?with_static:%attr(755,root,root) %{_libdir}/lib*.so}
490 %{_libdir}/lib*.la
491 %{_includedir}/*
492
493 %files static
494 %defattr(644,root,root,755)
495 %{_libdir}/lib*.a
496
497 %if %{with python}
498 %files -n python-poldek
499 %defattr(644,root,root,755)
500 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
501 %{py_sitescriptdir}/poldek.py[co]
502 %{py_sitescriptdir}/poldekmod.py[co]
503 %endif
This page took 0.080017 seconds and 3 git commands to generate.