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