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