/[gentoo-x86]/app-emulation/libvirt/libvirt-0.10.2.1.ebuild
Gentoo

Contents of /app-emulation/libvirt/libvirt-0.10.2.1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Oct 30 05:17:42 2012 UTC (2 years, 1 month ago) by cardoe
Branch: MAIN
Changes since 1.2: +2 -2 lines
Add a temporary use on dbus until we can come up with a better no-op use to depend on.

(Portage version: 2.1.11.9/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/libvirt-0.10.2.1.ebuild,v 1.2 2012/10/30 05:12:33 cardoe Exp $
4
5 EAPI=4
6
7 #BACKPORTS=85e8c146
8 AUTOTOOLIZE=yes
9
10 MY_P="${P/_rc/-rc}"
11
12 PYTHON_DEPEND="python? 2:2.5"
13 #RESTRICT_PYTHON_ABIS="3.*"
14 #SUPPORT_PYTHON_ABIS="1"
15
16 inherit eutils python user autotools linux-info
17
18 if [[ ${PV} = *9999* ]]; then
19 inherit git-2
20 EGIT_REPO_URI="git://libvirt.org/libvirt.git"
21 AUTOTOOLIZE=yes
22 SRC_URI=""
23 KEYWORDS=""
24 else
25 SRC_URI="http://libvirt.org/sources/stable_updates/${MY_P}.tar.gz
26 ftp://libvirt.org/libvirt/stable_updates/${MY_P}.tar.gz
27 ${BACKPORTS:+
28 http://dev.gentoo.org/~cardoe/distfiles/${MY_P}-${BACKPORTS}.tar.xz}"
29 KEYWORDS="~amd64 ~x86"
30 fi
31 S="${WORKDIR}/${P%_rc*}"
32
33 DESCRIPTION="C toolkit to manipulate virtual machines"
34 HOMEPAGE="http://www.libvirt.org/"
35 LICENSE="LGPL-2.1"
36 SLOT="0"
37 IUSE="audit avahi +caps debug iscsi +libvirtd lvm +lxc +macvtap nfs \
38 nls numa openvz parted pcap phyp policykit python qemu rbd sasl \
39 selinux +udev uml +vepa virtualbox virt-network xen elibc_glibc"
40 REQUIRED_USE="libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) )
41 lxc? ( caps libvirtd )
42 openvz? ( libvirtd )
43 qemu? ( libvirtd )
44 uml? ( libvirtd )
45 vepa? ( macvtap )
46 virtualbox? ( libvirtd )
47 xen? ( libvirtd )"
48
49 # gettext.sh command is used by the libvirt command wrappers, and it's
50 # non-optional, so put it into RDEPEND.
51 # We can use both libnl:1.1 and libnl:3, but if you have both installed, the
52 # package will use 3 by default. Since we don't have slot pinning in an API,
53 # we must go with the most recent
54 RDEPEND="sys-libs/readline
55 sys-libs/ncurses
56 >=net-misc/curl-7.18.0
57 dev-libs/libgcrypt
58 >=dev-libs/libxml2-2.7.6
59 dev-libs/libnl:3
60 >=net-libs/gnutls-1.0.25
61 net-libs/libssh2
62 sys-apps/dmidecode
63 >=sys-apps/util-linux-2.17
64 sys-devel/gettext
65 >=net-analyzer/netcat6-1.0-r2
66 app-misc/scrub
67 audit? ( sys-process/audit )
68 avahi? ( >=net-dns/avahi-0.6[dbus] )
69 caps? ( sys-libs/libcap-ng )
70 iscsi? ( sys-block/open-iscsi )
71 lxc? ( sys-power/pm-utils )
72 lvm? ( >=sys-fs/lvm2-2.02.48-r2 )
73 nfs? ( net-fs/nfs-utils )
74 numa? (
75 >sys-process/numactl-2.0.2
76 sys-process/numad
77 )
78 openvz? ( sys-kernel/openvz-sources )
79 parted? (
80 >=sys-block/parted-1.8[device-mapper]
81 sys-fs/lvm2
82 )
83 pcap? ( >=net-libs/libpcap-1.0.0 )
84 policykit? ( >=sys-auth/polkit-0.9 )
85 qemu? (
86 >=app-emulation/qemu-0.13.0
87 dev-libs/yajl
88 sys-power/pm-utils
89 )
90 rbd? ( sys-cluster/ceph )
91 sasl? ( dev-libs/cyrus-sasl )
92 selinux? ( >=sys-libs/libselinux-2.0.85 )
93 virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) )
94 xen? ( app-emulation/xen-tools app-emulation/xen )
95 udev? ( >=sys-fs/udev-145 >=x11-libs/libpciaccess-0.10.9 )
96 virt-network? ( net-dns/dnsmasq
97 >=net-firewall/iptables-1.4.10
98 net-misc/radvd
99 net-firewall/ebtables
100 sys-apps/iproute2[-minimal] )
101 elibc_glibc? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )"
102 # one? ( dev-libs/xmlrpc-c )
103 DEPEND="${RDEPEND}
104 virtual/pkgconfig
105 app-text/xhtml1
106 dev-libs/libxslt
107 =dev-lang/python-2*"
108
109 LXC_CONFIG_CHECK="
110 ~CGROUPS
111 ~CGROUP_FREEZER
112 ~CGROUP_DEVICE
113 ~CPUSETS
114 ~CGROUP_CPUACCT
115 ~RESOURCE_COUNTERS
116 ~CGROUP_SCHED
117 ~BLK_CGROUP
118 ~NAMESPACES
119 ~UTS_NS
120 ~IPC_NS
121 ~PID_NS
122 ~NET_NS
123 ~DEVPTS_MULTIPLE_INSTANCES
124 ~VETH
125 ~MACVLAN
126 ~POSIX_MQUEUE
127 ~!GRKERNSEC_CHROOT_MOUNT
128 ~!GRKERNSEC_CHROOT_DOUBLE
129 ~!GRKERNSEC_CHROOT_PIVOT
130 ~!GRKERNSEC_CHROOT_CHMOD
131 ~!GRKERNSEC_CHROOT_CAPS
132 "
133
134 VIRTNET_CONFIG_CHECK="
135 ~BRIDGE_NF_EBTABLES
136 ~NETFILTER_ADVANCED
137 ~NETFILTER_XT_TARGET_CHECKSUM
138 "
139
140 MACVTAP_CONFIG_CHECK="~MACVTAP"
141
142 pkg_setup() {
143 python_set_active_version 2
144 python_pkg_setup
145
146 enewgroup qemu 77
147 enewuser qemu 77 -1 -1 qemu kvm
148
149 # Some people used the masked ebuild which was not adding the qemu
150 # user to the kvm group originally. This results in VMs failing to
151 # start for some users. bug #430808
152 egetent group kvm | grep -q qemu
153 if [[ $? -ne 0 ]]; then
154 gpasswd -a qemu kvm
155 fi
156
157 # Handle specific kernel versions for different features
158 kernel_is lt 3 5 && LXC_CONFIG_CHECK+=" ~USER_NS"
159 kernel_is lt 3 6 && LXC_CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR" || \
160 LXC_CONFIG_CHECK+=" ~MEMCG"
161
162 CONFIG_CHECK=""
163 use lxc && CONFIG_CHECK+="${LXC_CONFIG_CHECK}"
164 use macvtap && CONFIG_CHECK+="${MACVTAP}"
165 use virt-network && CONFIG_CHECK+="${VIRTNET_CONFIG_CHECK}"
166 if [[ -n ${CONFIG_CHECK} ]]; then
167 linux-info_pkg_setup
168 fi
169 }
170
171 src_prepare() {
172 touch "${S}/.mailmap"
173 [[ -n ${BACKPORTS} ]] && \
174 EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
175 epatch
176
177 if [[ ${PV} = *9999* ]]; then
178
179 # git checkouts require bootstrapping to create the configure script.
180 # Additionally the submodules must be cloned to the right locations
181 # bug #377279
182 ./bootstrap || die "bootstrap failed"
183 (
184 git submodule status | sed 's/^[ +-]//;s/ .*//'
185 git hash-object bootstrap.conf
186 ) >.git-module-status
187 fi
188
189 epatch_user
190
191 [[ -n ${AUTOTOOLIZE} ]] && eautoreconf
192
193 # Tweak the init script
194 local avahi_init=
195 local iscsi_init=
196 local rbd_init=
197 cp "${FILESDIR}/libvirtd.init-r10" "${S}/libvirtd.init"
198 use avahi && avahi_init='avahi-daemon'
199 use iscsi && iscsi_init='iscsid'
200 use rbd && rbd_init='ceph'
201
202 sed -e "s/USE_FLAG_AVAHI/${avahi_init}/" -i "${S}/libvirtd.init"
203 sed -e "s/USE_FLAG_ISCSI/${iscsi_init}/" -i "${S}/libvirtd.init"
204 sed -e "s/USE_FLAG_RBD/${rbd_init}/" -i "${S}/libvirtd.init"
205 }
206
207 src_configure() {
208 local myconf=""
209
210 myconf="${myconf} $(use_enable debug)"
211
212 ## enable/disable daemon, otherwise client only utils
213 myconf="${myconf} $(use_with libvirtd)"
214
215 ## enable/disable the daemon using avahi to find VMs
216 myconf="${myconf} $(use_with avahi)"
217
218 ## hypervisors on the local host
219 myconf="${myconf} $(use_with xen) $(use_with xen xen-inotify)"
220 # leave it automagic as it depends on the version of xen used.
221 use xen || myconf+=" --without-libxl"
222 use xen || myconf+=" --without-xenapi"
223 myconf="${myconf} $(use_with openvz)"
224 myconf="${myconf} $(use_with lxc)"
225 if use virtualbox && has_version app-emulation/virtualbox-ose; then
226 myconf="${myconf} --with-vbox=/usr/lib/virtualbox-ose/"
227 else
228 myconf="${myconf} $(use_with virtualbox vbox)"
229 fi
230 myconf="${myconf} $(use_with uml)"
231 myconf="${myconf} $(use_with qemu)"
232 myconf="${myconf} $(use_with qemu yajl)" # Use QMP over HMP
233 myconf="${myconf} $(use_with phyp)"
234 myconf="${myconf} --with-esx"
235 myconf="${myconf} --with-vmware"
236
237 ## additional host drivers
238 myconf="${myconf} $(use_with virt-network network)"
239 myconf="${myconf} --with-storage-fs"
240 myconf="${myconf} $(use_with lvm storage-lvm)"
241 myconf="${myconf} $(use_with iscsi storage-iscsi)"
242 myconf="${myconf} $(use_with parted storage-disk)"
243 myconf="${myconf} $(use_with lvm storage-mpath)"
244 myconf="${myconf} $(use_with rbd storage-rbd)"
245 myconf="${myconf} $(use_with numa numactl)"
246 myconf="${myconf} $(use_with numa numad)"
247 myconf="${myconf} $(use_with selinux)"
248
249 # udev for device support details
250 myconf="${myconf} $(use_with udev)"
251
252 # linux capability support so we don't need privileged accounts
253 myconf="${myconf} $(use_with caps capng)"
254
255 ## auth stuff
256 myconf="${myconf} $(use_with policykit polkit)"
257 myconf="${myconf} $(use_with sasl)"
258
259 # network bits
260 myconf="${myconf} $(use_with macvtap)"
261 myconf="${myconf} $(use_with pcap libpcap)"
262 myconf="${myconf} $(use_with vepa virtualport)"
263
264 ## other
265 myconf="${myconf} $(use_enable nls)"
266 myconf="${myconf} $(use_with python)"
267
268 # user privilege bits fir qemu/kvm
269 if use caps; then
270 myconf="${myconf} --with-qemu-user=qemu"
271 myconf="${myconf} --with-qemu-group=qemu"
272 else
273 myconf="${myconf} --with-qemu-user=root"
274 myconf="${myconf} --with-qemu-group=root"
275 fi
276
277 # audit support
278 myconf="${myconf} $(use_with audit)"
279
280 ## stuff we don't yet support
281 myconf="${myconf} --without-netcf"
282
283 # we use udev over hal
284 myconf="${myconf} --without-hal"
285
286 # locking support
287 myconf="${myconf} --without-sanlock"
288
289 # DBus access to iptables/ebtables and friends
290 myconf="${myconf} --without-firewalld"
291
292 # this is a nasty trick to work around the problem in bug
293 # #275073. The reason why we don't solve this properly is that
294 # it'll require us to rebuild autotools (and we don't really want
295 # to do that right now). The proper solution has been sent
296 # upstream and should hopefully land in 0.7.7, in the mean time,
297 # mime the same functionality with this.
298 case ${CHOST} in
299 *cygwin* | *mingw* )
300 ;;
301 *)
302 ac_cv_prog_WINDRES=no
303 ;;
304 esac
305
306 econf \
307 ${myconf} \
308 --disable-static \
309 --docdir=/usr/share/doc/${PF} \
310 --with-remote \
311 --localstatedir=/var
312
313 if [[ ${PV} = *9999* ]]; then
314 # Restore gnulib's config.sub and config.guess
315 # bug #377279
316 (cd .gnulib && git reset --hard > /dev/null)
317 fi
318 }
319
320 src_test() {
321 # Explicitly allow parallel build of tests
322 HOME="${T}" emake check || die "tests failed"
323 }
324
325 src_install() {
326 emake install \
327 DESTDIR="${D}" \
328 HTML_DIR=/usr/share/doc/${PF}/html \
329 DOCS_DIR=/usr/share/doc/${PF}/python \
330 EXAMPLE_DIR=/usr/share/doc/${PF}/python/examples \
331 || die "emake install failed"
332
333 find "${D}" -name '*.la' -delete || die
334
335 use libvirtd || return 0
336 # From here, only libvirtd-related instructions, be warned!
337
338 newinitd "${S}/libvirtd.init" libvirtd || die
339 newconfd "${FILESDIR}/libvirtd.confd-r4" libvirtd || die
340
341 keepdir /var/lib/libvirt/images
342 }
343
344 pkg_preinst() {
345 # we only ever want to generate this once
346 if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
347 rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml
348 fi
349
350 # We really don't want to use or support old PolicyKit cause it
351 # screws with the new polkit integration
352 if has_version sys-auth/policykit; then
353 rm -rf "${D}"/usr/share/PolicyKit/policy/org.libvirt.unix.policy
354 fi
355
356 # Only sysctl files ending in .conf work
357 mv "${D}"/etc/sysctl.d/libvirtd "${D}"/etc/sysctl.d/libvirtd.conf
358 }
359
360 pkg_postinst() {
361 use python && python_mod_optimize libvirt.py
362
363 # support for dropped privileges
364 if use qemu; then
365 fperms 0750 "${EROOT}/var/lib/libvirt/qemu"
366 fperms 0750 "${EROOT}/var/cache/libvirt/qemu"
367 fi
368
369 if use caps && use qemu; then
370 fowners -R qemu:qemu "${EROOT}/var/lib/libvirt/qemu"
371 fowners -R qemu:qemu "${EROOT}/var/cache/libvirt/qemu"
372 elif use qemu; then
373 fowners -R root:root "${EROOT}/var/lib/libvirt/qemu"
374 fowners -R root:root "${EROOT}/var/cache/libvirt/qemu"
375 fi
376
377 if ! use policykit; then
378 elog "To allow normal users to connect to libvirtd you must change the"
379 elog "unix sock group and/or perms in /etc/libvirt/libvirtd.conf"
380 fi
381
382 use libvirtd || return 0
383 # From here, only libvirtd-related instructions, be warned!
384
385 elog
386 elog "For the basic networking support (bridged and routed networks)"
387 elog "you don't need any extra software. For more complex network modes"
388 elog "including but not limited to NATed network, you can enable the"
389 elog "'virt-network' USE flag."
390 elog
391 if has_version net-dns/dnsmasq; then
392 ewarn "If you have a DNS server setup on your machine, you will have"
393 ewarn "to configure /etc/dnsmasq.conf to enable the following settings: "
394 ewarn " bind-interfaces"
395 ewarn " interface or except-interface"
396 ewarn
397 ewarn "Otherwise you might have issues with your existing DNS server."
398 fi
399
400 if use caps && use qemu; then
401 elog "libvirt will now start qemu/kvm VMs with non-root privileges."
402 elog "Ensure any resources your VMs use are accessible by qemu:qemu"
403 fi
404 }
405
406 pkg_postrm() {
407 use python && python_mod_cleanup libvirt.py
408 }

  ViewVC Help
Powered by ViewVC 1.1.20