]> git.pld-linux.org Git - packages/lvm2.git/blob - lvm2.spec
- rel 2
[packages/lvm2.git] / lvm2.spec
1 # TODO
2 # - vgscan --ignorelocking failure creates /var/lock/lvm (even if /var is not yet mounted)
3 # - Installed (but unpackaged) file(s) found:
4 #   /etc/rc.d/init.d/clvmd
5 # - --with-replicators (=internal/shared/none, default is none)?
6 # - OCF agents?
7 #
8 # Conditional build:
9 %bcond_without  initrd          # don't build initrd version
10 %bcond_without  uClibc          # link initrd version with uClibc
11 %bcond_with     dietlibc        # link initrd version with dietlibc
12 %bcond_with     glibc           # link initrd version with static GLIBC
13 %bcond_without  clvmd           # don't build clvmd
14 %bcond_with     clvmd3          # build clvmd for 3rd generation of cluster
15 %bcond_with     openais         # enable corosync&openais managers and cmirrord
16 %bcond_without  selinux         # disable SELinux
17
18 %ifarch sparc64 sparc
19 %define         with_glibc 1
20 %endif
21
22 # if one of the *libc is enabled disable default dietlibc
23 %if %{with dietlibc} && %{with uClibc}
24 %undefine       with_dietlibc
25 %endif
26
27 # with glibc disables default dietlibc
28 %if %{with glibc} && %{with dietlibc}
29 %undefine       with_dietlibc
30 %endif
31
32 # fallback is glibc if neither alternatives are enabled
33 %if %{without dietlibc} && %{without uClibc}
34 %define         with_glibc      1
35 %endif
36
37 %if %{with clvmd3}
38 %undefine       with_clvmd
39 %endif
40
41 Summary:        The new version of Logical Volume Manager for Linux
42 Summary(pl.UTF-8):      Nowa wersja Logical Volume Managera dla Linuksa
43 Name:           lvm2
44 Version:        2.02.95
45 Release:        2
46 License:        GPL v2
47 Group:          Applications/System
48 Source0:        ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz
49 # Source0-md5:  bd470a802046c807603618a443732ea7
50 Source1:        %{name}-initramfs-hook
51 Source2:        %{name}-initramfs-local-top
52 Source3:        %{name}-tmpfiles.conf
53 Patch0:         %{name}-selinux.patch
54 Patch1:         %{name}-diet.patch
55 Patch2:         device-mapper-dmsetup-export.patch
56 Patch3:         %{name}-clvmd_init.patch
57 Patch4:         dl-dlsym.patch
58 Patch5:         pldize_lvm2_monitor.patch
59 Patch6:         %{name}-wrapper.patch
60 URL:            http://sources.redhat.com/lvm2/
61 BuildRequires:  autoconf >= 2.61
62 BuildRequires:  automake
63 %{?with_selinux:BuildRequires:  libselinux-devel >= 1.10}
64 %{?with_selinux:BuildRequires:  libsepol-devel}
65 BuildRequires:  ncurses-devel
66 BuildRequires:  pkgconfig
67 BuildRequires:  readline-devel
68 BuildRequires:  rpmbuild(macros) >= 1.647
69 BuildRequires:  udev-devel >= 143
70 %if %{with initrd}
71 %if %{with dietlibc}
72 BuildRequires:  dietlibc-static >= 2:0.32-7
73 BuildConflicts: device-mapper-dietlibc
74 %endif
75 %if %{with glibc}
76 %{?with_selinux:BuildRequires:  libselinux-static}
77 %{?with_selinux:BuildRequires:  libsepol-static}
78 %endif
79 %{?with_glibc:BuildRequires:    glibc-static}
80 %{?with_uClibc:BuildRequires:   uClibc-static >= 2:0.9.29}
81 %endif
82 %if %{with clvmd}
83 BuildRequires:  cman-devel >= 1.0
84 BuildRequires:  dlm-devel >= 1.0-0.pre21.2
85 %endif
86 %if %{with clvmd3}
87 BuildRequires:  cluster-cman-devel
88 BuildRequires:  cluster-dlm-devel
89 %endif
90 %if %{with openais}
91 BuildRequires:  corosync-devel
92 BuildRequires:  openais-devel >= 1.0
93 %endif
94 Requires(post,preun,postun):    systemd-units >= 38
95 Requires:       device-mapper >= %{version}-%{release}
96 %if %{with clvmd}
97 Requires:       cman-libs >= 1.0
98 Requires:       dlm >= 1.0-0.pre21.2
99 %endif
100 %if %{with clvmd3}
101 Requires:       cluster-cman-libs
102 Requires:       cluster-dlm
103 %endif
104 %{?with_selinux:Requires:       libselinux >= 1.10}
105 Requires:       systemd-units >= 38
106 # doesn't work with 2.4 kernels
107 Requires:       uname(release) >= 2.6
108 Obsoletes:      lvm
109 Obsoletes:      lvm2-systemd
110 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
111
112 %define         _sbindir        /sbin
113 %define         _usrsbindir     /usr/sbin
114
115 # changing CFLAGS in the middle confuses confcache
116 %undefine       configure_cache
117
118 # borken on AC
119 %define         filterout_ld    -Wl,--as-needed
120
121 # for some reason known only to rpm there must be "\\|" not "\|" here
122 %define         dietarch        %(echo %{_target_cpu} | sed -e 's/i.86\\|pentium.\\|athlon/i386/;s/amd64/x86_64/;s/armv.*/arm/')
123 %define         dietlibdir      %{_prefix}/lib/dietlibc/lib-%{dietarch}
124
125 %define         skip_post_check_so      '.*libdevmapper-event-lvm2.so.*'
126
127 %description
128 This package includes a number of utilities for creating, checking,
129 and repairing logical volumes.
130
131 %description -l pl.UTF-8
132 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
133 logicznych wolumenów dyskowych (LVM2).
134
135 %package initrd
136 Summary:        The new version of Logical Volume Manager for Linux - initrd version
137 Summary(pl.UTF-8):      Nowa wersja Logical Volume Managera dla Linuksa - wersja dla initrd
138 Group:          Base
139 Conflicts:      geninitrd < 10000.18
140
141 %description initrd
142 This package includes a number of utilities for creating, checking,
143 and repairing logical volumes - staticaly linked for initrd.
144
145 %description initrd -l pl.UTF-8
146 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
147 logicznych wolumenów dyskowych (LVM2) - statycznie skonsolidowane na
148 potrzeby initrd.
149
150 %package -n device-mapper
151 Summary:        Userspace support for the device-mapper
152 Summary(pl.UTF-8):      Wsparcie dla mapowania urządzeń w przestrzeni użytkownika
153 Group:          Base
154 Requires(post,preun,postun):    systemd-units >= 38
155 Requires:       systemd-units >= 38
156
157 %description -n device-mapper
158 The goal of this driver is to support volume management. The driver
159 enables the definition of new block devices composed of ranges of
160 sectors of existing devices. This can be used to define disk
161 partitions - or logical volumes. This light-weight kernel component
162 can support user-space tools for logical volume management.
163
164 %description -n device-mapper -l pl.UTF-8
165 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
166 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
167 sektorów na istniejących urządzeniach. Może to być wykorzystane do
168 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
169 składnik jądra może wspierać działające w przestrzeni użytkownika
170 narzędzia do zarządzania logicznymi wolumenami.
171
172 %package -n device-mapper-devel
173 Summary:        Header files and development documentation for %{name}
174 Summary(pl.UTF-8):      Pliki nagłówkowe i dokumentacja do %{name}
175 Group:          Development/Libraries
176 Requires:       device-mapper = %{version}-%{release}
177 %if %{with selinux}
178 Requires:       libselinux-devel
179 Requires:       libsepol-devel
180 %endif
181
182 %description -n device-mapper-devel
183 Header files and development documentation for %{name}.
184
185 %description -n device-mapper-devel -l pl.UTF-8
186 Pliki nagłówkowe i dokumentacja do %{name}.
187
188 %package -n device-mapper-static
189 Summary:        Static devmapper library
190 Summary(pl.UTF-8):      Statyczna biblioteka devmapper
191 License:        LGPL v2.1
192 Group:          Development/Libraries
193 Requires:       device-mapper-devel = %{version}-%{release}
194
195 %description -n device-mapper-static
196 Static devmapper library.
197
198 %description -n device-mapper-static -l pl.UTF-8
199 Statyczna biblioteka devmapper.
200
201 %package -n device-mapper-dietlibc
202 Summary:        Static devmapper library built with dietlibc
203 Summary(pl.UTF-8):      Statyczna biblioteka devmapper zbudowana z dietlibc
204 License:        LGPL v2.1
205 Group:          Development/Libraries
206 Requires:       device-mapper-devel = %{version}-%{release}
207
208 %description -n device-mapper-dietlibc
209 Static devmapper library built with dietlibc.
210
211 %description -n device-mapper-dietlibc -l pl.UTF-8
212 Statyczna biblioteka devmapper zbudowana z dietlibc.
213
214 %package -n device-mapper-initrd
215 Summary:        Userspace support for the device-mapper - initrd version
216 Summary(pl.UTF-8):      Wsparcie dla mapowania urządzeń w przestrzeni użytkownika - wersja dla initrd
217 Group:          Base
218 Obsoletes:      device-mapper-initrd-devel
219 Conflicts:      geninitrd < 10000.10
220
221 %description -n device-mapper-initrd
222 The goal of this driver is to support volume management. The driver
223 enables the definition of new block devices composed of ranges of
224 sectors of existing devices. This can be used to define disk
225 partitions - or logical volumes. This light-weight kernel component
226 can support user-space tools for logical volume management.
227
228 This package contains dmsetup program linked staticaly for use in
229 initrd.
230
231 %description -n device-mapper-initrd -l pl.UTF-8
232 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
233 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
234 sektorów na istniejących urządzeniach. Może to być wykorzystane do
235 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
236 składnik jądra może wspierać działające w przestrzeni użytkownika
237 narzędzia do zarządzania logicznymi wolumenami.
238
239 Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
240 potrzeby initrd.
241
242 %package initramfs
243 Summary:        The new version of Logical Volume Manager for Linux - support scripts for initramfs-tools
244 Summary(pl.UTF-8):      Nowa wersja Logical Volume Managera dla Linuksa - skrypty dla initramfs-tools
245 Group:          Base
246 Requires:       %{name} = %{version}-%{release}
247 Requires:       initramfs-tools
248
249 %description initramfs
250 The new version of Logical Volume Manager for Linux - support scripts
251 for initramfs-tools.
252
253 %description initramfs -l pl.UTF-8
254 Nowa wersja Logical Volume Managera dla Linuksa - skrypty dla
255 initramfs-tools.
256
257 %prep
258 %setup -q -n LVM2.%{version}
259 %{?with_selinux:%patch0 -p1}
260 %patch1 -p1
261 %patch2 -p1
262 %patch3 -p1
263 %patch4 -p1
264 %patch5 -p1
265 %patch6 -p1
266
267 # do not force --export-symbol linker option for e.g. statically linked executables
268 # -rdynamic compiler option drives linker in the right way.
269 %{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
270
271 %build
272 %if %{with initrd}
273 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
274 %endif
275 cp -f /usr/share/automake/config.sub autoconf
276 %{__aclocal}
277 %{__autoconf}
278
279 %if %{with initrd}
280 %{?with_glibc:export CC="%{__cc}"}
281 %{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
282 %{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
283
284 %configure \
285         ac_cv_lib_dl_dlopen=no \
286         %{?with_uClibc:ac_cv_func_siginterrupt=no} \
287         %{?debug:--enable-debug} \
288         --with-optimisation="%{rpmcflags} -Os" \
289         --enable-static_link \
290         --with-lvm1=internal \
291         --disable-selinux \
292         --%{?with_glibc:en}%{!?with_glibc:dis}able-selinux \
293         --disable-readline \
294         --disable-nls
295 # glibc version links with normal static libdevicemapper which has selinux enabled
296 # and we need to keep these in sync between device-mapper and lvm2
297
298 %{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
299 %{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
300
301 %{__make} -j1 -C include
302 %{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
303 %{__make} -j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=
304 %{__make} -j1 -C tools dmsetup.static lvm.static %{?with_dietlibc:DIETLIBC_LIBS="-lcompat"}
305 mv -f tools/lvm.static initrd-lvm
306 mv -f tools/dmsetup.static initrd-dmsetup
307
308 # check if tools works
309 for tool in initrd-lvm initrd-dmsetup; do
310         LVM_SYSTEM_DIR=$(pwd) ./$tool help && rc=$? || rc=$?
311         if [ $rc -gt 127 ]; then
312                 echo >&2 "Unexpected failure (exit status: $rc) from $tool. Does this tool work?!"
313                 exit 1
314         fi
315 done
316
317
318 %{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
319 %{__make} clean
320
321 unset CC
322 %endif
323
324 %configure \
325         --with-usrlibdir=%{_libdir} \
326         %{?debug:--enable-debug} \
327         --with-optimisation="%{rpmcflags}" \
328         --enable-readline \
329         --enable-fsadm \
330         --enable-applib \
331         --enable-cmdlib \
332         --enable-lvmetad \
333         %{?with_openais:--enable-cmirrord} \
334         --enable-dmeventd \
335         --with-dmeventd-path=%{_sbindir}/dmeventd \
336         --enable-pkgconfig \
337         --enable-udev_sync \
338         --enable-udev_rules \
339         %{?with_clvmd:--with-clvmd=cman%{?with_openais:,corosync,openais}} \
340         --with-lvm1=internal \
341         --with-pool=internal \
342         --with-cluster=internal \
343         --with-snapshots=internal \
344         --with-mirrors=internal \
345         --with-thin=internal \
346         --with-interface=ioctl \
347         --with-udev-prefix=/ \
348         --with-systemd_dir=%{systemdunitdir} \
349         %{!?with_selinux:--disable-selinux}
350
351 %{__make} -j1
352 %{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
353
354 %install
355 rm -rf $RPM_BUILD_ROOT
356 install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm} \
357         $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/{hooks,scripts/local-top}
358 %{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
359
360 %{__make} install install_system_dirs install_systemd_units install_initscripts \
361         DESTDIR=$RPM_BUILD_ROOT \
362         OWNER="" \
363         GROUP=""
364
365 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
366 install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
367
368 mv $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
369 for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
370         lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
371         slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
372         ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
373 done
374
375 touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
376
377 %if %{with initrd}
378 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
379 install -p initrd-lvm $RPM_BUILD_ROOT%{_libdir}/initrd/lvm
380 install -p initrd-dmsetup $RPM_BUILD_ROOT%{_libdir}/initrd/dmsetup
381
382 %{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
383 %endif
384
385 install -p %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/hooks/lvm2
386 install -p %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/scripts/local-top/lvm2
387
388 cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
389
390 %clean
391 rm -rf $RPM_BUILD_ROOT
392
393 %post
394 /sbin/chkconfig --add lvm2-monitor
395 %service lvm2-monitor restart
396 %systemd_post lvm2-monitor.service
397
398 %preun
399 %systemd_preun lvm2-monitor.service
400
401 %postun
402 if [ "$1" = "0" ]; then
403         %service lvm2-monitor stop
404         /sbin/chkconfig --del lvm2-monitor
405 fi
406 %systemd_reload
407
408 %triggerpostun -- %{name} < 2.02.94-1
409 %systemd_trigger lvm2-monitor.service
410
411 %post -n device-mapper
412 /sbin/ldconfig
413 %systemd_post dm-event.socket
414
415 %preun -n device-mapper
416 %systemd_preun dm-event.socket dm-event.service
417
418 %postun -n device-mapper
419 /sbin/ldconfig
420 %systemd_reload
421
422 %triggerpostun -n device-mapper -- device-mapper < 2.02.94-1
423 %systemd_trigger dm-event.socket
424
425 %files
426 %defattr(644,root,root,755)
427 %doc README WHATS_NEW doc/*
428 %attr(755,root,root) %{_sbindir}/fsadm
429 %attr(755,root,root) %{_sbindir}/lv*
430 %attr(755,root,root) %{_sbindir}/pv*
431 %attr(755,root,root) %{_sbindir}/vg*
432 %{?with_clvmd:%attr(755,root,root) %{_usrsbindir}/clvmd}
433 %{_mandir}/man5/lvm.conf.5*
434 %{?with_clvmd:%{_mandir}/man8/clvmd.8*}
435 %{_mandir}/man8/fsadm.8*
436 %{_mandir}/man8/lv*.8*
437 %{_mandir}/man8/pv*.8*
438 %{_mandir}/man8/vg*.8*
439 %attr(750,root,root) %dir %{_sysconfdir}/lvm
440 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
441 %{_sysconfdir}/tmpfiles.d/lvm2.conf
442 %{systemdunitdir}/lvm2-monitor.service
443 %dir %{_sysconfdir}/lvm/cache
444 %ghost %{_sysconfdir}/lvm/cache/.cache
445 %attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
446 %{?with_clvmd:%attr(754,root,root) /etc/rc.d/init.d/clvmd}
447
448 %files -n device-mapper
449 %defattr(644,root,root,755)
450 %doc *_DM
451 %{systemdunitdir}/dm-event.service
452 %{systemdunitdir}/dm-event.socket
453 /lib/udev/rules.d/10-dm.rules
454 /lib/udev/rules.d/11-dm-lvm.rules
455 /lib/udev/rules.d/13-dm-disk.rules
456 /lib/udev/rules.d/95-dm-notify.rules
457 %attr(755,root,root) %{_sbindir}/dmeventd
458 %attr(755,root,root) %{_sbindir}/dmsetup
459 %attr(755,root,root) /%{_lib}/libdevmapper*.so.*.*
460 %attr(755,root,root) /%{_lib}/liblvm2app.so.*.*
461 %attr(755,root,root) /%{_lib}/liblvm2cmd.so.*.*
462 %dir %{_libdir}/device-mapper
463 %attr(755,root,root) %{_libdir}/device-mapper/*.so
464 %attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
465 %{_mandir}/man8/dmsetup.8*
466 %{_mandir}/man8/dmeventd.8*
467
468 %files -n device-mapper-devel
469 %defattr(644,root,root,755)
470 %attr(755,root,root) %{_libdir}/libdevmapper.so
471 %attr(755,root,root) %{_libdir}/libdevmapper-event.so
472 %attr(755,root,root) %{_libdir}/liblvm2app.so
473 %attr(755,root,root) %{_libdir}/liblvm2cmd.so
474 %{_includedir}/libdevmapper*.h
475 %{_includedir}/lvm2app.h
476 %{_includedir}/lvm2cmd.h
477 %{_pkgconfigdir}/devmapper*.pc
478 %{_pkgconfigdir}/lvm2app.pc
479
480 %files -n device-mapper-static
481 %defattr(644,root,root,755)
482 %{_libdir}/libdevmapper*.a
483
484 %if %{with initrd}
485 %if %{with dietlibc}
486 %files -n device-mapper-dietlibc
487 %defattr(644,root,root,755)
488 %{dietlibdir}/libdevmapper.a
489 %endif
490
491 %files -n device-mapper-initrd
492 %defattr(644,root,root,755)
493 %attr(755,root,root) %{_libdir}/initrd/dmsetup
494
495 %files initrd
496 %defattr(644,root,root,755)
497 %attr(755,root,root) %{_libdir}/initrd/lvm
498 %endif
499
500 %files initramfs
501 %defattr(644,root,root,755)
502 %attr(755,root,root) %{_datadir}/initramfs-tools/hooks/lvm2
503 %attr(755,root,root) %{_datadir}/initramfs-tools/scripts/local-top/lvm2
This page took 0.065415 seconds and 3 git commands to generate.