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