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