File libvirt.spec of Package libvirt (Revision 49e7bf3f2a2a7cab1959f8acd58394a6)
Currently displaying revision 49e7bf3f2a2a7cab1959f8acd58394a6, show latest
x
1
#
2
# spec file for package libvirt
3
#
4
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
5
#
6
# All modifications and additions to the file contributed by third parties
7
# remain the property of their copyright owners, unless otherwise agreed
8
# upon. The license for this file, and modifications and additions to the
9
# file, is the same license as for the pristine package itself (unless the
10
# license for the pristine package is not an Open Source License, in which
11
# case the license is the MIT License). An "Open Source License" is a
12
# license that conforms to the Open Source Definition (Version 1.9)
13
# published by the Open Source Initiative.
14
15
# Please submit bugfixes or comments via http://bugs.opensuse.org/
16
#
17
18
# norootforbuild
19
20
# For now, default to a full server + client build
21
%define client_only 0
22
23
# Disable all server side drivers if client only build requested
24
%if %{client_only}
25
%define server_drivers 0
26
%else
27
%define server_drivers 1
28
%endif
29
30
# Now set the defaults for all the important features, independent
31
# of any particular OS
32
33
# First the daemon itself
34
%define with_libvirtd 0%{!?_without_libvirtd:%{server_drivers}}
35
%define with_avahi 0%{!?_without_avahi:%{server_drivers}}
36
37
# Then the hypervisor drivers that run on local host
38
%define with_xen 0%{!?_without_xen:%{server_drivers}}
39
%define with_qemu 0%{!?_without_qemu:%{server_drivers}}
40
%define with_openvz 0%{!?_without_openvz:%{server_drivers}}
41
%define with_lxc 0%{!?_without_lxc:%{server_drivers}}
42
%define with_vbox 0%{!?_without_vbox:%{server_drivers}}
43
%define with_uml 0%{!?_without_uml:%{server_drivers}}
44
%define with_xenapi 0%{!?_without_xenapi:%{server_drivers}}
45
%define with_libxl 0%{!?_without_libxl:%{server_drivers}}
46
47
# Then the hypervisor drivers that talk a native remote protocol
48
%define with_phyp 0%{!?_without_phyp:1}
49
%define with_esx 0%{!?_without_esx:1}
50
%define with_vmware 0%{!?_without_vmware:1}
51
%define with_hyperv 0%{!?_without_hyperv:1}
52
53
# Then the secondary host drivers
54
%define with_network 0%{!?_without_network:%{server_drivers}}
55
%define with_storage_fs 0%{!?_without_storage_fs:%{server_drivers}}
56
%define with_storage_lvm 0%{!?_without_storage_lvm:%{server_drivers}}
57
%define with_storage_iscsi 0%{!?_without_storage_iscsi:%{server_drivers}}
58
%define with_storage_disk 0%{!?_without_storage_disk:%{server_drivers}}
59
%define with_storage_mpath 0%{!?_without_storage_mpath:%{server_drivers}}
60
%define with_numactl 0%{!?_without_numactl:%{server_drivers}}
61
%define with_selinux 0%{!?_without_selinux:%{server_drivers}}
62
%define with_apparmor 0%{!?_without_apparmor:0}
63
64
# A few optional bits off by default, we enable later
65
%define with_polkit 0%{!?_without_polkit:0}
66
%define with_capng 0%{!?_without_capng:0}
67
%define with_netcf 0%{!?_without_netcf:0}
68
%define with_udev 0%{!?_without_udev:0}
69
%define with_hal 0%{!?_without_hal:0}
70
%define with_yajl 0%{!?_without_yajl:0}
71
%define with_nwfilter 0%{!?_without_nwfilter:0}
72
%define with_libpcap 0%{!?_without_libpcap:0}
73
%define with_macvtap 0%{!?_without_macvtap:0}
74
%define with_libnl 0%{!?_without_libnl:0}
75
%define with_audit 0%{!?_without_audit:0}
76
%define with_dtrace 0%{!?_without_dtrace:0}
77
%define with_cgconfig 0%{!?_without_cgconfig:0}
78
79
# Non-server/HV driver defaults which are always enabled
80
%define with_python 0%{!?_without_python:1}
81
%define with_sasl 0%{!?_without_sasl:1}
82
83
# Set the OS / architecture specific special cases
84
85
# Xen is available only on i386 x86_64
86
%ifnarch %ix86 x86_64
87
%define with_xen 0
88
%define with_libxl 0
89
%endif
90
91
# libxenlight driver requires Xen >= 4.1, which is only
92
# available in openSUSE >= 12.1 or SLE >= 11sp2
93
%if 0%{?suse_version} < 1210
94
%define with_libxl 0
95
%endif
96
97
# numactl only on x86_64 and ia64
98
%ifnarch x86_64 ia64
99
%define with_numactl 0
100
%endif
101
102
# SLES doesn't contain OpenVZ, VBox, UML, ESX, VMWare, or Citrix XenAPI
103
%if 0%{?sles_version}
104
%define with_openvz 0
105
%define with_vbox 0
106
%define with_uml 0
107
%define with_esx 1
108
%define with_vmware 1
109
%define with_hyperv 1
110
%define with_xenapi 1
111
%endif
112
113
# Enable phyp driver for IBM Power systems
114
%ifarch ppc64
115
%define with_phyp 1
116
%endif
117
118
# LXC and selinux are not available on anything < openSUSE 11.1
119
%if 0%{?suse_version} < 1110
120
%define with_lxc 0
121
%define with_selinux 0
122
%endif
123
124
# udev is used to manage host devices in 11.1 or newer
125
%if 0%{?suse_version} > 1110
126
%define with_udev 0%{!?_without_udev:%{server_drivers}}
127
%else
128
%define with_hal 0%{!?_without_hal:%{server_drivers}}
129
%endif
130
131
# libcapng is used to manage capabilities in 11.3 or newer.
132
# It is also used by lxc and needs to be enabled if lxc is enabled.
133
%if 0%{?suse_version} >= 1130 || %{with_lxc}
134
%define with_capng 0%{!?_without_capng:1}
135
%endif
136
137
# netcf is used to manage network interfaces in 11.4 or newer
138
%if 0%{?suse_version} >= 1140
139
%define with_netcf 0%{!?_without_netcf:%{server_drivers}}
140
%endif
141
142
# Enable yajl library for JSON mode with QEMU in 11.4 or newer
143
%if 0%{?suse_version} >= 1140
144
%define with_yajl 0%{!?_without_yajl:%{server_drivers}}
145
%endif
146
147
# Enable libpcap library
148
%if %{with_qemu}
149
%if 0%{?suse_version} >= 1140
150
%define with_nwfilter 0%{!?_without_nwfilter:%{server_drivers}}
151
%define with_libpcap 0%{!?_without_libpcap:%{server_drivers}}
152
%define with_macvtap 0%{!?_without_macvtap:%{server_drivers}}
153
%endif
154
%endif
155
156
%if %{with_macvtap}
157
%define with_libnl 1
158
%endif
159
160
# there's no use compiling the network driver without
161
# the libvirt daemon
162
%if ! %{with_libvirtd}
163
%define with_network 0
164
%endif
165
166
BuildRequires: python-devel
167
BuildRequires: libxml2-devel
168
BuildRequires: xhtml-dtd
169
BuildRequires: libxslt
170
BuildRequires: readline-devel
171
BuildRequires: ncurses-devel
172
BuildRequires: gettext
173
BuildRequires: gnutls-devel
174
BuildRequires: bridge-utils
175
BuildRequires: fdupes
176
BuildRequires: pkg-config
177
BuildRequires: python-xml
178
# Only for directory ownership:
179
BuildRequires: gtk-doc
180
%if %{with_xen} || %{with_libxl}
181
BuildRequires: xen-devel
182
%endif
183
%if %{with_sasl}
184
BuildRequires: cyrus-sasl-devel
185
%endif
186
%if %{with_hal}
187
BuildRequires: hal-devel
188
%endif
189
%if %{with_udev}
190
BuildRequires: libudev-devel >= 145
191
BuildRequires: libpciaccess0-devel >= 0.10.9
192
%endif
193
%if %{with_avahi}
194
%if 0%{?suse_version} > 1030
195
BuildRequires: libavahi-devel
196
%else
197
BuildRequires: avahi-devel
198
%endif
199
%endif
200
%if %{with_selinux}
201
BuildRequires: libselinux-devel
202
%endif
203
%if %{with_apparmor}
204
BuildRequires: libapparmor-devel
205
%endif
206
%if %{with_numactl}
207
BuildRequires: libnuma-devel
208
%endif
209
%if %{with_polkit}
210
%if 0%{?suse_version} > 1110
211
BuildRequires: polkit >= 0.9
212
%else
213
BuildRequires: PolicyKit-devel >= 0.6
214
%endif
215
%endif
216
%if %{with_phyp}
217
BuildRequires: libssh2-devel >= 1.0
218
Requires: libssh2-1 >= 1.0
219
%endif
220
%if %{with_yajl}
221
BuildRequires: libyajl-devel
222
%endif
223
%if %{with_macvtap}
224
BuildRequires: libnl-devel
225
%endif
226
%if %{with_esx}
227
BuildRequires: libcurl-devel
228
%endif
229
%if %{with_hyperv}
230
BuildRequires: libwsman-devel
231
%endif
232
%if %{with_capng}
233
BuildRequires: libcap-ng-devel >= 0.5.0
234
%endif
235
%if %{with_netcf}
236
BuildRequires: netcf-devel >= 0.1.4
237
%endif
238
%if %{with_network}
239
BuildRequires: dnsmasq >= 2.41
240
BuildRequires: iptables-devel
241
BuildRequires: radvd
242
%endif
243
%if %{with_nwfilter}
244
BuildRequires: ebtables
245
%endif
246
%if %{with_libpcap}
247
BuildRequires: libpcap-devel
248
%endif
249
%if %{with_libnl}
250
BuildRequires: libnl-devel
251
%endif
252
%if %{with_storage_fs}
253
# For mount/umount in FS driver
254
BuildRequires: util-linux
255
%endif
256
%if %{with_storage_lvm}
257
# For LVM drivers
258
BuildRequires: lvm2
259
%endif
260
%if %{with_storage_iscsi}
261
# For ISCSI driver
262
BuildRequires: open-iscsi
263
%endif
264
%if %{with_storage_disk}
265
# For disk driver
266
BuildRequires: parted-devel
267
%endif
268
%if %{with_storage_mpath}
269
# For Multipath support
270
BuildRequires: device-mapper-devel
271
%endif
272
273
Name: libvirt
274
Url: http://libvirt.org/
275
License: LGPLv2.1+
276
Group: Development/Libraries/C and C++
277
AutoReqProv: yes
278
Version: 0.9.13
279
Release: 1
280
Summary: A C toolkit to interract with the virtualization capabilities of Linux
281
282
# The client side, i.e. shared libs and virsh are in a subpackage
283
Requires: %{name}-client = %{version}-%{release}
284
Requires: virt-utils
285
# Used by many of the drivers, so turn it on whenever the
286
# daemon is present
287
%if %{with_libvirtd}
288
Recommends: bridge-utils
289
# for modprobe of pci devices
290
Requires: module-init-tools
291
# for /sbin/ip
292
Requires: iproute
293
%endif
294
%if %{with_network}
295
Recommends: dnsmasq >= 2.41
296
Recommends: radvd
297
%endif
298
%if %{with_network} || %{with_nwfilter}
299
Recommends: iptables
300
%endif
301
%if %{with_nwfilter}
302
Recommends: ebtables
303
%endif
304
Recommends: logrotate
305
Recommends: nfs-client
306
%if %{with_hal}
307
Requires: hal
308
%endif
309
Requires: /usr/sbin/dmidecode
310
%if %{with_udev}
311
Requires: udev >= 145
312
%endif
313
%if %{with_polkit}
314
%if 0%{?suse_version} > 1110
315
Recommends: polkit >= 0.9
316
%else
317
Recommends: PolicyKit >= 0.6
318
%endif
319
%endif
320
%if %{with_storage_fs}
321
Recommends: nfs-utils
322
%endif
323
%if %{with_storage_lvm}
324
# For LVM drivers
325
Recommends: lvm2
326
%endif
327
%if %{with_storage_iscsi}
328
# For ISCSI driver
329
Recommends: open-iscsi
330
%endif
331
%if %{with_storage_disk}
332
# For disk driver
333
Recommends: parted
334
Recommends: device-mapper
335
%endif
336
%if %{with_storage_mpath}
337
# For multipath support
338
Recommends: device-mapper
339
%endif
340
341
Source0: %{name}-%{version}.tar.bz2
342
Source1: libvirtd.init
343
# Upstream patches
344
# Need to go upstream
345
Patch100: xen-name-for-devid.patch
346
Patch101: clone-0.9.10.patch
347
Patch102: xen-pv-cdrom.patch
348
# Our patches
349
Patch200: libvirtd-defaults-0.9.12.patch
350
Patch201: use-init-script-redhat-0.9.12.patch
351
352
BuildRoot: %{_tmppath}/%{name}-%{version}-build
353
354
%description
355
Libvirt is a C toolkit to interact with the virtualization
356
capabilities of Linux. Virtualization of the Linux Operating System means
357
the ability to run multiple instances of Operating Systems concurrently
358
on a single hardware system where the basic resources are driven by a
359
Linux instance. The library aims to provide long term stable C API
360
to interact with Linux virtualization technologies.
361
362
363
364
Authors:
365
--------
366
Daniel Veillard <veillard@redhat.com>
367
Karel Zak <kzak@redhat.com>
368
369
%package client
370
License: LGPLv2.1+
371
Summary: Client side library and utilities of the libvirt library
372
Group: Development/Libraries/C and C++
373
Requires: readline
374
Requires: ncurses
375
# Needed by libvirt-guests init script.
376
Requires: gettext
377
Requires: cyrus-sasl
378
Recommends: cyrus-sasl-digestmd5
379
# So remote clients can access libvirt over SSH tunnel
380
# (client invokes 'nc' against the UNIX socket on the server)
381
Recommends: netcat-openbsd
382
383
%description client
384
Libvirt is a C toolkit to interract with the virtualization
385
capabilities of Linux. The libvirt-client package contains shared
386
libraries and client binaries needed to access the virtualization
387
capabilities of recent versions of Linux (and other OSes).
388
389
390
391
Authors:
392
--------
393
Daniel Veillard <veillard@redhat.com>
394
Karel Zak <kzak@redhat.com>
395
396
%package devel
397
License: LGPLv2.1+
398
Summary: A C toolkit to interract with the virtualization capabilities of Linux
399
Group: Development/Libraries/C and C++
400
Requires: %{name}-client = %{version}-%{release} libxml2-devel
401
Requires: pkg-config
402
%if %{with_xen} || %{with_libxl}
403
Requires: xen-devel
404
%endif
405
406
%description devel
407
Libvirt is a C toolkit to interract with the virtualization
408
capabilities of Linux. The libvirt-devel package contains headers
409
and libraries needed for developing libvirt applications.
410
411
412
413
Authors:
414
--------
415
Daniel Veillard <veillard@redhat.com>
416
Karel Zak <kzak@redhat.com>
417
418
%package doc
419
License: LGPLv2.1+
420
Summary: A C toolkit to interract with the virtualization capabilities of Linux
421
Group: Development/Libraries/C and C++
422
Requires: %{name}-client = %{version}-%{release}
423
424
%description doc
425
Libvirt is a C toolkit to interract with the virtualization
426
capabilities of Linux. The libvirt-doc packages contains documentation
427
for the libvirt API and tools.
428
429
430
431
Authors:
432
--------
433
Daniel Veillard <veillard@redhat.com>
434
Karel Zak <kzak@redhat.com>
435
436
%if %{with_python}
437
438
%package python
439
License: LGPLv2.1+
440
Summary: A C toolkit to interract with the virtualization capabilities of Linux
441
Group: Development/Libraries/C and C++
442
Requires: %{name}-client = %{version}-%{release}
443
%py_requires
444
445
%description python
446
Libvirt is a C toolkit to interract with the virtualization
447
capabilities of Linux. The libvirt-python package provides python
448
bindings for the libvirt C API.
449
450
451
452
Authors:
453
--------
454
Daniel Veillard <veillard@redhat.com>
455
Karel Zak <kzak@redhat.com>
456
%endif
457
458
%prep
459
%setup -q
460
%patch100 -p1
461
%patch101
462
%patch102 -p1
463
%patch200 -p1
464
%patch201 -p1
465
466
%build
467
%if ! %{with_xen}
468
%define _without_xen --without-xen
469
%endif
470
%if ! %{with_qemu}
471
%define _without_qemu --without-qemu
472
%endif
473
%if ! %{with_openvz}
474
%define _without_openvz --without-openvz
475
%endif
476
%if ! %{with_lxc}
477
%define _without_lxc --without-lxc
478
%endif
479
%if ! %{with_vbox}
480
%define _without_vbox --without-vbox
481
%endif
482
%if ! %{with_xenapi}
483
%define _without_xenapi --without-xenapi
484
%endif
485
%if ! %{with_uml}
486
%define _without_uml --without-uml
487
%endif
488
%if ! %{with_phyp}
489
%define _without_phyp --without-phyp
490
%endif
491
%if ! %{with_esx}
492
%define _without_esx --without-esx
493
%endif
494
%if ! %{with_vmware}
495
%define _without_vmware --without-vmware
496
%endif
497
%if ! %{with_hyperv}
498
%define _without_hyperv --without-hyperv
499
%endif
500
%if ! %{with_libxl}
501
%define _without_libxl --without-libxl
502
%endif
503
%if ! %{with_libvirtd}
504
%define _without_libvirtd --without-libvirtd
505
%endif
506
%if ! %{with_storage_fs}
507
%define _without_storage_fs --without-storage-fs
508
%endif
509
%if ! %{with_storage_lvm}
510
%define _without_storage_lvm --without-storage-lvm
511
%endif
512
%if ! %{with_storage_iscsi}
513
%define _without_storage_iscsi --without-storage-iscsi
514
%endif
515
%if ! %{with_storage_disk}
516
%define _without_storage_disk --without-storage-disk
517
%endif
518
%if ! %{with_storage_mpath}
519
%define _without_storage_mpath --without-storage-mpath
520
%endif
521
%if ! %{with_numactl}
522
%define _without_numactl --without-numactl
523
%endif
524
%if ! %{with_selinux}
525
%define _without_selinux --without-selinux
526
%endif
527
%if ! %{with_apparmor}
528
%define _without_apparmor --without-apparmor
529
%endif
530
%if ! %{with_capng}
531
%define _without_capng --without-capng
532
%endif
533
%if ! %{with_netcf}
534
%define _without_netcf --without-netcf
535
%endif
536
%if ! %{with_hal}
537
%define _without_hal --without-hal
538
%endif
539
%if ! %{with_udev}
540
%define _without_udev --without-udev
541
%endif
542
%if ! %{with_yajl}
543
%define _without_yajl --without-yajl
544
%endif
545
%if ! %{with_macvtap}
546
%define _without_macvtap --without-macvtap
547
%endif
548
%if ! %{with_polkit}
549
%define _without_polkit --without-polkit
550
%endif
551
%if ! %{with_network}
552
%define _without_network --without-network
553
%endif
554
%if ! %{with_sasl}
555
%define _without_sasl --without-sasl
556
%endif
557
%if ! %{with_python}
558
%define _without_python --without-python
559
%endif
560
%if ! %{with_libpcap}
561
%define _without_libpcap --without-libpcap
562
%endif
563
564
autoreconf -f -i
565
export CFLAGS="$RPM_OPT_FLAGS"
566
%configure --disable-static --with-pic \
567
%{?_without_xen} \
568
%{?_without_qemu} \
569
%{?_without_openvz} \
570
%{?_without_lxc} \
571
%{?_without_vbox} \
572
%{?_without_xenapi} \
573
%{?_without_uml} \
574
%{?_without_phyp} \
575
%{?_without_esx} \
576
%{?_without_vmware} \
577
%{?_without_hyperv} \
578
%{?_without_libxl} \
579
%{?_without_libvirtd} \
580
%{?_without_storage_fs} \
581
%{?_without_storage_lvm} \
582
%{?_without_storage_iscsi} \
583
%{?_without_storage_disk} \
584
%{?_without_storage_mpath} \
585
%{?_without_numactl} \
586
%{?_without_selinux} \
587
%{?_without_apparmor} \
588
%{?_without_capng} \
589
%{?_without_netcf} \
590
%{?_without_hal} \
591
%{?_without_udev} \
592
%{?_without_yajl} \
593
%{?_without_macvtap} \
594
%{?_without_polkit} \
595
%{?_without_network} \
596
%{?_without_sasl} \
597
%{?_without_python} \
598
%{?_without_libpcap} \
599
--libexecdir=%{_libdir}/%{name} \
600
--with-remote-pid-file=%{_localstatedir}/run/libvirtd.pid \
601
--with-init-script=redhat \
602
ac_cv_path_MODPROBE=/sbin/modprobe \
603
ac_cv_path_UDEVADM=/sbin/udevadm \
604
ac_cv_path_SHOWMOUNT=/usr/sbin/showmount
605
make %{?jobs:-j%jobs} DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
606
607
%install
608
%makeinstall DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
609
cp -a AUTHORS ChangeLog COPYING NEWS README TODO $RPM_BUILD_ROOT%{_docdir}/%{name}/
610
cd docs ; cp -a *.html $RPM_BUILD_ROOT%{_docdir}/%{name} ; cp -a *.png $RPM_BUILD_ROOT%{_docdir}/%{name} ; cd ..
611
# remove currently unsupported locale(s)
612
rm -rf $RPM_BUILD_ROOT/usr/share/locale/sr@latin
613
%if 0%{?suse_version} < 1130
614
rm -rf $RPM_BUILD_ROOT/usr/share/locale/vi_VN
615
%endif
616
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/libvirt
617
rm $RPM_BUILD_ROOT%{_libdir}/*.*a $RPM_BUILD_ROOT%{py_sitedir}/*.*a
618
%find_lang %{name}
619
%if %{with_network}
620
install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/lib/libvirt/dnsmasq/
621
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/
622
cp $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml \
623
$RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
624
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
625
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
626
# Strip auto-generated UUID - we need it generated per-install
627
sed -i -e "/<uuid>/d" $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
628
%else
629
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
630
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
631
%endif
632
%if ! %{with_lxc}
633
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/lxc.conf
634
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_lxc.aug
635
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.lxc
636
%endif
637
%if ! %{with_qemu}
638
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu.conf
639
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_qemu.aug
640
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.qemu
641
%endif
642
%if ! %{with_uml}
643
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.uml
644
%endif
645
%if ! %{with_python}
646
rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}-python
647
%endif
648
%if ! %{with_libvirtd}
649
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter
650
%endif
651
652
ln_dupes()
653
{
654
target=""
655
fdupes -r "$1" | while read file; do
656
if [ -z "$file" ] || [ -z "$target" ]; then
657
target="$file"
658
continue
659
fi
660
ln -sf "${target#.}" "$file"
661
done
662
}
663
(
664
cd $RPM_BUILD_ROOT
665
ln_dupes .%{_docdir}/%{name}
666
ln_dupes ./usr/share/locale
667
)
668
# init scripts
669
mkdir -p $RPM_BUILD_ROOT/etc/init.d
670
%if %{with_libvirtd}
671
install %SOURCE1 $RPM_BUILD_ROOT%{_sysconfdir}/init.d/libvirtd
672
ln -s /etc/init.d/libvirtd $RPM_BUILD_ROOT%{_sbindir}/rclibvirtd
673
%endif
674
ln -s /etc/init.d/libvirt-guests $RPM_BUILD_ROOT%{_sbindir}/rclibvirt-guests
675
676
%clean
677
rm -rf $RPM_BUILD_ROOT
678
679
%post
680
/sbin/ldconfig
681
%if %{with_libvirtd}
682
%if %{with_network}
683
# Install the default network if one doesn't exist
684
if test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml
685
then
686
UUID=`/usr/bin/uuidgen`
687
sed -e "s,</name>,</name>\n <uuid>$UUID</uuid>," \
688
< %{_datadir}/libvirt/networks/default.xml \
689
> %{_sysconfdir}/libvirt/qemu/networks/default.xml
690
fi
691
%endif
692
%if 0%{?sles_version}
693
%{fillup_and_insserv -y libvirtd}
694
%else
695
%{fillup_only -n libvirtd}
696
%endif
697
%endif
698
%{fillup_only -n libvirt-guests}
699
700
%preun
701
%if %{with_libvirtd}
702
%stop_on_removal libvirtd
703
%endif
704
705
%postun
706
/sbin/ldconfig
707
%if %{with_libvirtd}
708
%restart_on_update libvirtd
709
%endif
710
%insserv_cleanup
711
712
%post client -p /sbin/ldconfig
713
714
%postun client -p /sbin/ldconfig
715
716
%if %{with_libvirtd}
717
718
%files
719
%defattr(-, root, root)
720
%{_sbindir}/libvirtd
721
%dir %{_libdir}/%{name}
722
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/
723
%dir %{_sysconfdir}/sysctl.d
724
%config %{_sysconfdir}/sysctl.d/libvirtd
725
%if %{with_network}
726
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
727
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/
728
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart
729
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/
730
%dir %attr(0755, root, root) %{_localstatedir}/lib/libvirt/dnsmasq/
731
%dir %{_datadir}/libvirt/networks/
732
%{_datadir}/libvirt/networks/default.xml
733
%endif
734
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/
735
%{_sysconfdir}/libvirt/nwfilter/*.xml
736
%{_localstatedir}/adm/fillup-templates/sysconfig.libvirtd
737
%config /etc/init.d/libvirtd
738
%{_sbindir}/rclibvirtd
739
%config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf
740
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd
741
%dir %{_localstatedir}/lib/libvirt/
742
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/images/
743
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/boot/
744
%dir %attr(0711, root, root) %{_localstatedir}/cache/libvirt/
745
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/
746
%if %{with_polkit}
747
%if 0%{?suse_version} > 1110
748
%{_datadir}/polkit-1/actions/org.libvirt.unix.policy
749
%else
750
%{_datadir}/PolicyKit/policy/org.libvirt.unix.policy
751
%endif
752
%endif
753
%{_datadir}/augeas
754
%if %{with_qemu}
755
%config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
756
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
757
%dir %attr(0750, root, root) %{_localstatedir}/lib/libvirt/qemu/
758
%dir %attr(0750, root, root) %{_localstatedir}/cache/libvirt/qemu/
759
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
760
%endif
761
%if %{with_lxc}
762
%config(noreplace) %{_sysconfdir}/libvirt/lxc.conf
763
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc
764
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/
765
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
766
%attr(0755, root, root) %{_libdir}/%{name}/libvirt_lxc
767
%endif
768
%if %{with_uml}
769
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml
770
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/
771
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
772
%endif
773
%if %{with_libxl}
774
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
775
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
776
%endif
777
%if %{with_storage_disk}
778
%attr(0755, root, root) %{_libdir}/%{name}/libvirt_parthelper
779
%endif
780
%attr(0755, root, root) %{_libdir}/%{name}/libvirt_iohelper
781
%doc %{_mandir}/man8/libvirtd.8*
782
%endif
783
784
%files client -f %{name}.lang
785
%defattr(-, root, root)
786
%doc %dir %{_docdir}/%{name}
787
%doc %{_docdir}/%{name}/[CNRT]*
788
%doc %{_docdir}/%{name}/AUTHORS
789
%doc %{_mandir}/man1/virsh.1*
790
%doc %{_mandir}/man1/virt-xml-validate.1*
791
%doc %{_mandir}/man1/virt-pki-validate.1*
792
%doc %{_mandir}/man1/virt-host-validate.1*
793
%{_bindir}/virsh
794
%{_bindir}/virt-xml-validate
795
%{_bindir}/virt-pki-validate
796
%{_bindir}/virt-host-validate
797
%dir %{_libdir}/%{name}
798
%{_libdir}/lib*.so.*
799
%{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests
800
%config(noreplace) %{_sysconfdir}/libvirt/libvirt.conf
801
%config /etc/init.d/libvirt-guests
802
%{_sbindir}/rclibvirt-guests
803
804
%dir %{_datadir}/libvirt/
805
%dir %{_datadir}/libvirt/schemas/
806
%{_datadir}/libvirt/schemas/basictypes.rng
807
%{_datadir}/libvirt/schemas/networkcommon.rng
808
%{_datadir}/libvirt/schemas/domain.rng
809
%{_datadir}/libvirt/schemas/network.rng
810
%{_datadir}/libvirt/schemas/storagepool.rng
811
%{_datadir}/libvirt/schemas/storagevol.rng
812
%{_datadir}/libvirt/schemas/nodedev.rng
813
%{_datadir}/libvirt/schemas/capability.rng
814
%{_datadir}/libvirt/schemas/interface.rng
815
%{_datadir}/libvirt/schemas/secret.rng
816
%{_datadir}/libvirt/schemas/storageencryption.rng
817
%{_datadir}/libvirt/cpu_map.xml
818
%{_datadir}/libvirt/schemas/nwfilter.rng
819
%{_datadir}/libvirt/schemas/domainsnapshot.rng
820
%{_datadir}/libvirt/schemas/domaincommon.rng
821
%if %{with_sasl}
822
%config(noreplace) %{_sysconfdir}/sasl2/libvirt.conf
823
%endif
824
825
%files devel
826
%defattr(-, root, root)
827
%dir %{_includedir}/libvirt
828
%{_includedir}/libvirt/*.h
829
%{_libdir}/*.so
830
%{_libdir}/pkgconfig/libvirt.pc
831
832
%dir %{_datadir}/libvirt/api/
833
%{_datadir}/libvirt/api/libvirt-api.xml
834
%{_datadir}/libvirt/api/libvirt-qemu-api.xml
835
836
%files doc
837
%defattr(-, root, root)
838
%{_datadir}/gtk-doc/html/libvirt
839
%doc %{_docdir}/%{name}/*.png
840
%doc %{_docdir}/%{name}/*.html
841
%doc %{_docdir}/%{name}/*.gif
842
%doc %{_docdir}/%{name}/*.css
843
%doc %{_docdir}/%{name}/html
844
845
%if %{with_python}
846
847
%files python
848
%defattr(-, root, root)
849
%doc %{_docdir}/%{name}-python
850
%{py_sitedir}/libvirt.py*
851
%{py_sitedir}/libvirtmod*
852
%{py_sitedir}/libvirt_qemu*
853
%endif
854
855
%changelog
856