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