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