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