]> TLD Linux GIT Repositories - packages/poldek.git/blob - poldek.spec
- merged PLD changes
[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         ver_rpm         1:4.14
13
14 Summary:        RPM packages management helper tool
15 Summary(hu.UTF-8):      RPM csomagkezelést segítő eszköz
16 Summary(pl.UTF-8):      Pomocnicze narzędzie do zarządzania pakietami RPM
17 Name:           poldek
18 Version:        0.42.2
19 Release:        9
20 License:        GPL v2
21 Group:          Applications/System
22 #Source0:       http://poldek.pld-linux.org/download/snapshots/%{name}-%{version}-cvs%{snap}.tar.bz2
23 Source0:        https://github.com/poldek-pm/poldek/releases/download/v%{version}/%{name}-%{version}.tar.xz
24 # Source0-md5:  2759fe45bc50efb6084d5338d725411a
25 Source1:        tld.conf
26 Source2:        tld-multilib.conf
27 Source3:        tld-debuginfo.conf
28 Source4:        %{name}-config.sh
29 Source5:        %{name}-aliases.conf
30 Source6:        %{name}.desktop
31 Source7:        %{name}.png
32 # Source7-md5:  ee487abede50874e9eceb6495d5ee150
33 Patch0:         %{name}-config.patch
34 Patch1:         pm-hooks.patch
35 Patch2:         %{name}-ext-down-enable.patch
36 Patch3:         %{name}-pc.patch
37 Patch4:         %{name}-info.patch
38 Patch5:         %{name}-multiarch-x32.patch
39 Patch6:         rpm-4.15.patch
40 Patch7:         db-index-format.patch
41 Patch8:         rpm4-uname-deps.patch
42 Patch9:         sqlite-rpmdb.patch
43 Patch10:        rpm4-cpuinfo-deps.patch
44 Patch11:        rpm4-no-dir-deps.patch
45 Patch12:        rpm4-rpmvercmp.patch
46 Patch13:        trurlib-shared.patch
47 Patch14:        rpm4-script-req-workaround.patch
48 Patch15:        skip-buildid-obsoletes.patch
49 Patch16:        verify-signature.patch
50 Patch17:        %{name}-rsa_sig_rpmorg.patch
51 Patch18:        no-bdb-for-rpm-org.patch
52 URL:            http://poldek.pld-linux.org/
53 BuildRequires:  autoconf >= 2.63
54 BuildRequires:  automake >= 1:1.11
55 BuildRequires:  bzip2-devel
56 BuildRequires:  check-devel
57 BuildRequires:  docbook-dtd412-xml
58 BuildRequires:  docbook2X
59 BuildRequires:  gettext-tools >= 0.11.5
60 BuildRequires:  libgomp-devel
61 BuildRequires:  libtool
62 BuildRequires:  libxml2-devel >= 2
63 BuildRequires:  lua54-devel
64 BuildRequires:  ncurses-devel
65 BuildRequires:  openssl-devel >= 0.9.7d
66 BuildRequires:  pcre-devel
67 BuildRequires:  perl-XML-Simple
68 BuildRequires:  perl-base
69 BuildRequires:  perl-modules
70 BuildRequires:  pkgconfig
71 BuildRequires:  popt-devel
72 %{?with_python:BuildRequires:   python-devel}
73 BuildRequires:  readline-devel >= 5.0
74 BuildRequires:  rpm-devel >= %{ver_rpm}
75 %{?with_python:BuildRequires:   rpm-pythonprov}
76 BuildRequires:  tar >= 1:1.22
77 BuildRequires:  texinfo
78 BuildRequires:  xmlto
79 BuildRequires:  xz
80 BuildRequires:  zlib-devel
81 BuildRequires:  zstd-devel
82 %if %{with static}
83 BuildRequires:  bzip2-static
84 BuildRequires:  glibc-static
85 BuildRequires:  libxml2-static
86 BuildRequires:  ncurses-static
87 BuildRequires:  openssl-static
88 BuildRequires:  pcre-static
89 BuildRequires:  popt-static
90 BuildRequires:  readline-static
91 BuildRequires:  rpm-static
92 BuildRequires:  zlib-static
93 BuildRequires:  zstd-static
94 %endif
95 Requires(postun):       awk
96 Requires(postun):       sed >= 4.0
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 %patch15 -p1
236 %patch16 -p1
237 %patch17 -p1
238 %patch18 -p1
239
240 %{__rm} doc/poldek.info
241 %{__rm} m4/libtool.m4 m4/lt*.m4
242
243 # cleanup backups after patching
244 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
245 chmod u+x ./configure ./doc/conf-xml2.sh
246
247 %build
248 %{__gettextize}
249 %{__libtoolize}
250 %{__aclocal} -I m4
251 %{__autoheader}
252 %{__autoconf}
253 %{__automake}
254 cd tndb
255 %{__libtoolize}
256 %{__aclocal}
257 %{__autoheader}
258 %{__autoconf}
259 %{__automake}
260 cd ../trurlib
261 %{__libtoolize}
262 %{__aclocal}
263 %{__autoheader}
264 %{__autoconf}
265 %{__automake}
266 cd ..
267
268 %configure \
269         %{?with_static:--enable-static --disable-shared} \
270         %{!?with_imode:--disable-imode} \
271         --with-pkglibdir=%{pkglibexecdir} \
272         --enable-nls \
273         %{?with_python:--with-python}
274 %{__make}
275
276 %{__make} -C doc poldek.info
277
278 %if %{with python}
279 %{__make} -C python
280 %endif
281
282 %if %{with tests}
283 %{__make} check
284 %endif
285
286 %install
287 rm -rf $RPM_BUILD_ROOT
288 install -d $RPM_BUILD_ROOT/var/cache/%{name}
289
290 %{__make} install \
291         DESTDIR=$RPM_BUILD_ROOT
292
293 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}/poldek-config
294
295 %if %{with python}
296 %{__make} -C python install \
297         DESTDIR=$RPM_BUILD_ROOT \
298         py_sitedir=%{py_sitedir}
299 %endif
300
301 %{?with_static:%{__rm} $RPM_BUILD_ROOT%{_bindir}/rpmvercmp}
302
303 %ifarch i686 aarch64 %{arm}
304         %define         ftp_arch        %{_target_cpu}
305 %endif
306 %ifarch %{x8664}
307         %define         ftp_arch        x86_64
308         %define         ftp_alt_arch    i686
309 %endif
310
311 %define tld_conf %{SOURCE1}
312
313 %ifarch %{x8664}
314         %define         tld_multilib_conf       %{SOURCE2}
315 %endif
316
317 %define tld_debuginfo_conf %{SOURCE3}
318
319 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{tld_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld.conf
320
321 %if 0%{?tld_multilib_conf:1}
322         %{__sed} 's|%%ARCH%%|%{ftp_alt_arch}|g' < %{tld_multilib_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
323 %endif
324
325 %{__sed} -e 's|%%ARCH%%|%{ftp_arch}|g' < %{tld_debuginfo_conf} > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/repos.d/tld-debuginfo.conf
326
327 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cli.conf
328
329 %if %{with imode}
330 # add desktop file and icon
331 install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir}}
332 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
333 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{_pixmapsdir}/%{name}.png
334 %endif
335
336 # sources we don't package
337 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{rh,fedora,centos}-source.conf
338 # include them in %doc
339 %{__rm} -rf configs
340 cp -a conf configs
341 %{__rm} -f configs/Makefile*
342
343 %if %{with python}
344 %py_postclean
345 %{__rm} $RPM_BUILD_ROOT%{_libdir}/_poldekmod.{la,so}
346 %endif
347
348
349 %find_lang %{name}
350
351 %clean
352 rm -rf $RPM_BUILD_ROOT
353
354 %post
355 [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
356 if [ "$1" = "1" ]; then
357         # remove ignore = vserver-packages inside vserver on first install
358         {
359                 while read f ctx; do
360                         [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
361                 done </proc/self/status
362         } 2>/dev/null
363         if [ -z "$ctx" -o "$ctx" = "0" ]; then
364                 VSERVER=no
365         else
366                 VSERVER=yes
367         fi
368         if [ "$VSERVER" = "yes" ]; then
369                 %{__sed} -i -e '/^ignore/s/vserver-packages//' %{_sysconfdir}/%{name}/poldek.conf
370         fi
371 fi
372
373 %postun -p      /sbin/postshell
374 -/usr/sbin/fix-info-dir -c %{_infodir}
375
376 %post   libs -p /sbin/ldconfig
377 %postun libs -p /sbin/ldconfig
378
379 %triggerpostun -- poldek < 0.30-0.20080225.00.1
380 if ! grep -q '^%%includedir repos.d' %{_sysconfdir}/%{name}/poldek.conf; then
381         %{__sed} -i -e '/^%%include source.conf/{
382                 a
383                 a# /etc/poldek/repos.d/*.conf
384                 a%%includedir repos.d
385         }' %{_sysconfdir}/%{name}/poldek.conf
386 fi
387
388 %{__sed} -i -e '/%%include %%{_distro}-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
389 %{__sed} -i -e '/%%include %%{_distro}-multilib-source.conf/d' %{_sysconfdir}/%{name}/poldek.conf
390
391 if [ -f %{_sysconfdir}/%{name}/tld-source.conf.rpmsave ]; then
392         %{__mv} -f %{_sysconfdir}/%{name}/repos.d/tld.conf{,.rpmnew}
393         %{__mv} -v %{_sysconfdir}/%{name}/tld-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld.conf
394 fi
395
396 %ifarch %{x8664}
397 if [ -f %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave ]; then
398         %{__mv} -f %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf{,.rpmnew}
399         %{__mv} -v %{_sysconfdir}/%{name}/tld-multilib-source.conf.rpmsave %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
400 fi
401 %endif
402
403 %triggerpostun -- %{name} < 0.30.1-8
404 if [ $1 -le 1 ]; then
405         # revert change on  --downgrade
406         %{__sed} -i -re 's,^pm command = %{pkglibexecdir}/pm-command.sh,#&,' %{_sysconfdir}/%{name}/%{name}.conf
407 else
408         # setup pm command
409         %{__sed} -i -re 's,#?(pm command =).*,\1 %{pkglibexecdir}/pm-command.sh,' %{_sysconfdir}/%{name}/%{name}.conf
410 fi
411
412 %files -f %{name}.lang
413 %defattr(644,root,root,755)
414 %doc ChangeLog README* NEWS configs
415 %dir %{_sysconfdir}/%{name}
416 %dir %{_sysconfdir}/%{name}/pre-install.d
417 %{_sysconfdir}/%{name}/pre-install.d/README
418 %dir %{_sysconfdir}/%{name}/post-install.d
419 %{_sysconfdir}/%{name}/post-install.d/README
420 %dir %{_sysconfdir}/%{name}/repos.d
421 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/cli.conf
422 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/fetch.conf
423 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/poldek.conf
424 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/source.conf
425 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/tld.conf
426 %if 0%{?tld_multilib_conf:1}
427 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/tld-multilib.conf
428 %endif
429 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/repos.d/tld-debuginfo.conf
430 %attr(755,root,root) %{_bindir}/ipoldek
431 %attr(755,root,root) %{_bindir}/poldek
432 %attr(755,root,root) %{_bindir}/poldek-config
433 %attr(755,root,root) %{_bindir}/rpmvercmp
434 %dir %{pkglibexecdir}
435 %attr(755,root,root) %{pkglibexecdir}/pm-command.sh
436 %attr(755,root,root) %{pkglibexecdir}/poldekuser-setup.sh
437 %attr(755,root,root) %{pkglibexecdir}/vfcompr
438 %attr(755,root,root) %{pkglibexecdir}/vfjuggle
439 %attr(755,root,root) %{pkglibexecdir}/vfsmb
440 %attr(755,root,root) %{pkglibexecdir}/zlib-in-rpm.sh
441 %{_mandir}/man1/%{name}*.1*
442 %lang(pl) %{_mandir}/pl/man1/%{name}*
443 %{_infodir}/poldek.info*
444 %if %{with imode}
445 %{_desktopdir}/%{name}.desktop
446 %{_pixmapsdir}/%{name}.png
447 %endif
448 %dir /var/cache/%{name}
449
450 %if %{without static}
451 %files libs
452 %defattr(644,root,root,755)
453 %attr(755,root,root) %{_libdir}/libpoclidek.so.*.*.*
454 %attr(755,root,root) %{_libdir}/libpoldek.so.*.*.*
455 %attr(755,root,root) %{_libdir}/libtndb.so.*.*.*
456 %attr(755,root,root) %{_libdir}/libtrurl.so.*.*.*
457 %attr(755,root,root) %{_libdir}/libvfile.so.*.*.*
458 %attr(755,root,root) %ghost %{_libdir}/libpoclidek.so.1
459 %attr(755,root,root) %ghost %{_libdir}/libpoldek.so.3
460 %attr(755,root,root) %ghost %{_libdir}/libtndb.so.0
461 %attr(755,root,root) %ghost %{_libdir}/libtrurl.so.0
462 %attr(755,root,root) %ghost %{_libdir}/libvfile.so.0
463 %endif
464
465 %files devel
466 %defattr(644,root,root,755)
467 %if %{without static}
468 %attr(755,root,root) %{_libdir}/libpoclidek.so
469 %attr(755,root,root) %{_libdir}/libpoldek.so
470 %attr(755,root,root) %{_libdir}/libtndb.so
471 %attr(755,root,root) %{_libdir}/libtrurl.so
472 %attr(755,root,root) %{_libdir}/libvfile.so
473 %endif
474 %{_libdir}/libpoclidek.la
475 %{_libdir}/libpoldek.la
476 %{_libdir}/libtndb.la
477 %{_libdir}/libtrurl.la
478 %{_libdir}/libvfile.la
479 %{_includedir}/poldek
480 %{_includedir}/tndb
481 %{_includedir}/trurl
482 %{_includedir}/vfile
483 %{_pkgconfigdir}/tndb.pc
484 %{_pkgconfigdir}/trurlib.pc
485
486 %files static
487 %defattr(644,root,root,755)
488 %{_libdir}/libtndb.a
489 %{_libdir}/libtrurl.a
490
491 %if %{with python}
492 %files -n python-poldek
493 %defattr(644,root,root,755)
494 %attr(755,root,root) %{py_sitedir}/_poldekmod.so
495 %{py_sitescriptdir}/poldek.py[co]
496 %{py_sitescriptdir}/poldekmod.py[co]
497 %endif