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: Tue, 17 Oct 2017 07:25:01
Message-Id: 1508225065.dc6492d68d6b86c2e3a5b8e0115eee3bd150fc63.dlan@gentoo
1 commit: dc6492d68d6b86c2e3a5b8e0115eee3bd150fc63
2 Author: Tomas Mozes <tmozes <AT> sygic <DOT> com>
3 AuthorDate: Mon Oct 16 12:16:33 2017 +0000
4 Commit: Yixun Lan <dlan <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 17 07:24:25 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc6492d6
7
8 app-emulation/xen-tools: require pciutils for pci passthrough
9
10 Gentoo-Bug: 626008
11
12 Closes: https://github.com/gentoo/gentoo/pull/5962
13 Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>
14
15 app-emulation/xen-tools/xen-tools-4.8.2-r2.ebuild | 469 ++++++++++++++++++++++
16 1 file changed, 469 insertions(+)
17
18 diff --git a/app-emulation/xen-tools/xen-tools-4.8.2-r2.ebuild b/app-emulation/xen-tools/xen-tools-4.8.2-r2.ebuild
19 new file mode 100644
20 index 00000000000..7d6fde136d8
21 --- /dev/null
22 +++ b/app-emulation/xen-tools/xen-tools-4.8.2-r2.ebuild
23 @@ -0,0 +1,469 @@
24 +# Copyright 1999-2017 Gentoo Foundation
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=6
28 +
29 +PYTHON_COMPAT=( python2_7 )
30 +PYTHON_REQ_USE='ncurses,xml,threads'
31 +
32 +inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs versionator
33 +
34 +MY_PV=${PV/_/-}
35 +MAJOR_V="$(get_version_component_range 1-2)"
36 +
37 +if [[ $PV == *9999 ]]; then
38 + inherit git-r3
39 + KEYWORDS=""
40 + REPO="xen.git"
41 + EGIT_REPO_URI="git://xenbits.xen.org/${REPO}"
42 + S="${WORKDIR}/${REPO}"
43 +else
44 + KEYWORDS="~amd64 ~arm ~arm64 ~x86"
45 + UPSTREAM_VER=1
46 + SECURITY_VER=
47 + # xen-tools's gentoo patches tarball
48 + GENTOO_VER=10
49 + # xen-tools's gentoo patches version which apply to this specific ebuild
50 + GENTOO_GPV=0
51 + # xen-tools ovmf's patches
52 + OVMF_VER=2
53 +
54 + SEABIOS_VER=1.10.0
55 + # OVMF upstream 52a99493cce88a9d4ec8a02d7f1bd1a1001ce60d
56 + OVMF_PV=20151110
57 +
58 + [[ -n ${UPSTREAM_VER} ]] && \
59 + UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
60 + [[ -n ${SECURITY_VER} ]] && \
61 + SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz"
62 + [[ -n ${GENTOO_VER} ]] && \
63 + GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz"
64 + [[ -n ${OVMF_VER} ]] && \
65 + OVMF_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz"
66 +
67 + SRC_URI="https://downloads.xenproject.org/release/xen/${MY_PV}/xen-${MY_PV}.tar.gz
68 + http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz
69 + https://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz
70 + ovmf? ( https://dev.gentoo.org/~dlan/distfiles/ovmf-${OVMF_PV}.tar.bz2
71 + ${OVMF_PATCHSET_URI} )
72 + ${UPSTREAM_PATCHSET_URI}
73 + ${SECURITY_PATCHSET_URI}
74 + ${GENTOO_PATCHSET_URI}"
75 +
76 + S="${WORKDIR}/xen-${MY_PV}"
77 +fi
78 +
79 +DESCRIPTION="Xen tools including QEMU and xl"
80 +HOMEPAGE="https://www.xenproject.org"
81 +DOCS=( README docs/README.xen-bugtool )
82 +
83 +LICENSE="GPL-2"
84 +SLOT="0/${MAJOR_V}"
85 +# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
86 +# >=dev-lang/ocaml-4 stable
87 +# Masked in profiles/eapi-5-files instead
88 +IUSE="api custom-cflags debug doc flask hvm ocaml ovmf +pam pygrub python +qemu +qemu-traditional screen sdl static-libs system-qemu system-seabios"
89 +
90 +REQUIRED_USE="
91 + ${PYTHON_REQUIRED_USE}
92 + pygrub? ( python )
93 + ovmf? ( hvm )
94 + ^^ ( qemu system-qemu )"
95 +
96 +COMMON_DEPEND="
97 + sys-apps/pciutils
98 + dev-libs/lzo:2
99 + dev-libs/glib:2
100 + dev-libs/yajl
101 + dev-libs/libaio
102 + dev-libs/libgcrypt:0
103 + sys-libs/zlib
104 + ${PYTHON_DEPS}
105 +"
106 +
107 +DEPEND="${COMMON_DEPEND}
108 + dev-python/lxml[${PYTHON_USEDEP}]
109 + x86? ( sys-devel/dev86
110 + sys-power/iasl )
111 + pam? ( dev-python/pypam[${PYTHON_USEDEP}] )
112 + api? ( dev-libs/libxml2
113 + net-misc/curl )
114 + ovmf? (
115 + !arm? ( !arm64? ( dev-lang/nasm ) )
116 + $(python_gen_impl_dep sqlite)
117 + )
118 + !amd64? ( >=sys-apps/dtc-1.4.0 )
119 + amd64? ( sys-devel/bin86
120 + system-seabios? ( sys-firmware/seabios )
121 + sys-firmware/ipxe
122 + sys-devel/dev86
123 + sys-power/iasl )
124 + dev-lang/perl
125 + app-misc/pax-utils
126 + doc? (
127 + app-doc/doxygen
128 + dev-python/markdown[${PYTHON_USEDEP}]
129 + dev-tex/latex2html[png,gif]
130 + media-gfx/graphviz
131 + dev-tex/xcolor
132 + media-gfx/transfig
133 + dev-texlive/texlive-latexextra
134 + virtual/latex-base
135 + dev-tex/latexmk
136 + dev-texlive/texlive-latex
137 + dev-texlive/texlive-pictures
138 + dev-texlive/texlive-latexrecommended
139 + )
140 + hvm? ( x11-proto/xproto
141 + !net-libs/libiscsi )
142 + qemu? (
143 + app-arch/snappy:=
144 + x11-libs/pixman
145 + sdl? ( media-libs/libsdl[X] )
146 + )
147 + system-qemu? ( app-emulation/qemu[xen] )
148 + ocaml? ( dev-ml/findlib
149 + >=dev-lang/ocaml-4 )"
150 +
151 +RDEPEND="${COMMON_DEPEND}
152 + sys-apps/iproute2[-minimal]
153 + net-misc/bridge-utils
154 + screen? (
155 + app-misc/screen
156 + app-admin/logrotate
157 + )"
158 +
159 +# hvmloader is used to bootstrap a fully virtualized kernel
160 +# Approved by QA team in bug #144032
161 +QA_WX_LOAD="
162 + usr/libexec/xen/boot/hvmloader
163 + usr/share/qemu-xen/qemu/s390-ccw.img
164 + usr/share/qemu-xen/qemu/u-boot.e500
165 +"
166 +
167 +QA_PREBUILT="
168 + usr/libexec/xen/bin/ivshmem-client
169 + usr/libexec/xen/bin/ivshmem-server
170 + usr/libexec/xen/bin/qemu-img
171 + usr/libexec/xen/bin/qemu-io
172 + usr/libexec/xen/bin/qemu-nbd
173 + usr/libexec/xen/bin/qemu-system-i386
174 + usr/libexec/xen/bin/virtfs-proxy-helper
175 + usr/libexec/xen/libexec/xen-bridge-helper
176 + usr/share/qemu-xen/qemu/s390-ccw.img
177 + usr/share/qemu-xen/qemu/u-boot.e500
178 +"
179 +
180 +RESTRICT="test"
181 +
182 +pkg_setup() {
183 + python_setup
184 + export "CONFIG_LOMOUNT=y"
185 +
186 + #bug 522642, disable compile tools/tests
187 + export "CONFIG_TESTS=n"
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 + local i
208 +
209 + # Upstream's patchset
210 + if [[ -n ${UPSTREAM_VER} ]]; then
211 + einfo "Try to apply Xen Upstream patch set"
212 + EPATCH_SUFFIX="patch" \
213 + EPATCH_FORCE="yes" \
214 + EPATCH_OPTS="-p1" \
215 + epatch "${WORKDIR}"/patches-upstream
216 + fi
217 +
218 + # Security patchset
219 + if [[ -n ${SECURITY_VER} ]]; then
220 + einfo "Try to apply Xen Security patch set"
221 + # apply main xen patches
222 + # Two parallel systems, both work side by side
223 + # Over time they may concdense into one. This will suffice for now
224 + EPATCH_SUFFIX="patch"
225 + EPATCH_FORCE="yes"
226 +
227 + source "${WORKDIR}"/patches-security/${PV}.conf || die
228 +
229 + for i in ${XEN_SECURITY_MAIN}; do
230 + epatch "${WORKDIR}"/patches-security/xen/$i
231 + done
232 +
233 + # apply qemu-xen/upstream patches
234 + pushd "${S}"/tools/qemu-xen/ > /dev/null
235 + for i in ${XEN_SECURITY_QEMUU}; do
236 + epatch "${WORKDIR}"/patches-security/qemuu/$i
237 + done
238 + popd > /dev/null
239 +
240 + # apply qemu-traditional patches
241 + pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
242 + for i in ${XEN_SECURITY_QEMUT}; do
243 + epatch "${WORKDIR}"/patches-security/qemut/$i
244 + done
245 + popd > /dev/null
246 + fi
247 +
248 + # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
249 + mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
250 + pushd tools/firmware/ > /dev/null
251 + ln -s seabios-dir-remote seabios-dir || die
252 + popd > /dev/null
253 +
254 + # Gentoo's patchset
255 + if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
256 + einfo "Try to apply Gentoo specific patch set"
257 + source "${FILESDIR}"/gentoo-patches.conf || die
258 + _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
259 + for i in ${!_gpv}; do
260 + EPATCH_SUFFIX="patch" \
261 + EPATCH_FORCE="yes" \
262 + epatch "${WORKDIR}"/patches-gentoo/$i
263 + done
264 + fi
265 +
266 + # Ovmf's patchset
267 + if use ovmf; then
268 + if [[ -n ${OVMF_VER} ]];then
269 + einfo "Try to apply Ovmf patch set"
270 + pushd "${WORKDIR}"/ovmf-*/ > /dev/null
271 + EPATCH_SUFFIX="patch" \
272 + EPATCH_FORCE="yes" \
273 + EPATCH_OPTS="-p1" \
274 + epatch "${WORKDIR}"/patches-ovmf
275 + popd > /dev/null
276 + fi
277 + mv ../ovmf-${OVMF_PV} tools/firmware/ovmf-dir-remote || die
278 + fi
279 +
280 + mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
281 +
282 + # Fix texi2html build error with new texi2html, qemu.doc.html
283 + sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
284 +
285 + use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
286 + sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
287 + -i tools/firmware/Makefile || die
288 +
289 + # Drop .config, fixes to gcc-4.6
290 + sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
291 +
292 + # if the user *really* wants to use their own custom-cflags, let them
293 + if use custom-cflags; then
294 + einfo "User wants their own CFLAGS - removing defaults"
295 +
296 + # try and remove all the default cflags
297 + find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \
298 + -exec sed \
299 + -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
300 + -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
301 + -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
302 + -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
303 + -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
304 + -i {} + || die "failed to re-set custom-cflags"
305 + else
306 + unset CFLAGS
307 + unset LDFLAGS
308 + unset ASFLAGS
309 + unset CPPFLAGS
310 + fi
311 +
312 + if ! use pygrub; then
313 + sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
314 + fi
315 +
316 + if ! use python; then
317 + sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
318 + fi
319 +
320 + if ! use hvm; then
321 + sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
322 + # Bug 351648
323 + elif ! use x86 && ! has x86 $(get_all_abis); then
324 + mkdir -p "${WORKDIR}"/extra-headers/gnu || die
325 + touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
326 + export CPATH="${WORKDIR}"/extra-headers
327 + fi
328 +
329 + if use qemu; then
330 + if use sdl; then
331 + sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
332 + tools/Makefile || die
333 + else
334 + sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
335 + tools/qemu-xen-traditional/xen-setup || die
336 + sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
337 + tools/Makefile || die
338 + fi
339 + else
340 + # Don't bother with qemu, only needed for fully virtualised guests
341 + sed -e "s:install-tools\: tools/qemu-xen-traditional-dir:install-tools\: :g" -i Makefile || die
342 + fi
343 +
344 + # Reset bash completion dir; Bug 472438
345 + sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
346 + -i Config.mk || die
347 + sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die
348 +
349 + # xencommons, Bug #492332, sed lighter weight than patching
350 + sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
351 + -i tools/hotplug/Linux/init.d/xencommons.in || die
352 +
353 + # respect multilib, usr/lib/libcacard.so.0.0.0
354 + sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
355 + -i tools/qemu-xen/configure || die
356 +
357 + #bug 518136, don't build 32bit exactuable for nomultilib profile
358 + if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
359 + sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
360 + fi
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 + default
369 +}
370 +
371 +src_configure() {
372 + local myconf="--prefix=${PREFIX}/usr \
373 + --libdir=${PREFIX}/usr/$(get_libdir) \
374 + --libexecdir=${PREFIX}/usr/libexec \
375 + --localstatedir=${EPREFIX}/var \
376 + --disable-werror \
377 + --disable-xen \
378 + --enable-tools \
379 + --enable-docs \
380 + $(use_enable pam) \
381 + $(use_enable api xenapi) \
382 + $(use_enable ovmf) \
383 + $(use_enable ocaml ocamltools) \
384 + --with-xenstored=$(usex ocaml 'oxenstored' 'xenstored') \
385 + "
386 +
387 + use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
388 + use system-qemu && myconf+=" --with-system-qemu=/usr/bin/qemu-system-x86_64"
389 + use amd64 && myconf+=" $(use_enable qemu-traditional)"
390 + econf ${myconf}
391 +}
392 +
393 +src_compile() {
394 + export VARTEXFONTS="${T}/fonts"
395 + local myopt
396 + use debug && myopt="${myopt} debug=y"
397 +
398 + if test-flag-CC -fno-strict-overflow; then
399 + append-flags -fno-strict-overflow
400 + fi
401 +
402 + emake V=1 CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" -C tools ${myopt}
403 +
404 + use doc && emake -C docs txt html
405 + emake -C docs man-pages
406 +}
407 +
408 +src_install() {
409 + # Override auto-detection in the build system, bug #382573
410 + export INITD_DIR=/tmp/init.d
411 + export CONFIG_LEAF_DIR=../tmp/default
412 +
413 + # Let the build system compile installed Python modules.
414 + local PYTHONDONTWRITEBYTECODE
415 + export PYTHONDONTWRITEBYTECODE
416 +
417 + emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
418 + XEN_PYTHON_NATIVE_INSTALL=y install-tools
419 +
420 + # Created at runtime
421 + rm -rv "${ED%/}/var/run" || die
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-r1 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 "https://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 +}