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