Gentoo Archives: gentoo-commits

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