diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /app-emulation/xen-tools | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'app-emulation/xen-tools')
18 files changed, 1448 insertions, 0 deletions
diff --git a/app-emulation/xen-tools/Manifest b/app-emulation/xen-tools/Manifest new file mode 100644 index 000000000000..e42d51c6de38 --- /dev/null +++ b/app-emulation/xen-tools/Manifest @@ -0,0 +1,11 @@ +DIST ovmf-20150629.tar.bz2 24265640 SHA256 9f316dc44e192fa9d5d7486cf1dae3f3094ab4f20f282f80d6251632c2cd6118 SHA512 b15a896b5222b920a500ec8a1eba5d670505441ffd02accf9b6c0deb9a12c1c5513a016f91eae5cb33f75ee9f28435dc957686e6ce8b5d0744c11a7d7262fffd WHIRLPOOL 8db4360dcb85f183dbd827f7381787c84065f94eaf746068b11ef7b30412b16cc0ba75effb04f01dea5f4f67967721f7aca11a2550035e95c59645c7964526ac +DIST seabios-1.6.3.2.tar.gz 422376 SHA256 888aafe37ef3d1f502a73518a5e4dd0e9373ce4cd41681c354771314f1e41dd7 SHA512 c54431d8e81d25b74427696da689e90d3ab68c7c1be1dec05c81658d28b650f53daa34dcee2da826c1cf5d5d39396b12b0b16ea20ed6fd89de8f732163c8cca5 WHIRLPOOL 826c0e034ca46291661faa363189ee6cf56098cabc39f8fc84d2c442cc2da2174c2fa027cc11e11a7c3fed619f2e524f2aee804d9836d256448cdad28631d69a +DIST seabios-1.7.5.tar.gz 537566 SHA256 858d9eda4ad91efa1c45a5a401d560ef9ca8dd172f03b0a106f06661c252dc51 SHA512 ecf5fb9ac44dde6e4ac00baa6c920dde51b923f23dd74e62c5a02eceaf235e57b885975c5a8bd0927e268115c72bd1143a080fdfd4eff4e168ebeaa30436280e WHIRLPOOL 5e1e99b3bd82a8607c5986fde4592c7437bec4bd78abd5873710f6c431d075436725e8d0d32e9f0dd2921c9d84b8613108b21d31c5309a73e337ead7adf35e90 +DIST xen-4.2.5-upstream-patches-9.tar.xz 23208 SHA256 2206e9a8aeeed207abbae995c5d2baa14d5f0da4120ae44f2de733ecf7ea5af1 SHA512 8a2edaba48002449a521edf2ae078ffe1b3db4f491a85b063886a147a0be3ec7fdb819ce84c90cdae80ed34c10ab2d637506700be10052a67be6ef128fa40fb1 WHIRLPOOL 037820e0fad60d1f7ed054efa797585c992d08f1ffd533705c515ad289f8cdddc72b97f2a3d75ebd683c6bb6988d7285452b4f3cebbe9a879f701156e387ff3b +DIST xen-4.2.5.tar.gz 15671925 SHA256 3cf440866315e8085050eb0586f0447b6b47a08dbed6a72226bf5ed5d89ec567 SHA512 42c0fc241952fc55fc44480fb6752b004b54ae40e946159ec047adf229b65cbfbd810271d01b064ad8fdbddb73c640dcdcb6bc19f91e8968829889c129920dac WHIRLPOOL 762a91c0111892b33e6bd3e7f7714709b04697ad7c2b0919fef6cc9570a343a77fd5a2b82833e75dac9d12d4e41acdcf0743b0d593595910ddd326f5cd721368 +DIST xen-4.5.1-upstream-patches-0.tar.xz 18236 SHA256 95910023cb99f11b4df6d57d82000bbd67714d4ed0700e152619c5b82c1bc6e5 SHA512 531e5bbe6b9920a58361f11bb1bb6df65ebaf01e3af13f9aca018e8512727d950009257dfc9b3d0b0f847968da499cf9423716de8a04869cec6f92f5274462e2 WHIRLPOOL 3e6dda862d1bbe736b85422117148c3db91a308a58eb1476e27bbb7355ea7793269cdfc489697c9e5eea5f0ac5319df5c88f2707b10c9a96b8142927a4169819 +DIST xen-4.5.1.tar.gz 18410400 SHA256 668c11d4fca67ac44329e369f810356eacd37b28d28fb96e66aac77f3c5e1371 SHA512 9436243e26bc64bc836a179abdc3a6b1b6fa9d3f2170453092c18be71fa62e18cd4465a9154c0f28a7ac8d69d08361ba1defef240a51197f058c012c3855ba04 WHIRLPOOL 71d8559f86683dd9fb3eb09d3f602de227f281fbd3c8cc258bfdb67c425d9e7c4d21cb0284c123e4263262c1b821fea6d28109861ce60d627f6426d352808d99 +DIST xen-gentoo-patches-1.tar.xz 23044 SHA256 dcff35bbc4b6946473c9b55ad595a5fea88e8dac1bd977cbe18a644b2cced2e0 SHA512 a4c66382d44112e7be09711e3ecf0f8ebd9a30b29e04d8aca536430172bdd111ab8bab7700433e0dc35165f876eb7e9cd2e554d74ce2a166fb2dfd4de482cb7a WHIRLPOOL d0443e1501ac813ac3226df32a6b050c03302c3d74e3b3bd1293ab4ad929b5c314cc0eac13505ce8a826ee357117e8eeaf0713fd8b9c55f40296966fda082c2e +DIST xen-gentoo-patches-4.tar.xz 23632 SHA256 5cdb0f93ee32d0a5fc4fc7282270ace73acfdc4df694f7b29c1135180d902049 SHA512 3006ce4cd67e80a9f79d9ba3814a64704b0d762159a439a140b1ec0a2699473cd5537950f0913b55f8f7e3d0fd2e9861f3199793120d8d2502aa3f8ef7816c8f WHIRLPOOL 4a921103df2825ccd8b0481708e7cd692fa45d5aadae286c1522c144a1576920e7d3567648565bb9af85bb6bb597ea9d0ec04ea6abd2115db4caf7e739717b1a +DIST xen-ovmf-patches-1.tar.xz 4724 SHA256 d14e98e62c78c9f4b8a7e7b4a04de6dabf300f393eff44154d06f93aa43d7703 SHA512 a17467762f6d92018ff9bce783ce148039f23159405e801ec2aef4c3db72c3976c6f1e41d8c2a2cb704a9654556a2050302f284cfe8e32f28f393b8e2c6d2f1c WHIRLPOOL de53ad07f20aa14fe76d974db92d5b6808f0a2dd26a627b818914990add7adad8e6135d42641819dc22947031981c5815bae5aeeed0f28785c90beda0a6ff6c8 +DIST xen-security-patches-6.tar.xz 24780 SHA256 b41422583e5f7b4c85b82d89ab66f3e0fa8de8fdb2ae42aa3da40822e9507ef5 SHA512 c58831eb5e26a78a3072623b83bad125ddd4cd67c0075a708be81a7f50ee936cd2e5832a9b88129e11ec81ebafc9cfbc339fb8296d6f4b44c04630b349c4a621 WHIRLPOOL edecaefef0b6dd1a10c479362362640d9bd7a43623085c1f20b1171c65746220d7fdfd0e20892f60ea7d2f6052389da2a1d3c0179a88d7c4d52b3aa33cbef05e diff --git a/app-emulation/xen-tools/files/gentoo-patches.conf b/app-emulation/xen-tools/files/gentoo-patches.conf new file mode 100644 index 000000000000..696ff1814817 --- /dev/null +++ b/app-emulation/xen-tools/files/gentoo-patches.conf @@ -0,0 +1,135 @@ +# Drop .config, fixes to gcc-4.6 +_gx001=" xen-4-fix_dotconfig-gcc.patch" +_gx020=" xen-4.3-fix_dotconfig-gcc.patch" + +# Fix texi2html build error with new texi2html, qemu.doc.html +_gx002=" xen-tools-4-docfix.patch" +_gx003=" xen-tools-4-qemu-xen-doc.patch" + +_gx004=" xen-tools-4.2-pod-utf8-chars.patch" +_gx005=" xen-tools-4.2-pod-docs.patch" +_gx006=" xen-tools-4.2-pod-xl.patch" + +# Fix network broadcast on bridged networks +_gx007=" xen-tools-3.4.0-network-bridge-broadcast.patch" + +# Bug 496708 +_gx008=" xen-tools-4-unbundle-ipxe.patch" +#use system-seabios && epatch "${FILESDIR}"/${PN}-4-unbundle-seabios.patch + +# Fix bridge by idella4, bug #362575 +_gx009=" xen-tools-4.1.1-bridge.patch" + +# Conditional patch, fix in ebuild +# Don't build ipxe with pie on hardened, Bug #360805 +#if gcc-specs-pie; then +# epatch "${FILESDIR}"/ipxe-nopie.patch +#fi + +# Prevent double stripping of files at install +_gx010=" xen-4.2.0-nostrip.patch" +_gx024+=" xen-4.4-nostrip.patch" + +# fix jobserver in Makefile +_gx011=" xen-4.2.0-jserver.patch" +_gx021=" xen-4.3-jserver.patch" + +# add missing header, Bug #467200 +_gx012=" xen-4-ulong.patch" +_gx013=" xen-tools-4.2-xen_disk_leak.patch" + +# Set dom0-min-mem to kb; Bug #472982 +_gx014=" xen-4.2-configsxp.patch" + +# Bug 463840 +_gx015=" xen-tools-4.2.2-install.patch" +_gx016=" xen-tools-4.2.2-rt-link.patch" + +# Bug 379537 +_gx017=" fix-gold-ld.patch" + +# Bug 510976 +_gx018=" xen-tools-4.2.4-udev-rules.patch" + +# bundled seabios +_gx019=" xen-tools-4-anti-seabios-download.patch" +_gx032=" xen-tools-4.5-anti-seabios-download.patch" + +# Bug 477676 +_gx022=" xen-tools-4.3-ar-cc.patch" + +# Prevent file collision with qemu package Bug 478064 +_gx023=" qemu-bridge.patch" +_gx025=" xen-4.4-qemu-bridge.patch" +_gx031=" xen-4.5-qemu-bridge.patch" +#mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die + +_gx026=" xen-tools-4.4-api-fix.patch" + +# Fix po file collision with app-emulation/qemu, while USE=qemu is enabled, Bug 508302 +_gx027=" xen-tools-4-qemu-fix-po-collision.patch" + +# Fix build failure with ncurses[tinfo], bug 526526 +_gx028=" xen-tools-4.4.1-tinfo.patch" + +# Don't download ovmf, use pre-released +_gx029=" xen-tools-4-anti-ovmf-download.patch" + +# fix build err while using gcc-4.5.x, c99 +_gx033=" xen-tools-4.4.2-gcc99.patch" +_gx034=" xen-tools-4.5.0-gcc99.patch" + +# xen-tools-4.2.5 patches set +_gpv_xen_tools_425_0=" +${_gx001} ${_gx002} ${_gx003} ${_gx004} ${_gx005} +${_gx006} ${_gx007} ${_gx008} ${_gx009} ${_gx010} +${_gx011} ${_gx012} ${_gx013} ${_gx014} ${_gx015} +${_gx016} ${_gx017} ${_gx018} ${_gx019} +" + +# xen-tools-4.4.1 patches set +_gpv_xen_tools_441_2=" +${_gx007} ${_gx008} ${_gx009} +${_gx024} ${_gx021} ${_gx014} +${_gx022} ${_gx017} ${_gx025} +${_gx026} ${_gx027} ${_gx019} +${_gx028} ${_gx029} +" + +# xen-tools-4.4.2 patches set +_gpv_xen_tools_442_0=" +${_gx007} ${_gx008} ${_gx009} +${_gx024} ${_gx021} ${_gx014} +${_gx022} ${_gx017} ${_gx025} +${_gx026} ${_gx027} ${_gx019} +${_gx028} ${_gx029} +" +_gpv_xen_tools_442_1=" +${_gx007} ${_gx008} ${_gx009} +${_gx024} ${_gx021} ${_gx014} +${_gx022} ${_gx017} ${_gx025} +${_gx026} ${_gx027} ${_gx019} +${_gx028} ${_gx029} ${_gx033} +" + +# xen-tools-4.5.0 patches set +_gpv_xen_tools_450_0=" +${_gx008} ${_gx024} ${_gx021} +${_gx022} ${_gx017} ${_gx031} +${_gx027} ${_gx032} +${_gx028} ${_gx029} +" +_gpv_xen_tools_450_1=" +${_gx008} ${_gx024} ${_gx021} +${_gx022} ${_gx017} ${_gx031} +${_gx027} ${_gx032} +${_gx028} ${_gx029} ${_gx034} +" + +# xen-tools-4.5.1 patches set +_gpv_xen_tools_451_0=" +${_gx008} ${_gx024} ${_gx021} +${_gx022} ${_gx017} ${_gx031} +${_gx027} ${_gx032} +${_gx028} ${_gx029} ${_gx034} +" diff --git a/app-emulation/xen-tools/files/stubs-32.h b/app-emulation/xen-tools/files/stubs-32.h new file mode 100644 index 000000000000..a421528deb74 --- /dev/null +++ b/app-emulation/xen-tools/files/stubs-32.h @@ -0,0 +1,20 @@ +/* This file is automatically generated. + It defines a symbol `__stub_FUNCTION' for each function + in the C library which is a stub, meaning it will fail + every time called, usually setting errno to ENOSYS. */ + +#ifdef _LIBC + #error Applications may not define the macro _LIBC +#endif + +#define __stub_chflags +#define __stub_fattach +#define __stub_fchflags +#define __stub_fdetach +#define __stub_gtty +#define __stub_lchmod +#define __stub_revoke +#define __stub_setlogin +#define __stub_sigreturn +#define __stub_sstk +#define __stub_stty diff --git a/app-emulation/xen-tools/files/xen-consoles.logrotate b/app-emulation/xen-tools/files/xen-consoles.logrotate new file mode 100644 index 000000000000..c6445239b42f --- /dev/null +++ b/app-emulation/xen-tools/files/xen-consoles.logrotate @@ -0,0 +1,5 @@ +/var/log/xen-consoles/*.log { + rotate 7 + missingok + compress +} diff --git a/app-emulation/xen-tools/files/xencommons.confd b/app-emulation/xen-tools/files/xencommons.confd new file mode 100644 index 000000000000..b9e22482966f --- /dev/null +++ b/app-emulation/xen-tools/files/xencommons.confd @@ -0,0 +1,4 @@ +# /etc/conf.d/xencommons + +# Load xen's kernel modules, and this will override defaults +XEN_KERNEL_MODULES="" diff --git a/app-emulation/xen-tools/files/xencommons.initd b/app-emulation/xen-tools/files/xencommons.initd new file mode 100644 index 000000000000..0ce192fae927 --- /dev/null +++ b/app-emulation/xen-tools/files/xencommons.initd @@ -0,0 +1,80 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + before xenstored +} + +is_privileged_domain() { + grep -qsE '^control_d$' /proc/xen/capabilities + return $? +} + +handle_kernel_modules() { + local XEN_DEFAULT_KERNEL_MODULES=" + xen-evtchn + xen-gntdev + xen-gntalloc + xen-blkback + xen-netback + xen-pciback + gntdev + netbk + blkbk + xen-scsibk + usbbk + pciback + xen-acpi-processor + blktap2 + blktap + " + + [ "$1" = "remove" ] && OPTS="-r" + + XEN_KERNEL_MODULES="${XEN_KERNEL_MODULES:-${XEN_DEFAULT_KERNEL_MODULES}}" + for i in ${XEN_KERNEL_MODULES}; do + modprobe ${OPTS} $i 2>/dev/null + done + return 0 +} + +start() { + ebegin "Starting xencommons daemon" + + # not running in Xen dom0 or domU + if [ ! -d /proc/xen ]; then + eend 1 "Not running in Xen mode" + return 1 + fi + + # mount xenfs in dom0 or domU with a pv_ops kernel + if ! test -f /proc/xen/capabilities && \ + ! grep '^xenfs ' /proc/mounts >/dev/null; + then + mount -t xenfs xenfs /proc/xen + fi + + if ! is_privileged_domain; then + eend 1 "Not running on a privileged domain. xencommons not started" + return 1 + fi + + handle_kernel_modules + + eend $? "Failed to start xencommons" +} + +stop () { + ebegin "Stopping xencommons" + if ! is_privileged_domain; then + eend 1 "Not running on a privileged domain. xencommons not started" + return 1 + fi + + handle_kernel_modules remove + + eend $? "Failed to stop xencommons" +} + diff --git a/app-emulation/xen-tools/files/xenconsoled.confd b/app-emulation/xen-tools/files/xenconsoled.confd new file mode 100644 index 000000000000..b2e194bde46f --- /dev/null +++ b/app-emulation/xen-tools/files/xenconsoled.confd @@ -0,0 +1,2 @@ +# /etc/conf.d/xenstored +XENCONSOLED_OPTS="" diff --git a/app-emulation/xen-tools/files/xenconsoled.initd b/app-emulation/xen-tools/files/xenconsoled.initd new file mode 100644 index 000000000000..342af408b0dd --- /dev/null +++ b/app-emulation/xen-tools/files/xenconsoled.initd @@ -0,0 +1,34 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + need xenstored + after lvm +} + +# bug #498720 +shutdown_all_domU() { + # Note: shutdown all domU, including manually started ones + local V=$(xl info| awk "/xen_minor/ { print \$3 }") + # 4.2.2 do not support "-a" option + [ $V -gt 2 ] && xl shutdown -a -w >/dev/null +} + +start() { + ebegin "Starting xenconsoled daemon" + start-stop-daemon --start --exec /usr/sbin/xenconsoled \ + --pidfile /run/xenconsoled.pid \ + -- --pid-file=/run/xenconsoled.pid \ + ${XENCONSOLED_OPTS} + eend $* +} + +stop() { + ebegin "Stopping xenconsoled daemon" + shutdown_all_domU + start-stop-daemon --stop --exec /usr/sbin/xenconsoled \ + --pidfile /run/xenconsoled.pid + eend $* +} diff --git a/app-emulation/xen-tools/files/xendomains-screen.confd b/app-emulation/xen-tools/files/xendomains-screen.confd new file mode 100644 index 000000000000..e75e19d3be74 --- /dev/null +++ b/app-emulation/xen-tools/files/xendomains-screen.confd @@ -0,0 +1,25 @@ +# /etc/conf.d/xendomains + +# Directory of domains to boot. AUTODIR should contain one or more symlinks +# to domain config files in /etc/xen +# AUTODIR=/etc/xen/auto + +# Send shutdown commands to all domains in parallel instead of waiting for +# each to shutdown individually +# PARALLEL_SHUTDOWN=yes + +# When SCREEN="yes", domains in AUTODIR have their consoles connected to a +# screen session named SCREEN_NAME, with output logged to individual files +# named after each domain and written to /var/log/xen-consoles/ . These files +# are rotated (using app-admin/logrotate) every time xendomains is started. + +SCREEN="yes" +SCREEN_NAME="xen" + +# Number of seconds between writes to screen's logfiles. +# +# Lower values mean more disk activity and hence a possible performance +# impact, but higher values mean a greater chance of loosing some output +# in the event of a crash. + +SCREEN_LOG_INTERVAL="1" diff --git a/app-emulation/xen-tools/files/xendomains.confd b/app-emulation/xen-tools/files/xendomains.confd new file mode 100644 index 000000000000..90c1f5256c62 --- /dev/null +++ b/app-emulation/xen-tools/files/xendomains.confd @@ -0,0 +1,9 @@ +# /etc/conf.d/xendomains + +# Directory of domains to boot. AUTODIR should contain one or more symlinks +# to domain config files in /etc/xen +AUTODIR=/etc/xen/auto + +# Send shutdown commands to all domains in parallel instead of waiting for +# each to shutdown individually +PARALLEL_SHUTDOWN=yes diff --git a/app-emulation/xen-tools/files/xendomains.initd-r2 b/app-emulation/xen-tools/files/xendomains.initd-r2 new file mode 100644 index 000000000000..899a9b8a94e0 --- /dev/null +++ b/app-emulation/xen-tools/files/xendomains.initd-r2 @@ -0,0 +1,118 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +extra_commands="status" + +depend() { + need xenstored + after dhcp xend xenconsoled +} + +get_domname() { + local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1) + + if [ -z ${name_from_file} ] ; then + basename "${1}" + else + echo ${name_from_file} + fi +} + +is_running() { + /usr/sbin/xl list "${1}" >/dev/null 2>&1 +} + +using_screen() { + [ "${SCREEN}" = "yes" -o "${SCREEN}" = "YES" ] +} + +set_screen_cmd() { + screen_cmd="screen -c ${SCREENRC:-/dev/null} -q -r ${SCREEN_NAME:=xen} -X" +} + +start() { + set_screen_cmd + + einfo "Starting Xen domains from ${AUTODIR:=/etc/xen/auto}" + if using_screen ; then + ebegin "Creating screen session to hold domain consoles" + ( screen -c ${SCREENRC:-/dev/null} -d -m -S ${SCREEN_NAME} -t dom0 \ + && sleep 5 \ + && ${screen_cmd} zombie dr \ + && logrotate -f /etc/xen/xen-consoles.logrotate \ + && ${screen_cmd} logfile /var/log/xen-consoles/%t.log \ + && ${screen_cmd} logfile flush ${SCREEN_LOG_INTERVAL:-1} \ + && ${screen_cmd} log on \ + && ${screen_cmd} deflog on ) >/dev/null + if [ $? -ne 0 ] ; then + eend 1 + return 1 + else + eend + fi + fi + # Create all domains with config files in AUTODIR. + for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do + name=$(get_domname ${dom}) + if ! is_running ${name} ; then + ebegin " Starting domain ${name}" + if using_screen ; then + ${screen_cmd} screen -t ${name} xl create ${dom} -c + else + xl create --quiet ${dom} + fi + eend $? + else + einfo " Not starting domain ${name} - already running" + fi + done +} + +stop() { + set_screen_cmd + + einfo "Shutting down Xen domains from ${AUTODIR:=/etc/xen/auto}" + # Stop all domains with config files in AUTODIR. + DOMAINS="$(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort -r)" + + if [ "$PARALLEL_SHUTDOWN" = "yes" ] ; then + for dom in $DOMAINS ; do + name=$(get_domname ${dom}) + if is_running ${name} ; then + ebegin " Asking domain ${name} to shutdown in the background..." + xl shutdown -w ${name} >/dev/null & + else + einfo " Not stopping domain ${name} - not running" + fi + done + einfo " Waiting for shutdown of domains that are still running" + wait + eend $? + else + for dom in $DOMAINS ; do + name=$(get_domname ${dom}) + if is_running ${name} ; then + ebegin " Waiting for domain ${name} to shutdown" + xl shutdown -w ${name} >/dev/null + eend $? + else + einfo " Not stopping domain ${name} - not running" + fi + done + fi + if using_screen ; then + if ${screen_cmd} sleep 0 >/dev/null 2>&1 ; then + ebegin "Closing screen session ${SCREEN_NAME}" + ${screen_cmd} quit + eend $? + else + eend 0 + fi + fi +} + +status() { + /usr/sbin/xl list +} diff --git a/app-emulation/xen-tools/files/xenqemudev.confd b/app-emulation/xen-tools/files/xenqemudev.confd new file mode 100644 index 000000000000..5b49520aa0ee --- /dev/null +++ b/app-emulation/xen-tools/files/xenqemudev.confd @@ -0,0 +1,7 @@ +# /etc/conf.d/xenqemudev + +# To enable QEMU file backend, set to 'yes' +XENQEMUDEV_FILE_BACKEND_ENABLE="" + +# Common options for xenqemudev +XENQEMUDEV_OPTS="" diff --git a/app-emulation/xen-tools/files/xenqemudev.initd b/app-emulation/xen-tools/files/xenqemudev.initd new file mode 100644 index 000000000000..07dadebcd1e1 --- /dev/null +++ b/app-emulation/xen-tools/files/xenqemudev.initd @@ -0,0 +1,85 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + need xencommons xenstored xenconsoled +} + +is_privileged_domain() { + grep -qsE '^control_d$' /proc/xen/capabilities + return $? +} + +xen_setvars() { + . /etc/xen/scripts/hotplugpath.sh + + XENQEMUDEV_PIDFILE=/run/xenqemudev.pid + + # xen-4.5 change the path + XEN_QEMU="${LIBEXEC}/qemu-system-i386" + [ -e ${XEN_QEMU} ] && return + XEN_QEMU="${LIBEXEC_BIN}/qemu-system-i386" +} + +xen_qemu_start() { + if [ -z "${XENQEMUDEV_FILE_BACKEND_ENABLE}" ]; then + ewarn " QEMU disk backend not enabled" + ewarn " enable XENQEMUDEV_FILE_BACKEND_ENABLE in /etc/conf.d/xenqemudev" + return 1 + fi + + xen_setvars + + if [ ! -c /dev/xen/gntdev ]; then + einfo " Xen gntdev driver not loaded" + return 1 + fi + + if [ -e "${XEN_QEMU}" ]; then + einfo " Starting QEMU as disk backend for dom0" + + XENQEMUDEV_DEFAULT_OPTS="-xen-domid 0 -xen-attach -name dom0 \ + -nographic -M xenpv -daemonize \ + -monitor /dev/null -serial /dev/null -parallel /dev/null" + + XENQEMUDEV_OPTS=${XENQEMUDEV_OPTS:-${XENQEMUDEV_DEFAULT_OPTS}} + + start-stop-daemon --start --exec ${XEN_QEMU} \ + --pidfile ${XENQEMUDEV_PIDFILE} \ + -- -pidfile ${XENQEMUDEV_PIDFILE} \ + ${XENQEMUDEV_OPTS} + return $? + fi +} + +start() { + ebegin "Starting xenqemudev daemon" + + # not running in Xen dom0 or domU + if [ ! -d /proc/xen ]; then + eend 1 "Not running in Xen mode" + return 1 + fi + + if ! is_privileged_domain; then + eend 1 "Not running on a privileged domain. xenqemudev not started" + return 1 + fi + + xen_qemu_start + + eend $? "Failed to start xenqemudev" +} + +stop () { + ebegin "Stopping xenqemudev" + + xen_setvars + + start-stop-daemon --stop --exec ${XEN_QEMU} \ + --pidfile ${XENQEMUDEV_PIDFILE} + + eend $? "Stopping xenqemudev, as it cannot be restarted." +} diff --git a/app-emulation/xen-tools/files/xenstored.confd b/app-emulation/xen-tools/files/xenstored.confd new file mode 100644 index 000000000000..31b9293aa328 --- /dev/null +++ b/app-emulation/xen-tools/files/xenstored.confd @@ -0,0 +1,2 @@ +# /etc/conf.d/xenstored +XENSTORED_OPTS="" diff --git a/app-emulation/xen-tools/files/xenstored.initd b/app-emulation/xen-tools/files/xenstored.initd new file mode 100755 index 000000000000..05bcbb2725c2 --- /dev/null +++ b/app-emulation/xen-tools/files/xenstored.initd @@ -0,0 +1,44 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp + need xencommons +} + +xenstored_dir_check() { + # create dir dynamically + local i + for i in /var/lock/subsys /run/xen /run/xend/boot /run/xenstored; do + [ -x $i ] || mkdir -p $i + done +} + +start() { + ebegin "Starting xenstored daemon" + xenstored_dir_check + start-stop-daemon --start --exec /usr/sbin/xenstored \ + --pidfile /run/xenstored.pid \ + -- --pid-file=/run/xenstored.pid \ + $XENSTORED_OPTS + until xenstore-exists / || $((15 < ++i)) + do + echo -n . + sleep 1 + done + einfo "Setting domain0 name record" + /usr/bin/xenstore-write "/local/domain/0/name" "Domain-0" + local V=$(xl info| awk "/xen_minor/ { print \$3 }") + [ $V -ge 4 ] && /usr/bin/xenstore-write "/local/domain/0/domid" 0 + + eend $* +} + +stop() { + ebegin "Stopping xenstored daemon" + start-stop-daemon --stop --exec /usr/sbin/xenstored \ + --pidfile /run/xenstored.pid + eend $? +} + diff --git a/app-emulation/xen-tools/metadata.xml b/app-emulation/xen-tools/metadata.xml new file mode 100644 index 000000000000..dfd18d1ce581 --- /dev/null +++ b/app-emulation/xen-tools/metadata.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>xen</herd> + <use> + <flag name='api'>Build the C libxenapi bindings</flag> + <flag name='flask'>Enable the Flask XSM module from NSA</flag> + <flag name='hvm'>Enable support for hardware based virtualization (VT-x,AMD-v)</flag> + <flag name='qemu'>Enable IOEMU support via the use of qemu-dm</flag> + <flag name='pygrub'>Install the pygrub boot loader</flag> + <flag name='screen'>Enable support for running domain U console in an <pkg>app-misc/screen</pkg> session</flag> + <flag name='system-qemu'>Using <pkg>app-emulation/qemu</pkg> instead of the bundled one</flag> + <flag name='system-seabios'>Using <pkg>sys-firmware/seabios</pkg> instead of the bundled one</flag> + <flag name='ocaml'>Enable support for the ocaml language</flag> + <flag name='ovmf'>Enable support to boot UEFI guest vm, needed by hvm</flag> + <flag name='pam'>Enable pam support</flag> + </use> +</pkgmetadata> diff --git a/app-emulation/xen-tools/xen-tools-4.2.5-r10.ebuild b/app-emulation/xen-tools/xen-tools-4.2.5-r10.ebuild new file mode 100644 index 000000000000..852e499aec22 --- /dev/null +++ b/app-emulation/xen-tools/xen-tools-4.2.5-r10.ebuild @@ -0,0 +1,391 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 ) +PYTHON_REQ_USE='xml,threads' + +if [[ $PV == *9999 ]]; then + KEYWORDS="" + REPO="xen-unstable.hg" + EHG_REPO_URI="http://xenbits.xensource.com/${REPO}" + S="${WORKDIR}/${REPO}" + live_eclass="mercurial" +else + KEYWORDS="amd64 x86" + UPSTREAM_VER=9 + SECURITY_VER=6 + # xen-tools's gentoo patches tarball + GENTOO_VER=1 + # xen-tools's gentoo patches version which apply to this specific ebuild + GENTOO_GPV=0 + SEABIOS_VER=1.6.3.2 + + [[ -n ${UPSTREAM_VER} ]] && \ + UPSTREAM_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz" + [[ -n ${SECURITY_VER} ]] && \ + SECURITY_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz" + [[ -n ${GENTOO_VER} ]] && \ + GENTOO_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${PN/-tools/}-gentoo-patches-${GENTOO_VER}.tar.xz" + + SRC_URI="http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz + http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz + http://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz + ${UPSTREAM_PATCHSET_URI} + ${SECURITY_PATCHSET_URI} + ${GENTOO_PATCHSET_URI}" + S="${WORKDIR}/xen-${PV}" +fi + +inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs udev ${live_eclass} + +DESCRIPTION="Xend daemon and tools" +HOMEPAGE="http://xen.org/" +DOCS=( README docs/README.xen-bugtool ) + +LICENSE="GPL-2" +SLOT="0" +IUSE="api custom-cflags debug doc flask hvm qemu ocaml pygrub screen static-libs system-seabios" + +REQUIRED_USE="hvm? ( qemu ) + ${PYTHON_REQUIRED_USE}" + +DEPEND="dev-libs/lzo:2 + dev-libs/glib:2 + dev-libs/yajl + dev-libs/libgcrypt:0 + dev-python/lxml[${PYTHON_USEDEP}] + dev-python/pypam[${PYTHON_USEDEP}] + sys-libs/zlib + sys-power/iasl + system-seabios? ( sys-firmware/seabios ) + sys-firmware/ipxe + dev-ml/findlib + hvm? ( media-libs/libsdl ) + ${PYTHON_DEPS} + api? ( dev-libs/libxml2 + net-misc/curl ) + ${PYTHON_DEPS} + pygrub? ( ${PYTHON_DEPS//${PYTHON_REQ_USE}/ncurses} ) + sys-devel/bin86 + sys-devel/dev86 + dev-lang/perl + app-misc/pax-utils + doc? ( + app-doc/doxygen + dev-tex/latex2html[png,gif] + media-gfx/transfig + media-gfx/graphviz + dev-tex/xcolor + dev-texlive/texlive-latexextra + virtual/latex-base + dev-tex/latexmk + dev-texlive/texlive-latex + dev-texlive/texlive-pictures + dev-texlive/texlive-latexrecommended + ) + hvm? ( x11-proto/xproto + !net-libs/libiscsi )" +RDEPEND="sys-apps/iproute2 + net-misc/bridge-utils + ocaml? ( >=dev-lang/ocaml-4 ) + screen? ( + app-misc/screen + app-admin/logrotate + ) + virtual/udev" + +# hvmloader is used to bootstrap a fully virtualized kernel +# Approved by QA team in bug #144032 +QA_WX_LOAD="usr/lib/xen/boot/hvmloader" + +RESTRICT="test" + +pkg_setup() { + python-single-r1_pkg_setup + export "CONFIG_LOMOUNT=y" + + #bug 522642, disable compile tools/tests + export "CONFIG_TESTS=n" + + if has_version dev-libs/libgcrypt:0; then + export "CONFIG_GCRYPT=y" + fi + + if use qemu; then + export "CONFIG_IOEMU=y" + else + export "CONFIG_IOEMU=n" + fi + + if [[ -z ${XEN_TARGET_ARCH} ]] ; then + if use x86 && use amd64; then + die "Confusion! Both x86 and amd64 are set in your use flags!" + elif use x86; then + export XEN_TARGET_ARCH="x86_32" + elif use amd64 ; then + export XEN_TARGET_ARCH="x86_64" + else + die "Unsupported architecture!" + fi + fi + + use api && export "LIBXENAPI_BINDINGS=y" + use flask && export "FLASK_ENABLE=y" +} + +src_prepare() { + # Upstream's patchset + if [[ -n ${UPSTREAM_VER} ]]; then + einfo "Try to apply Xen Upstream patcheset" + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + EPATCH_OPTS="-p1" \ + epatch "${WORKDIR}"/patches-upstream + fi + + # Security patchset + if [[ -n ${SECURITY_VER} ]]; then + einfo "Try to apply Xen Security patcheset" + source "${WORKDIR}"/patches-security/${PV}.conf + # apply main xen patches + for i in ${XEN_SECURITY_MAIN}; do + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}"/patches-security/xen/$i + done + + # apply qemu-traditional patches + pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null + for i in ${XEN_SECURITY_QEMUT}; do + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}"/patches-security/qemut/$i + done + popd > /dev/null + + # apply qemu-xen/upstream patches + pushd "${S}"/tools/qemu-xen/ > /dev/null + for i in ${XEN_SECURITY_QEMUU}; do + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}"/patches-security/qemuu/$i + done + popd > /dev/null + fi + + # Gentoo's patchset + if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then + einfo "Try to apply Gentoo specific patcheset" + source "${FILESDIR}"/gentoo-patches.conf + _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV} + for i in ${!_gpv}; do + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}"/patches-gentoo/$i + done + fi + + use system-seabios && epatch "${WORKDIR}"/patches-gentoo/${PN}-4-unbundle-seabios.patch + + if gcc-specs-pie; then + epatch "${WORKDIR}"/patches-gentoo/ipxe-nopie.patch + fi + + # if the user *really* wants to use their own custom-cflags, let them + if use custom-cflags; then + einfo "User wants their own CFLAGS - removing defaults" + + # try and remove all the default cflags + find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \ + -exec sed \ + -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \ + -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \ + -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \ + -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \ + -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \ + -i {} + || die "failed to re-set custom-cflags" + fi + + if ! use pygrub; then + sed -e '/^SUBDIRS-$(PYTHON_TOOLS) += pygrub$/d' -i tools/Makefile || die + fi + + # Disable hvm support on systems that don't support x86_32 binaries. + if ! use hvm; then + sed -e '/^CONFIG_IOEMU := y$/d' -i config/*.mk || die + sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die + # Bug 351648 + elif ! use x86 && ! has x86 $(get_all_abis); then + mkdir -p "${WORKDIR}"/extra-headers/gnu || die + touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die + export CPATH="${WORKDIR}"/extra-headers + fi + + # Don't bother with qemu, only needed for fully virtualised guests + if ! use qemu; then + sed -e "/^CONFIG_IOEMU := y$/d" -i config/*.mk || die + sed -e "s:install-tools\: tools/ioemu-dir:install-tools\: :g" -i Makefile || die + fi + + mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die + pushd tools/firmware/ > /dev/null + ln -s seabios-dir-remote seabios-dir || die + popd > /dev/null + + # Reset bash completion dir; Bug 472438 + sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \ + -i Config.mk || die + sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die + + # Bug 445986 + sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' -i tools/firmware/Makefile || die + + # fix QA warning, create /var/run/, /var/lock dynamically + sed -i -e "/\$(INSTALL_DIR) \$(DESTDIR)\$(XEN_RUN_DIR)/d" \ + tools/libxl/Makefile || die + + sed -i -e "/\/var\/run\//d" \ + tools/xenstore/Makefile \ + tools/pygrub/Makefile || die + + sed -i -e "/\/var\/lock\/subsys/d" \ + tools/Makefile || die + + # xencommons, Bug #492332, sed lighter weight than patching + sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \ + -i tools/hotplug/Linux/init.d/xencommons || die + + epatch_user +} + +src_compile() { + export VARTEXFONTS="${T}/fonts" + local myopt + use debug && myopt="${myopt} debug=y" + + use custom-cflags || unset CFLAGS + if test-flag-CC -fno-strict-overflow; then + append-flags -fno-strict-overflow + fi + + unset LDFLAGS + unset CFLAGS + emake V=1 CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" -C tools ${myopt} + + use doc && emake -C docs txt html + emake -C docs man-pages +} + +src_install() { + # Override auto-detection in the build system, bug #382573 + export INITD_DIR=/tmp/init.d + export CONFIG_LEAF_DIR=../tmp/default + + # Let the build system compile installed Python modules. + local PYTHONDONTWRITEBYTECODE + export PYTHONDONTWRITEBYTECODE + + emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" install-tools \ + XEN_PYTHON_NATIVE_INSTALL=y install-tools + # Fix the remaining Python shebangs. + python_fix_shebang "${ED}" + + # Remove RedHat-specific stuff + rm -rf "${D}"tmp || die + + # uncomment lines in xl.conf + sed -e 's:^#autoballoon=1:autoballoon=1:' \ + -e 's:^#lockfile="/var/lock/xl":lockfile="/var/lock/xl":' \ + -e 's:^#vifscript="vif-bridge":vifscript="vif-bridge":' \ + -i tools/examples/xl.conf || die + + if use doc; then + emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs + + dohtml -r docs/ + docinto pdf + dodoc ${DOCS[@]} + [ -d "${D}"/usr/share/doc/xen ] && mv "${D}"/usr/share/doc/xen/* "${D}"/usr/share/doc/${PF}/html + fi + + rm -rf "${D}"/usr/share/doc/xen/ + doman docs/man?/* + + newconfd "${FILESDIR}"/xendomains.confd xendomains + newconfd "${FILESDIR}"/xenstored.confd xenstored + newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled + newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains + newinitd "${FILESDIR}"/xenstored.initd xenstored + newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled + newinitd "${FILESDIR}"/xencommons.initd xencommons + newconfd "${FILESDIR}"/xencommons.confd xencommons + + if use screen; then + cat "${FILESDIR}"/xendomains-screen.confd >> "${ED}"/etc/conf.d/xendomains || die + cp "${FILESDIR}"/xen-consoles.logrotate "${ED}"/etc/xen/ || die + keepdir /var/log/xen-consoles + fi + + if [[ "${ARCH}" == 'amd64' ]] && use qemu; then + mkdir -p "${D}"usr/$(get_libdir)/xen/bin || die + mv "${D}"usr/lib/xen/bin/qemu* "${D}"usr/$(get_libdir)/xen/bin/ || die + fi + + # For -static-libs wrt Bug 384355 + if ! use static-libs; then + rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a + fi + + # xend expects these to exist + keepdir /var/lib/xenstored /var/xen/dump /var/lib/xen /var/log/xen + + # for xendomains + keepdir /etc/xen/auto + + # Temp QA workaround + dodir "$(get_udevdir)" + mv "${D}"/etc/udev/* "${D}/$(get_udevdir)" + rm -rf "${D}"/etc/udev + + # Remove files failing QA AFTER emake installs them, avoiding seeking absent files + find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \ + -o -name openbios-ppc -o -name palcode-clipper \) -delete || die +} + +pkg_postinst() { + elog "Official Xen Guide and the offical wiki page:" + elog "http://www.gentoo.org/doc/en/xen-gu"${D}"usr/ide.xml" + elog "http://wiki.xen.org/wiki/Main_Page" + elog "" + elog "Recommended to utilise the xencommons script to config sytem at boot." + elog "Add by use of rc-update on completion of the install" + + # TODO: we need to have the current Python slot here. + if ! has_version "dev-lang/python[ncurses]"; then + echo + ewarn "NB: Your dev-lang/python is built without USE=ncurses." + ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py." + fi + + if has_version "sys-apps/iproute2[minimal]"; then + echo + ewarn "Your sys-apps/iproute2 is built with USE=minimal. Networking" + ewarn "will not work until you rebuild iproute2 without USE=minimal." + fi + + if ! use hvm; then + echo + elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm" + elog "support enable the hvm use flag." + elog "An x86 or amd64 system is required to build HVM support." + fi + + if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then + echo + elog "xensv is broken upstream (Gentoo bug #142011)." + elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed." + fi +} diff --git a/app-emulation/xen-tools/xen-tools-4.5.1-r3.ebuild b/app-emulation/xen-tools/xen-tools-4.5.1-r3.ebuild new file mode 100644 index 000000000000..d24a5b87d348 --- /dev/null +++ b/app-emulation/xen-tools/xen-tools-4.5.1-r3.ebuild @@ -0,0 +1,458 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +MY_PV=${PV/_/-} + +PYTHON_COMPAT=( python2_7 ) +PYTHON_REQ_USE='xml,threads' + +if [[ $PV == *9999 ]]; then + KEYWORDS="" + REPO="xen-unstable.hg" + EHG_REPO_URI="http://xenbits.xensource.com/${REPO}" + S="${WORKDIR}/${REPO}" + live_eclass="mercurial" +else + KEYWORDS="amd64 ~arm ~arm64 -x86" + UPSTREAM_VER=0 + SECURITY_VER=6 + # xen-tools's gentoo patches tarball + GENTOO_VER=4 + # xen-tools's gentoo patches version which apply to this specific ebuild + GENTOO_GPV=0 + # xen-tools ovmf's patches + OVMF_VER=1 + + SEABIOS_VER=1.7.5 + OVMF_PV=20150629 + + [[ -n ${UPSTREAM_VER} ]] && \ + UPSTREAM_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz" + [[ -n ${SECURITY_VER} ]] && \ + SECURITY_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz" + [[ -n ${GENTOO_VER} ]] && \ + GENTOO_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz" + [[ -n ${OVMF_VER} ]] && \ + OVMF_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz" + + SRC_URI="http://bits.xensource.com/oss-xen/release/${MY_PV}/xen-${MY_PV}.tar.gz + http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz + http://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz + ovmf? ( http://dev.gentoo.org/~dlan/distfiles/ovmf-${OVMF_PV}.tar.bz2 + ${OVMF_PATCHSET_URI} ) + ${UPSTREAM_PATCHSET_URI} + ${SECURITY_PATCHSET_URI} + ${GENTOO_PATCHSET_URI}" + S="${WORKDIR}/xen-${MY_PV}" +fi + +inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs udev ${live_eclass} + +DESCRIPTION="Xend daemon and tools" +HOMEPAGE="http://xen.org/" +DOCS=( README docs/README.xen-bugtool ) + +LICENSE="GPL-2" +SLOT="0" +# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make +# >=dev-lang/ocaml-4 stable +# Masked in profiles/eapi-5-files instead +IUSE="api custom-cflags debug doc flask hvm qemu ocaml ovmf +pam python pygrub screen static-libs system-qemu system-seabios" + +REQUIRED_USE="hvm? ( || ( qemu system-qemu ) ) + ${PYTHON_REQUIRED_USE} + pygrub? ( python ) + ovmf? ( hvm ) + qemu? ( !system-qemu )" + +COMMON_DEPEND=" + dev-libs/lzo:2 + dev-libs/glib:2 + dev-libs/yajl + dev-libs/libaio + dev-libs/libgcrypt:0 + sys-libs/zlib +" + +DEPEND="${COMMON_DEPEND} + dev-python/lxml[${PYTHON_USEDEP}] + pam? ( dev-python/pypam[${PYTHON_USEDEP}] ) + hvm? ( media-libs/libsdl ) + ${PYTHON_DEPS} + api? ( dev-libs/libxml2 + net-misc/curl ) + pygrub? ( ${PYTHON_DEPS//${PYTHON_REQ_USE}/ncurses} ) + ovmf? ( ${PYTHON_DEPS//${PYTHON_REQ_USE}/sqlite} ) + !amd64? ( >=sys-apps/dtc-1.4.0 ) + amd64? ( sys-devel/bin86 + system-seabios? ( sys-firmware/seabios ) + sys-firmware/ipxe + sys-devel/dev86 + sys-power/iasl ) + dev-lang/perl + app-misc/pax-utils + dev-python/markdown[${PYTHON_USEDEP}] + doc? ( + app-doc/doxygen + dev-tex/latex2html[png,gif] + media-gfx/graphviz + dev-tex/xcolor + media-gfx/transfig + dev-texlive/texlive-latexextra + virtual/latex-base + dev-tex/latexmk + dev-texlive/texlive-latex + dev-texlive/texlive-pictures + dev-texlive/texlive-latexrecommended + ) + hvm? ( x11-proto/xproto + !net-libs/libiscsi ) + qemu? ( x11-libs/pixman ) + system-qemu? ( app-emulation/qemu[xen] ) + ocaml? ( dev-ml/findlib + >=dev-lang/ocaml-4 )" + +RDEPEND="${COMMON_DEPEND} + sys-apps/iproute2 + net-misc/bridge-utils + screen? ( + app-misc/screen + app-admin/logrotate + ) + virtual/udev" + +# hvmloader is used to bootstrap a fully virtualized kernel +# Approved by QA team in bug #144032 +QA_WX_LOAD="usr/lib/xen/boot/hvmloader + usr/share/qemu-xen/qemu/s390-ccw.img" + +RESTRICT="test" + +pkg_setup() { + python-single-r1_pkg_setup + export "CONFIG_LOMOUNT=y" + + #bug 522642, disable compile tools/tests + export "CONFIG_TESTS=n" + + if has_version dev-libs/libgcrypt:0; then + export "CONFIG_GCRYPT=y" + fi + + if [[ -z ${XEN_TARGET_ARCH} ]] ; then + if use x86 && use amd64; then + die "Confusion! Both x86 and amd64 are set in your use flags!" + elif use x86; then + export XEN_TARGET_ARCH="x86_32" + elif use amd64 ; then + export XEN_TARGET_ARCH="x86_64" + elif use arm; then + export XEN_TARGET_ARCH="arm32" + elif use arm64; then + export XEN_TARGET_ARCH="arm64" + else + die "Unsupported architecture!" + fi + fi +} + +src_prepare() { + # Upstream's patchset + if [[ -n ${UPSTREAM_VER} ]]; then + einfo "Try to apply Xen Upstream patcheset" + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + EPATCH_OPTS="-p1" \ + epatch "${WORKDIR}"/patches-upstream + fi + + # Security patchset + if [[ -n ${SECURITY_VER} ]]; then + einfo "Try to apply Xen Security patcheset" + source "${WORKDIR}"/patches-security/${PV}.conf + # apply main xen patches + for i in ${XEN_SECURITY_MAIN}; do + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}"/patches-security/xen/$i + done + + # apply qemu-traditional patches + pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null + for i in ${XEN_SECURITY_QEMUT}; do + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}"/patches-security/qemut/$i + done + popd > /dev/null + + # apply qemu-xen/upstream patches + pushd "${S}"/tools/qemu-xen/ > /dev/null + for i in ${XEN_SECURITY_QEMUU}; do + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}"/patches-security/qemuu/$i + done + popd > /dev/null + fi + + # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err + mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die + pushd tools/firmware/ > /dev/null + ln -s seabios-dir-remote seabios-dir || die + popd > /dev/null + + # Gentoo's patchset + if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then + einfo "Try to apply Gentoo specific patcheset" + source "${FILESDIR}"/gentoo-patches.conf + _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV} + for i in ${!_gpv}; do + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + epatch "${WORKDIR}"/patches-gentoo/$i + done + fi + + # Ovmf's patchset + if [[ -n ${OVMF_VER} ]] && use ovmf; then + einfo "Try to apply Ovmf patcheset" + pushd "${WORKDIR}"/ovmf-*/ > /dev/null + EPATCH_SUFFIX="patch" \ + EPATCH_FORCE="yes" \ + EPATCH_OPTS="-p1" \ + epatch "${WORKDIR}"/patches-ovmf + popd > /dev/null + mv ../ovmf-${OVMF_PV} tools/firmware/ovmf-dir-remote || die + fi + + mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die + + # Fix texi2html build error with new texi2html, qemu.doc.html + sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die + + use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die + sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \ + -i tools/firmware/Makefile || die + + # Drop .config, fixes to gcc-4.6 + sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop" + + # if the user *really* wants to use their own custom-cflags, let them + if use custom-cflags; then + einfo "User wants their own CFLAGS - removing defaults" + + # try and remove all the default cflags + find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \ + -exec sed \ + -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \ + -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \ + -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \ + -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \ + -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \ + -i {} + || die "failed to re-set custom-cflags" + fi + + if ! use pygrub; then + sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die + fi + + if ! use python; then + sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die + fi + + if ! use hvm; then + sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die + # Bug 351648 + elif ! use x86 && ! has x86 $(get_all_abis); then + mkdir -p "${WORKDIR}"/extra-headers/gnu || die + touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die + export CPATH="${WORKDIR}"/extra-headers + fi + + # Don't bother with qemu, only needed for fully virtualised guests + if ! use qemu; then + sed -e "s:install-tools\: tools/qemu-xen-traditional-dir:install-tools\: :g" -i Makefile || die + fi + + # Reset bash completion dir; Bug 472438 + sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \ + -i Config.mk || die + sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die + + # xencommons, Bug #492332, sed lighter weight than patching + sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \ + -i tools/hotplug/Linux/init.d/xencommons.in || die + + # respect multilib, usr/lib/libcacard.so.0.0.0 + sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \ + -i tools/qemu-xen/configure || die + + #bug 518136, don't build 32bit exactuable for nomultilib profile + if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then + sed -i -e "/x86_emulator/d" tools/tests/Makefile || die + fi + + # use /var instead of /var/lib, consistat with previous ebuild + sed -i -e "/XEN_LOCK_DIR=/s/\$localstatedir/\/var/g" \ + m4/paths.m4 configure tools/configure || die + # use /run instead of /var/run + sed -i -e "/XEN_RUN_DIR=/s/\$localstatedir//g" \ + m4/paths.m4 configure tools/configure || die + + # uncomment lines in xl.conf + sed -e 's:^#autoballoon=:autoballoon=:' \ + -e 's:^#lockfile=:lockfile=:' \ + -e 's:^#vif.default.script=:vif.default.script=:' \ + -i tools/examples/xl.conf || die + + epatch_user +} + +src_configure() { + local myconf="--prefix=${PREFIX}/usr \ + --libdir=${PREFIX}/usr/$(get_libdir) \ + --libexecdir=${PREFIX}/usr/libexec \ + --disable-werror \ + --disable-xen \ + --enable-tools \ + --enable-docs \ + $(use_with system-qemu) \ + $(use_enable pam) \ + $(use_enable api xenapi) \ + $(use_enable ovmf) \ + $(use_enable ocaml ocamltools) \ + " + use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin" + use qemu || myconf+=" --with-system-qemu" + use amd64 && myconf+=" --enable-qemu-traditional" + econf ${myconf} +} + +src_compile() { + export VARTEXFONTS="${T}/fonts" + local myopt + use debug && myopt="${myopt} debug=y" + + use custom-cflags || unset CFLAGS + if test-flag-CC -fno-strict-overflow; then + append-flags -fno-strict-overflow + fi + + unset LDFLAGS + unset CFLAGS + emake V=1 CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" -C tools ${myopt} + + use doc && emake -C docs txt html + emake -C docs man-pages +} + +src_install() { + # Override auto-detection in the build system, bug #382573 + export INITD_DIR=/tmp/init.d + export CONFIG_LEAF_DIR=../tmp/default + + # Let the build system compile installed Python modules. + local PYTHONDONTWRITEBYTECODE + export PYTHONDONTWRITEBYTECODE + + emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \ + XEN_PYTHON_NATIVE_INSTALL=y install-tools + + # Fix the remaining Python shebangs. + python_fix_shebang "${D}" + + # Remove RedHat-specific stuff + rm -rf "${D}"tmp || die + + if use doc; then + emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs + + dohtml -r docs/ + docinto pdf + dodoc ${DOCS[@]} + [ -d "${D}"/usr/share/doc/xen ] && mv "${D}"/usr/share/doc/xen/* "${D}"/usr/share/doc/${PF}/html + fi + + rm -rf "${D}"/usr/share/doc/xen/ + doman docs/man?/* + + newconfd "${FILESDIR}"/xendomains.confd xendomains + newconfd "${FILESDIR}"/xenstored.confd xenstored + newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled + newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains + newinitd "${FILESDIR}"/xenstored.initd xenstored + newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled + newinitd "${FILESDIR}"/xencommons.initd xencommons + newconfd "${FILESDIR}"/xencommons.confd xencommons + newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev + newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev + + if use screen; then + cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die + cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die + keepdir /var/log/xen-consoles + fi + + # For -static-libs wrt Bug 384355 + if ! use static-libs; then + rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a + fi + + # for xendomains + keepdir /etc/xen/auto + + # Temp QA workaround + dodir "$(get_udevdir)" + mv "${D}"/etc/udev/* "${D}/$(get_udevdir)" + rm -rf "${D}"/etc/udev + + # Remove files failing QA AFTER emake installs them, avoiding seeking absent files + find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \ + -o -name openbios-ppc -o -name palcode-clipper \) -delete || die +} + +pkg_postinst() { + elog "Official Xen Guide and the offical wiki page:" + elog "https://wiki.gentoo.org/wiki/Xen" + elog "http://wiki.xen.org/wiki/Main_Page" + elog "" + elog "Recommended to utilise the xencommons script to config sytem At boot" + elog "Add by use of rc-update on completion of the install" + + # TODO: we need to have the current Python slot here. + if ! has_version "dev-lang/python[ncurses]"; then + echo + ewarn "NB: Your dev-lang/python is built without USE=ncurses." + ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py." + fi + + if has_version "sys-apps/iproute2[minimal]"; then + echo + ewarn "Your sys-apps/iproute2 is built with USE=minimal. Networking" + ewarn "will not work until you rebuild iproute2 without USE=minimal." + fi + + if ! use hvm; then + echo + elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm" + elog "support enable the hvm use flag." + elog "An x86 or amd64 system is required to build HVM support." + fi + + if use qemu; then + elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source" + elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently" + elog "with the qemu capable xen. It is up to the user to distinguish between and utilise" + elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise" + fi + + if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then + echo + elog "xensv is broken upstream (Gentoo bug #142011)." + elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed." + fi +} |