Gentoo Archives: gentoo-commits

From: Ian Delaney <idella4@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/xen-tools/
Date: Thu, 03 Dec 2015 13:58:29
Message-Id: 1449151089.2e385225eec30f5fbb7703c01cd862653e07143d.idella4@gentoo
1 commit: 2e385225eec30f5fbb7703c01cd862653e07143d
2 Author: Ian Delaney <idella4 <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 3 13:53:32 2015 +0000
4 Commit: Ian Delaney <idella4 <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 3 13:58:09 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e385225
7
8 app-emulation/xen-tools: clean vulnerable versions wrt security bug #566838
9
10 Gentoo bug : #566838
11
12 Package-Manager: portage-2.2.24
13
14 app-emulation/xen-tools/xen-tools-4.5.2.ebuild | 458 ---------------------
15 app-emulation/xen-tools/xen-tools-4.6.0-r2.ebuild | 470 ----------------------
16 2 files changed, 928 deletions(-)
17
18 diff --git a/app-emulation/xen-tools/xen-tools-4.5.2.ebuild b/app-emulation/xen-tools/xen-tools-4.5.2.ebuild
19 deleted file mode 100644
20 index 7a70a4d..0000000
21 --- a/app-emulation/xen-tools/xen-tools-4.5.2.ebuild
22 +++ /dev/null
23 @@ -1,458 +0,0 @@
24 -# Copyright 1999-2015 Gentoo Foundation
25 -# Distributed under the terms of the GNU General Public License v2
26 -# $Id$
27 -
28 -EAPI=5
29 -
30 -MY_PV=${PV/_/-}
31 -
32 -PYTHON_COMPAT=( python2_7 )
33 -PYTHON_REQ_USE='xml,threads'
34 -
35 -if [[ $PV == *9999 ]]; then
36 - KEYWORDS=""
37 - REPO="xen-unstable.hg"
38 - EHG_REPO_URI="http://xenbits.xensource.com/${REPO}"
39 - S="${WORKDIR}/${REPO}"
40 - live_eclass="mercurial"
41 -else
42 - KEYWORDS="amd64 ~arm ~arm64 -x86"
43 - UPSTREAM_VER=
44 - SECURITY_VER=7
45 - # xen-tools's gentoo patches tarball
46 - GENTOO_VER=4
47 - # xen-tools's gentoo patches version which apply to this specific ebuild
48 - GENTOO_GPV=0
49 - # xen-tools ovmf's patches
50 - OVMF_VER=1
51 -
52 - SEABIOS_VER=1.7.5
53 - OVMF_PV=20150629
54 -
55 - [[ -n ${UPSTREAM_VER} ]] && \
56 - UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
57 - [[ -n ${SECURITY_VER} ]] && \
58 - SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz"
59 - [[ -n ${GENTOO_VER} ]] && \
60 - GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz"
61 - [[ -n ${OVMF_VER} ]] && \
62 - OVMF_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz"
63 -
64 - SRC_URI="http://bits.xensource.com/oss-xen/release/${MY_PV}/xen-${MY_PV}.tar.gz
65 - http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz
66 - https://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz
67 - ovmf? ( https://dev.gentoo.org/~dlan/distfiles/ovmf-${OVMF_PV}.tar.bz2
68 - ${OVMF_PATCHSET_URI} )
69 - ${UPSTREAM_PATCHSET_URI}
70 - ${SECURITY_PATCHSET_URI}
71 - ${GENTOO_PATCHSET_URI}"
72 - S="${WORKDIR}/xen-${MY_PV}"
73 -fi
74 -
75 -inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs udev ${live_eclass}
76 -
77 -DESCRIPTION="Xend daemon and tools"
78 -HOMEPAGE="http://xen.org/"
79 -DOCS=( README docs/README.xen-bugtool )
80 -
81 -LICENSE="GPL-2"
82 -SLOT="0"
83 -# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
84 -# >=dev-lang/ocaml-4 stable
85 -# Masked in profiles/eapi-5-files instead
86 -IUSE="api custom-cflags debug doc flask hvm qemu ocaml ovmf +pam python pygrub screen static-libs system-qemu system-seabios"
87 -
88 -REQUIRED_USE="hvm? ( || ( qemu system-qemu ) )
89 - ${PYTHON_REQUIRED_USE}
90 - pygrub? ( python )
91 - ovmf? ( hvm )
92 - qemu? ( !system-qemu )"
93 -
94 -COMMON_DEPEND="
95 - dev-libs/lzo:2
96 - dev-libs/glib:2
97 - dev-libs/yajl
98 - dev-libs/libaio
99 - dev-libs/libgcrypt:0
100 - sys-libs/zlib
101 -"
102 -
103 -DEPEND="${COMMON_DEPEND}
104 - dev-python/lxml[${PYTHON_USEDEP}]
105 - pam? ( dev-python/pypam[${PYTHON_USEDEP}] )
106 - hvm? ( media-libs/libsdl )
107 - ${PYTHON_DEPS}
108 - api? ( dev-libs/libxml2
109 - net-misc/curl )
110 - pygrub? ( ${PYTHON_DEPS//${PYTHON_REQ_USE}/ncurses} )
111 - ovmf? ( ${PYTHON_DEPS//${PYTHON_REQ_USE}/sqlite} )
112 - !amd64? ( >=sys-apps/dtc-1.4.0 )
113 - amd64? ( sys-devel/bin86
114 - system-seabios? ( sys-firmware/seabios )
115 - sys-firmware/ipxe
116 - sys-devel/dev86
117 - sys-power/iasl )
118 - dev-lang/perl
119 - app-misc/pax-utils
120 - dev-python/markdown[${PYTHON_USEDEP}]
121 - doc? (
122 - app-doc/doxygen
123 - dev-tex/latex2html[png,gif]
124 - media-gfx/graphviz
125 - dev-tex/xcolor
126 - media-gfx/transfig
127 - dev-texlive/texlive-latexextra
128 - virtual/latex-base
129 - dev-tex/latexmk
130 - dev-texlive/texlive-latex
131 - dev-texlive/texlive-pictures
132 - dev-texlive/texlive-latexrecommended
133 - )
134 - hvm? ( x11-proto/xproto
135 - !net-libs/libiscsi )
136 - qemu? ( x11-libs/pixman )
137 - system-qemu? ( app-emulation/qemu[xen] )
138 - ocaml? ( dev-ml/findlib
139 - >=dev-lang/ocaml-4 )"
140 -
141 -RDEPEND="${COMMON_DEPEND}
142 - sys-apps/iproute2
143 - net-misc/bridge-utils
144 - screen? (
145 - app-misc/screen
146 - app-admin/logrotate
147 - )
148 - virtual/udev"
149 -
150 -# hvmloader is used to bootstrap a fully virtualized kernel
151 -# Approved by QA team in bug #144032
152 -QA_WX_LOAD="usr/lib/xen/boot/hvmloader
153 - usr/share/qemu-xen/qemu/s390-ccw.img"
154 -
155 -RESTRICT="test"
156 -
157 -pkg_setup() {
158 - python-single-r1_pkg_setup
159 - export "CONFIG_LOMOUNT=y"
160 -
161 - #bug 522642, disable compile tools/tests
162 - export "CONFIG_TESTS=n"
163 -
164 - if has_version dev-libs/libgcrypt:0; then
165 - export "CONFIG_GCRYPT=y"
166 - fi
167 -
168 - if [[ -z ${XEN_TARGET_ARCH} ]] ; then
169 - if use x86 && use amd64; then
170 - die "Confusion! Both x86 and amd64 are set in your use flags!"
171 - elif use x86; then
172 - export XEN_TARGET_ARCH="x86_32"
173 - elif use amd64 ; then
174 - export XEN_TARGET_ARCH="x86_64"
175 - elif use arm; then
176 - export XEN_TARGET_ARCH="arm32"
177 - elif use arm64; then
178 - export XEN_TARGET_ARCH="arm64"
179 - else
180 - die "Unsupported architecture!"
181 - fi
182 - fi
183 -}
184 -
185 -src_prepare() {
186 - # Upstream's patchset
187 - if [[ -n ${UPSTREAM_VER} ]]; then
188 - einfo "Try to apply Xen Upstream patcheset"
189 - EPATCH_SUFFIX="patch" \
190 - EPATCH_FORCE="yes" \
191 - EPATCH_OPTS="-p1" \
192 - epatch "${WORKDIR}"/patches-upstream
193 - fi
194 -
195 - # Security patchset
196 - if [[ -n ${SECURITY_VER} ]]; then
197 - einfo "Try to apply Xen Security patcheset"
198 - source "${WORKDIR}"/patches-security/${PV}.conf
199 - # apply main xen patches
200 - for i in ${XEN_SECURITY_MAIN}; do
201 - EPATCH_SUFFIX="patch" \
202 - EPATCH_FORCE="yes" \
203 - epatch "${WORKDIR}"/patches-security/xen/$i
204 - done
205 -
206 - # apply qemu-traditional patches
207 - pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
208 - for i in ${XEN_SECURITY_QEMUT}; do
209 - EPATCH_SUFFIX="patch" \
210 - EPATCH_FORCE="yes" \
211 - epatch "${WORKDIR}"/patches-security/qemut/$i
212 - done
213 - popd > /dev/null
214 -
215 - # apply qemu-xen/upstream patches
216 - pushd "${S}"/tools/qemu-xen/ > /dev/null
217 - for i in ${XEN_SECURITY_QEMUU}; do
218 - EPATCH_SUFFIX="patch" \
219 - EPATCH_FORCE="yes" \
220 - epatch "${WORKDIR}"/patches-security/qemuu/$i
221 - done
222 - popd > /dev/null
223 - fi
224 -
225 - # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
226 - mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
227 - pushd tools/firmware/ > /dev/null
228 - ln -s seabios-dir-remote seabios-dir || die
229 - popd > /dev/null
230 -
231 - # Gentoo's patchset
232 - if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
233 - einfo "Try to apply Gentoo specific patcheset"
234 - source "${FILESDIR}"/gentoo-patches.conf
235 - _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
236 - for i in ${!_gpv}; do
237 - EPATCH_SUFFIX="patch" \
238 - EPATCH_FORCE="yes" \
239 - epatch "${WORKDIR}"/patches-gentoo/$i
240 - done
241 - fi
242 -
243 - # Ovmf's patchset
244 - if [[ -n ${OVMF_VER} ]] && use ovmf; then
245 - einfo "Try to apply Ovmf patcheset"
246 - pushd "${WORKDIR}"/ovmf-*/ > /dev/null
247 - EPATCH_SUFFIX="patch" \
248 - EPATCH_FORCE="yes" \
249 - EPATCH_OPTS="-p1" \
250 - epatch "${WORKDIR}"/patches-ovmf
251 - popd > /dev/null
252 - mv ../ovmf-${OVMF_PV} tools/firmware/ovmf-dir-remote || die
253 - fi
254 -
255 - mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
256 -
257 - # Fix texi2html build error with new texi2html, qemu.doc.html
258 - sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
259 -
260 - use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
261 - sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
262 - -i tools/firmware/Makefile || die
263 -
264 - # Drop .config, fixes to gcc-4.6
265 - sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
266 -
267 - # if the user *really* wants to use their own custom-cflags, let them
268 - if use custom-cflags; then
269 - einfo "User wants their own CFLAGS - removing defaults"
270 -
271 - # try and remove all the default cflags
272 - find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \
273 - -exec sed \
274 - -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
275 - -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
276 - -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
277 - -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
278 - -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
279 - -i {} + || die "failed to re-set custom-cflags"
280 - fi
281 -
282 - if ! use pygrub; then
283 - sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
284 - fi
285 -
286 - if ! use python; then
287 - sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
288 - fi
289 -
290 - if ! use hvm; then
291 - sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
292 - # Bug 351648
293 - elif ! use x86 && ! has x86 $(get_all_abis); then
294 - mkdir -p "${WORKDIR}"/extra-headers/gnu || die
295 - touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
296 - export CPATH="${WORKDIR}"/extra-headers
297 - fi
298 -
299 - # Don't bother with qemu, only needed for fully virtualised guests
300 - if ! use qemu; then
301 - sed -e "s:install-tools\: tools/qemu-xen-traditional-dir:install-tools\: :g" -i Makefile || die
302 - fi
303 -
304 - # Reset bash completion dir; Bug 472438
305 - sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
306 - -i Config.mk || die
307 - sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die
308 -
309 - # xencommons, Bug #492332, sed lighter weight than patching
310 - sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
311 - -i tools/hotplug/Linux/init.d/xencommons.in || die
312 -
313 - # respect multilib, usr/lib/libcacard.so.0.0.0
314 - sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
315 - -i tools/qemu-xen/configure || die
316 -
317 - #bug 518136, don't build 32bit exactuable for nomultilib profile
318 - if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
319 - sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
320 - fi
321 -
322 - # use /var instead of /var/lib, consistat with previous ebuild
323 - sed -i -e "/XEN_LOCK_DIR=/s/\$localstatedir/\/var/g" \
324 - m4/paths.m4 configure tools/configure || die
325 - # use /run instead of /var/run
326 - sed -i -e "/XEN_RUN_DIR=/s/\$localstatedir//g" \
327 - m4/paths.m4 configure tools/configure || die
328 -
329 - # uncomment lines in xl.conf
330 - sed -e 's:^#autoballoon=:autoballoon=:' \
331 - -e 's:^#lockfile=:lockfile=:' \
332 - -e 's:^#vif.default.script=:vif.default.script=:' \
333 - -i tools/examples/xl.conf || die
334 -
335 - epatch_user
336 -}
337 -
338 -src_configure() {
339 - local myconf="--prefix=${PREFIX}/usr \
340 - --libdir=${PREFIX}/usr/$(get_libdir) \
341 - --libexecdir=${PREFIX}/usr/libexec \
342 - --disable-werror \
343 - --disable-xen \
344 - --enable-tools \
345 - --enable-docs \
346 - $(use_with system-qemu) \
347 - $(use_enable pam) \
348 - $(use_enable api xenapi) \
349 - $(use_enable ovmf) \
350 - $(use_enable ocaml ocamltools) \
351 - "
352 - use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
353 - use qemu || myconf+=" --with-system-qemu"
354 - use amd64 && myconf+=" --enable-qemu-traditional"
355 - econf ${myconf}
356 -}
357 -
358 -src_compile() {
359 - export VARTEXFONTS="${T}/fonts"
360 - local myopt
361 - use debug && myopt="${myopt} debug=y"
362 -
363 - use custom-cflags || unset CFLAGS
364 - if test-flag-CC -fno-strict-overflow; then
365 - append-flags -fno-strict-overflow
366 - fi
367 -
368 - unset LDFLAGS
369 - unset CFLAGS
370 - emake V=1 CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" -C tools ${myopt}
371 -
372 - use doc && emake -C docs txt html
373 - emake -C docs man-pages
374 -}
375 -
376 -src_install() {
377 - # Override auto-detection in the build system, bug #382573
378 - export INITD_DIR=/tmp/init.d
379 - export CONFIG_LEAF_DIR=../tmp/default
380 -
381 - # Let the build system compile installed Python modules.
382 - local PYTHONDONTWRITEBYTECODE
383 - export PYTHONDONTWRITEBYTECODE
384 -
385 - emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
386 - XEN_PYTHON_NATIVE_INSTALL=y install-tools
387 -
388 - # Fix the remaining Python shebangs.
389 - python_fix_shebang "${D}"
390 -
391 - # Remove RedHat-specific stuff
392 - rm -rf "${D}"tmp || die
393 -
394 - if use doc; then
395 - emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
396 -
397 - dohtml -r docs/
398 - docinto pdf
399 - dodoc ${DOCS[@]}
400 - [ -d "${D}"/usr/share/doc/xen ] && mv "${D}"/usr/share/doc/xen/* "${D}"/usr/share/doc/${PF}/html
401 - fi
402 -
403 - rm -rf "${D}"/usr/share/doc/xen/
404 - doman docs/man?/*
405 -
406 - newconfd "${FILESDIR}"/xendomains.confd xendomains
407 - newconfd "${FILESDIR}"/xenstored.confd xenstored
408 - newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
409 - newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
410 - newinitd "${FILESDIR}"/xenstored.initd xenstored
411 - newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
412 - newinitd "${FILESDIR}"/xencommons.initd xencommons
413 - newconfd "${FILESDIR}"/xencommons.confd xencommons
414 - newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
415 - newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
416 -
417 - if use screen; then
418 - cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
419 - cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
420 - keepdir /var/log/xen-consoles
421 - fi
422 -
423 - # For -static-libs wrt Bug 384355
424 - if ! use static-libs; then
425 - rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a
426 - fi
427 -
428 - # for xendomains
429 - keepdir /etc/xen/auto
430 -
431 - # Temp QA workaround
432 - dodir "$(get_udevdir)"
433 - mv "${D}"/etc/udev/* "${D}/$(get_udevdir)"
434 - rm -rf "${D}"/etc/udev
435 -
436 - # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
437 - find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
438 - -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
439 -}
440 -
441 -pkg_postinst() {
442 - elog "Official Xen Guide and the offical wiki page:"
443 - elog "https://wiki.gentoo.org/wiki/Xen"
444 - elog "http://wiki.xen.org/wiki/Main_Page"
445 - elog ""
446 - elog "Recommended to utilise the xencommons script to config sytem At boot"
447 - elog "Add by use of rc-update on completion of the install"
448 -
449 - # TODO: we need to have the current Python slot here.
450 - if ! has_version "dev-lang/python[ncurses]"; then
451 - echo
452 - ewarn "NB: Your dev-lang/python is built without USE=ncurses."
453 - ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py."
454 - fi
455 -
456 - if has_version "sys-apps/iproute2[minimal]"; then
457 - echo
458 - ewarn "Your sys-apps/iproute2 is built with USE=minimal. Networking"
459 - ewarn "will not work until you rebuild iproute2 without USE=minimal."
460 - fi
461 -
462 - if ! use hvm; then
463 - echo
464 - elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
465 - elog "support enable the hvm use flag."
466 - elog "An x86 or amd64 system is required to build HVM support."
467 - fi
468 -
469 - if use qemu; then
470 - elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
471 - elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
472 - elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
473 - elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
474 - fi
475 -
476 - if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then
477 - echo
478 - elog "xensv is broken upstream (Gentoo bug #142011)."
479 - elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed."
480 - fi
481 -}
482
483 diff --git a/app-emulation/xen-tools/xen-tools-4.6.0-r2.ebuild b/app-emulation/xen-tools/xen-tools-4.6.0-r2.ebuild
484 deleted file mode 100644
485 index 7c0a941..0000000
486 --- a/app-emulation/xen-tools/xen-tools-4.6.0-r2.ebuild
487 +++ /dev/null
488 @@ -1,470 +0,0 @@
489 -# Copyright 1999-2015 Gentoo Foundation
490 -# Distributed under the terms of the GNU General Public License v2
491 -# $Id$
492 -
493 -EAPI=5
494 -
495 -MY_PV=${PV/_/-}
496 -
497 -PYTHON_COMPAT=( python2_7 )
498 -PYTHON_REQ_USE='xml,threads'
499 -
500 -if [[ $PV == *9999 ]]; then
501 - KEYWORDS=""
502 - REPO="xen-unstable.hg"
503 - EHG_REPO_URI="http://xenbits.xensource.com/${REPO}"
504 - S="${WORKDIR}/${REPO}"
505 - live_eclass="mercurial"
506 -else
507 - KEYWORDS="~amd64 ~arm ~arm64 -x86"
508 - UPSTREAM_VER=0
509 - SECURITY_VER=7
510 - # xen-tools's gentoo patches tarball
511 - GENTOO_VER=4
512 - # xen-tools's gentoo patches version which apply to this specific ebuild
513 - GENTOO_GPV=0
514 - # xen-tools ovmf's patches
515 - OVMF_VER=1
516 -
517 - SEABIOS_VER=1.8.2
518 - OVMF_PV=20150629
519 -
520 - [[ -n ${UPSTREAM_VER} ]] && \
521 - UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
522 - [[ -n ${SECURITY_VER} ]] && \
523 - SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz"
524 - [[ -n ${GENTOO_VER} ]] && \
525 - GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz"
526 - [[ -n ${OVMF_VER} ]] && \
527 - OVMF_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz"
528 -
529 - SRC_URI="http://bits.xensource.com/oss-xen/release/${MY_PV}/xen-${MY_PV}.tar.gz
530 - http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz
531 - https://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz
532 - ovmf? ( https://dev.gentoo.org/~dlan/distfiles/ovmf-${OVMF_PV}.tar.bz2
533 - ${OVMF_PATCHSET_URI} )
534 - ${UPSTREAM_PATCHSET_URI}
535 - ${SECURITY_PATCHSET_URI}
536 - ${GENTOO_PATCHSET_URI}"
537 - S="${WORKDIR}/xen-${MY_PV}"
538 -fi
539 -
540 -inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs udev ${live_eclass}
541 -
542 -DESCRIPTION="Xend daemon and tools"
543 -HOMEPAGE="http://xen.org/"
544 -DOCS=( README docs/README.xen-bugtool )
545 -
546 -LICENSE="GPL-2"
547 -SLOT="0"
548 -# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
549 -# >=dev-lang/ocaml-4 stable
550 -# Masked in profiles/eapi-5-files instead
551 -IUSE="api custom-cflags debug doc flask hvm qemu ocaml ovmf +pam python pygrub screen sdl static-libs system-qemu system-seabios"
552 -
553 -REQUIRED_USE="hvm? ( || ( qemu system-qemu ) )
554 - ${PYTHON_REQUIRED_USE}
555 - pygrub? ( python )
556 - ovmf? ( hvm )
557 - qemu? ( !system-qemu )"
558 -
559 -COMMON_DEPEND="
560 - dev-libs/lzo:2
561 - dev-libs/glib:2
562 - dev-libs/yajl
563 - dev-libs/libaio
564 - dev-libs/libgcrypt:0
565 - sys-libs/zlib
566 -"
567 -
568 -DEPEND="${COMMON_DEPEND}
569 - dev-python/lxml[${PYTHON_USEDEP}]
570 - pam? ( dev-python/pypam[${PYTHON_USEDEP}] )
571 - ${PYTHON_DEPS}
572 - api? ( dev-libs/libxml2
573 - net-misc/curl )
574 - pygrub? ( ${PYTHON_DEPS//${PYTHON_REQ_USE}/ncurses} )
575 - ovmf? ( ${PYTHON_DEPS//${PYTHON_REQ_USE}/sqlite} )
576 - !amd64? ( >=sys-apps/dtc-1.4.0 )
577 - amd64? ( sys-devel/bin86
578 - system-seabios? ( sys-firmware/seabios )
579 - sys-firmware/ipxe
580 - sys-devel/dev86
581 - sys-power/iasl )
582 - dev-lang/perl
583 - app-misc/pax-utils
584 - dev-python/markdown[${PYTHON_USEDEP}]
585 - doc? (
586 - app-doc/doxygen
587 - dev-tex/latex2html[png,gif]
588 - media-gfx/graphviz
589 - dev-tex/xcolor
590 - media-gfx/transfig
591 - dev-texlive/texlive-latexextra
592 - virtual/latex-base
593 - dev-tex/latexmk
594 - dev-texlive/texlive-latex
595 - dev-texlive/texlive-pictures
596 - dev-texlive/texlive-latexrecommended
597 - )
598 - hvm? ( x11-proto/xproto
599 - !net-libs/libiscsi )
600 - qemu? (
601 - x11-libs/pixman
602 - sdl? ( media-libs/libsdl[X] )
603 - )
604 - system-qemu? ( app-emulation/qemu[xen] )
605 - ocaml? ( dev-ml/findlib
606 - >=dev-lang/ocaml-4 )"
607 -
608 -RDEPEND="${COMMON_DEPEND}
609 - sys-apps/iproute2
610 - net-misc/bridge-utils
611 - screen? (
612 - app-misc/screen
613 - app-admin/logrotate
614 - )
615 - virtual/udev"
616 -
617 -# hvmloader is used to bootstrap a fully virtualized kernel
618 -# Approved by QA team in bug #144032
619 -QA_WX_LOAD="usr/lib/xen/boot/hvmloader
620 - usr/share/qemu-xen/qemu/s390-ccw.img"
621 -
622 -RESTRICT="test"
623 -
624 -pkg_setup() {
625 - python-single-r1_pkg_setup
626 - export "CONFIG_LOMOUNT=y"
627 -
628 - #bug 522642, disable compile tools/tests
629 - export "CONFIG_TESTS=n"
630 -
631 - if has_version dev-libs/libgcrypt:0; then
632 - export "CONFIG_GCRYPT=y"
633 - fi
634 -
635 - if [[ -z ${XEN_TARGET_ARCH} ]] ; then
636 - if use x86 && use amd64; then
637 - die "Confusion! Both x86 and amd64 are set in your use flags!"
638 - elif use x86; then
639 - export XEN_TARGET_ARCH="x86_32"
640 - elif use amd64 ; then
641 - export XEN_TARGET_ARCH="x86_64"
642 - elif use arm; then
643 - export XEN_TARGET_ARCH="arm32"
644 - elif use arm64; then
645 - export XEN_TARGET_ARCH="arm64"
646 - else
647 - die "Unsupported architecture!"
648 - fi
649 - fi
650 -}
651 -
652 -src_prepare() {
653 - # Upstream's patchset
654 - if [[ -n ${UPSTREAM_VER} ]]; then
655 - einfo "Try to apply Xen Upstream patcheset"
656 - EPATCH_SUFFIX="patch" \
657 - EPATCH_FORCE="yes" \
658 - EPATCH_OPTS="-p1" \
659 - epatch "${WORKDIR}"/patches-upstream
660 - fi
661 -
662 - # Security patchset
663 - if [[ -n ${SECURITY_VER} ]]; then
664 - einfo "Try to apply Xen Security patcheset"
665 - source "${WORKDIR}"/patches-security/${PV}.conf
666 - # apply main xen patches
667 - for i in ${XEN_SECURITY_MAIN}; do
668 - EPATCH_SUFFIX="patch" \
669 - EPATCH_FORCE="yes" \
670 - epatch "${WORKDIR}"/patches-security/xen/$i
671 - done
672 -
673 - # apply qemu-traditional patches
674 - pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
675 - for i in ${XEN_SECURITY_QEMUT}; do
676 - EPATCH_SUFFIX="patch" \
677 - EPATCH_FORCE="yes" \
678 - epatch "${WORKDIR}"/patches-security/qemut/$i
679 - done
680 - popd > /dev/null
681 -
682 - # apply qemu-xen/upstream patches
683 - pushd "${S}"/tools/qemu-xen/ > /dev/null
684 - for i in ${XEN_SECURITY_QEMUU}; do
685 - EPATCH_SUFFIX="patch" \
686 - EPATCH_FORCE="yes" \
687 - epatch "${WORKDIR}"/patches-security/qemuu/$i
688 - done
689 - popd > /dev/null
690 - fi
691 -
692 - # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
693 - mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
694 - pushd tools/firmware/ > /dev/null
695 - ln -s seabios-dir-remote seabios-dir || die
696 - popd > /dev/null
697 -
698 - # Gentoo's patchset
699 - if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
700 - einfo "Try to apply Gentoo specific patcheset"
701 - source "${FILESDIR}"/gentoo-patches.conf
702 - _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
703 - for i in ${!_gpv}; do
704 - EPATCH_SUFFIX="patch" \
705 - EPATCH_FORCE="yes" \
706 - epatch "${WORKDIR}"/patches-gentoo/$i
707 - done
708 - fi
709 -
710 - # Ovmf's patchset
711 - if [[ -n ${OVMF_VER} ]] && use ovmf; then
712 - einfo "Try to apply Ovmf patcheset"
713 - pushd "${WORKDIR}"/ovmf-*/ > /dev/null
714 - EPATCH_SUFFIX="patch" \
715 - EPATCH_FORCE="yes" \
716 - EPATCH_OPTS="-p1" \
717 - epatch "${WORKDIR}"/patches-ovmf
718 - popd > /dev/null
719 - mv ../ovmf-${OVMF_PV} tools/firmware/ovmf-dir-remote || die
720 - fi
721 -
722 - mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
723 -
724 - # Fix texi2html build error with new texi2html, qemu.doc.html
725 - sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
726 -
727 - use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
728 - sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
729 - -i tools/firmware/Makefile || die
730 -
731 - # Drop .config, fixes to gcc-4.6
732 - sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
733 -
734 - # if the user *really* wants to use their own custom-cflags, let them
735 - if use custom-cflags; then
736 - einfo "User wants their own CFLAGS - removing defaults"
737 -
738 - # try and remove all the default cflags
739 - find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \
740 - -exec sed \
741 - -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
742 - -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
743 - -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
744 - -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
745 - -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
746 - -i {} + || die "failed to re-set custom-cflags"
747 - fi
748 -
749 - if ! use pygrub; then
750 - sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
751 - fi
752 -
753 - if ! use python; then
754 - sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
755 - fi
756 -
757 - if ! use hvm; then
758 - sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
759 - # Bug 351648
760 - elif ! use x86 && ! has x86 $(get_all_abis); then
761 - mkdir -p "${WORKDIR}"/extra-headers/gnu || die
762 - touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
763 - export CPATH="${WORKDIR}"/extra-headers
764 - fi
765 -
766 - if use qemu; then
767 - if use sdl; then
768 - sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
769 - tools/Makefile || die
770 - else
771 - sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
772 - tools/qemu-xen-traditional/xen-setup || die
773 - sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
774 - tools/Makefile || die
775 - fi
776 - else
777 - # Don't bother with qemu, only needed for fully virtualised guests
778 - sed -e "s:install-tools\: tools/qemu-xen-traditional-dir:install-tools\: :g" -i Makefile || die
779 - fi
780 -
781 - # Reset bash completion dir; Bug 472438
782 - sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
783 - -i Config.mk || die
784 - sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die
785 -
786 - # xencommons, Bug #492332, sed lighter weight than patching
787 - sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
788 - -i tools/hotplug/Linux/init.d/xencommons.in || die
789 -
790 - # respect multilib, usr/lib/libcacard.so.0.0.0
791 - sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
792 - -i tools/qemu-xen/configure || die
793 -
794 - #bug 518136, don't build 32bit exactuable for nomultilib profile
795 - if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
796 - sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
797 - fi
798 -
799 - # use /var instead of /var/lib, consistat with previous ebuild
800 - sed -i -e "/XEN_LOCK_DIR=/s/\$localstatedir/\/var/g" \
801 - m4/paths.m4 configure tools/configure || die
802 - # use /run instead of /var/run
803 - sed -i -e "/XEN_RUN_DIR=/s/\$localstatedir//g" \
804 - m4/paths.m4 configure tools/configure || die
805 -
806 - # uncomment lines in xl.conf
807 - sed -e 's:^#autoballoon=:autoballoon=:' \
808 - -e 's:^#lockfile=:lockfile=:' \
809 - -e 's:^#vif.default.script=:vif.default.script=:' \
810 - -i tools/examples/xl.conf || die
811 -
812 - epatch_user
813 -}
814 -
815 -src_configure() {
816 - local myconf="--prefix=${PREFIX}/usr \
817 - --libdir=${PREFIX}/usr/$(get_libdir) \
818 - --libexecdir=${PREFIX}/usr/libexec \
819 - --disable-werror \
820 - --disable-xen \
821 - --enable-tools \
822 - --enable-docs \
823 - $(use_with system-qemu) \
824 - $(use_enable pam) \
825 - $(use_enable api xenapi) \
826 - $(use_enable ovmf) \
827 - $(use_enable ocaml ocamltools) \
828 - "
829 - use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
830 - use qemu || myconf+=" --with-system-qemu"
831 - use amd64 && myconf+=" --enable-qemu-traditional"
832 - econf ${myconf}
833 -}
834 -
835 -src_compile() {
836 - export VARTEXFONTS="${T}/fonts"
837 - local myopt
838 - use debug && myopt="${myopt} debug=y"
839 -
840 - use custom-cflags || unset CFLAGS
841 - if test-flag-CC -fno-strict-overflow; then
842 - append-flags -fno-strict-overflow
843 - fi
844 -
845 - unset LDFLAGS
846 - unset CFLAGS
847 - emake V=1 CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" -C tools ${myopt}
848 -
849 - use doc && emake -C docs txt html
850 - emake -C docs man-pages
851 -}
852 -
853 -src_install() {
854 - # Override auto-detection in the build system, bug #382573
855 - export INITD_DIR=/tmp/init.d
856 - export CONFIG_LEAF_DIR=../tmp/default
857 -
858 - # Let the build system compile installed Python modules.
859 - local PYTHONDONTWRITEBYTECODE
860 - export PYTHONDONTWRITEBYTECODE
861 -
862 - emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
863 - XEN_PYTHON_NATIVE_INSTALL=y install-tools
864 -
865 - # Fix the remaining Python shebangs.
866 - python_fix_shebang "${D}"
867 -
868 - # Remove RedHat-specific stuff
869 - rm -rf "${D}"tmp || die
870 -
871 - if use doc; then
872 - emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
873 -
874 - dohtml -r docs/
875 - docinto pdf
876 - dodoc ${DOCS[@]}
877 - [ -d "${D}"/usr/share/doc/xen ] && mv "${D}"/usr/share/doc/xen/* "${D}"/usr/share/doc/${PF}/html
878 - fi
879 -
880 - rm -rf "${D}"/usr/share/doc/xen/
881 - doman docs/man?/*
882 -
883 - newconfd "${FILESDIR}"/xendomains.confd xendomains
884 - newconfd "${FILESDIR}"/xenstored.confd xenstored
885 - newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
886 - newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
887 - newinitd "${FILESDIR}"/xenstored.initd xenstored
888 - newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
889 - newinitd "${FILESDIR}"/xencommons.initd xencommons
890 - newconfd "${FILESDIR}"/xencommons.confd xencommons
891 - newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
892 - newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
893 -
894 - if use screen; then
895 - cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
896 - cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
897 - keepdir /var/log/xen-consoles
898 - fi
899 -
900 - # For -static-libs wrt Bug 384355
901 - if ! use static-libs; then
902 - rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a
903 - fi
904 -
905 - # for xendomains
906 - keepdir /etc/xen/auto
907 -
908 - # Temp QA workaround
909 - dodir "$(get_udevdir)"
910 - mv "${D}"/etc/udev/* "${D}/$(get_udevdir)"
911 - rm -rf "${D}"/etc/udev
912 -
913 - # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
914 - find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
915 - -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
916 -}
917 -
918 -pkg_postinst() {
919 - elog "Official Xen Guide and the offical wiki page:"
920 - elog "https://wiki.gentoo.org/wiki/Xen"
921 - elog "http://wiki.xen.org/wiki/Main_Page"
922 - elog ""
923 - elog "Recommended to utilise the xencommons script to config sytem At boot"
924 - elog "Add by use of rc-update on completion of the install"
925 -
926 - # TODO: we need to have the current Python slot here.
927 - if ! has_version "dev-lang/python[ncurses]"; then
928 - echo
929 - ewarn "NB: Your dev-lang/python is built without USE=ncurses."
930 - ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py."
931 - fi
932 -
933 - if has_version "sys-apps/iproute2[minimal]"; then
934 - echo
935 - ewarn "Your sys-apps/iproute2 is built with USE=minimal. Networking"
936 - ewarn "will not work until you rebuild iproute2 without USE=minimal."
937 - fi
938 -
939 - if ! use hvm; then
940 - echo
941 - elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
942 - elog "support enable the hvm use flag."
943 - elog "An x86 or amd64 system is required to build HVM support."
944 - fi
945 -
946 - if use qemu; then
947 - elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
948 - elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
949 - elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
950 - elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
951 - fi
952 -
953 - if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then
954 - echo
955 - elog "xensv is broken upstream (Gentoo bug #142011)."
956 - elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed."
957 - fi
958 -}