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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Sun Jan 27 00:31:57 2013 UTC (2 years, 7 months ago) by cardoe
Branch: MAIN
Changes since 1.5: +2 -4 lines
Remove the debug USE flag as its really not what we want to support. This just disables the debug log level.

(Portage version: 2.1.11.31/cvs/Linux x86_64, unsigned Manifest commit)

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

  ViewVC Help
Powered by ViewVC 1.1.20