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