commit:     ad56bccb7e7bfbd2bdb78203bd28d692034fb448
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  4 10:30:07 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Tue Jul  5 16:20:56 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ad56bccb

app-emulation/xen: add 4.16.1, 4.16.2_pre1

This introduces a new approach to handle Xen patching and versioning. We
now consume the upstream patches from a repository called
xen-upstream-patches, which will ultimately be hosted by Gentoo
infra (e.g. available under gitweb.gentoo.org). The Gentoo patchset now
lives in a repository called xen-gentoo-patches, which will also be
hosted on Gentoo infra.

Furthermore we now follow upstreams versioning scheme. Previously we
would sell Xen 4.16.2-pre, which is from the staging-4.16 branch
containing security fixes, as Xen 4.16.1. To avoid confusion, we will
label the Xen versions as such, and Xen 4.16.1 will what is tagged
upstream as RELEASE-4.16.1 (+ the few Gentoo specific patches).

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 app-emulation/xen/Manifest               |   3 +
 app-emulation/xen/xen-4.16.1.ebuild      | 185 +++++++++++++++++++++++++++++++
 app-emulation/xen/xen-4.16.2_pre1.ebuild | 185 +++++++++++++++++++++++++++++++
 3 files changed, 373 insertions(+)

diff --git a/app-emulation/xen/Manifest b/app-emulation/xen/Manifest
index 76e074719419..0c9876da5844 100644
--- a/app-emulation/xen/Manifest
+++ b/app-emulation/xen/Manifest
@@ -2,3 +2,6 @@ DIST xen-4.15.2-upstream-patches-2.tar.xz 93208 BLAKE2B 
5b01953ba93551830e533cf7
 DIST xen-4.15.2.tar.gz 40773378 BLAKE2B 
7c3e3bb066505f9838cd7c56d85debc64e5ed32cf4d4edf699ff843db49bee916e6eb46d07e5cd9021c2644bba0628a2aa567f60ace26c6d7ee5922643e04104
 SHA512 
1cbf988fa8ed38b7ad724978958092ca0e5506e38c709c7d1af196fb8cb8ec0197a79867782761ef230b268624b3d7a0d5d0cd186f37d25f495085c71bf70d54
 DIST xen-4.16.0-upstream-patches-2.tar.xz 111668 BLAKE2B 
e8bbedb7cc50f7a6cb1a3869f0165cce3d02c33f04b935384e770aa5206e6aa6cb51329c5d69375391a8781ba23f20c35e06406d5164720d253b405a77f5aee9
 SHA512 
6b6770117e81ae407e3ded0e366b14f3fa2411cc93a95187db27548c3dd17a1f85e60fc3971b008693297ad97aa0c5fa7b4d88e01d67a972f39e51bf0a2cf39d
 DIST xen-4.16.0.tar.gz 44982322 BLAKE2B 
7e16a93b3f1131e2b10307fabc10641a9c5983173155b9a35eaf6ff317b6a747bccf6b8c87c06686830acc2c4bd3e19e5867eb443eabac9a1e4ee59124dfa87f
 SHA512 
2869ed90d1779c9754d7f2397f5fc67a655304d9c32953ac20655ef96cb154521d8fce9f23915ac0c91f984dc54f72c67e5e619e2da318b5997748f44cf21b87
+DIST xen-4.16.1.tar.gz 44964667 BLAKE2B 
190d9c330b5dcdd47bae26b6ef42111c9c63b71b8b92e20eae268054c6b40aaabadef78c0c9634cb3c3b1bde32a746cbb1404b5eed2a82ab829ba10632103856
 SHA512 
eeabba9c263cd2425bca083e32b5ebfc6c716c00553759c144fd4b6f64a89836b260787fa25ba22c1f5c4ea65aaad7c95b8c2c1070d3377b1c43c9517aa7032a
+DIST xen-gentoo-patches-4.16.1-gentoo-patchset-0.tar.gz 5289 BLAKE2B 
4946056ee631ec0fa4d29f1cd643f66b491ef3ea049755d10d7b8e189f02816b990e53bffbeeeae0a61fb4e20aa877f5903a8aadfb26d0c78566a0e9fde540c7
 SHA512 
59d4101879bd18e828349db3814a9082b85c5ba8203ce98e5082491a9ede9c832a02ac7e4d7a0a51a52e38b72e5cce1eea6a09d6c5202e96bfe2aa4d47e12e65
+DIST xen-upstream-patches-4.16.2-pre-patchset-0.tar.gz 46026 BLAKE2B 
57bca21962c9a451316f486f5db94e9c1b98b5e029a15dbd702007d573fe02571e648866c9ddbc293e53ceb5de92122b13d21e28c8879d918129134725c9ff91
 SHA512 
f665640fc686dfc5f718531601f66e3f30c4c8c7cb78293b6a615fe9f53a3763f2c864642a19336bb077d432b776ab1c9fa39e6fa5857ca3360e4d1b1ce63f50

diff --git a/app-emulation/xen/xen-4.16.1.ebuild 
b/app-emulation/xen/xen-4.16.1.ebuild
new file mode 100644
index 000000000000..e4073b7cad14
--- /dev/null
+++ b/app-emulation/xen/xen-4.16.1.ebuild
@@ -0,0 +1,185 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+
+inherit flag-o-matic mount-boot python-any-r1 toolchain-funcs
+
+if [[ ${PV} == *9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="git://xenbits.xen.org/xen.git"
+       SRC_URI=""
+else
+       KEYWORDS="~amd64 ~arm -x86"
+
+       XEN_PRE_PATCHSET_NUM=
+       XEN_GENTOO_PATCHSET_NUM=0
+       XEN_PRE_VERSION_BASE=
+
+       XEN_BASE_PV="${PV}"
+       if [[ -n "${XEN_PRE_VERSION_BASE}" ]]; then
+               XEN_BASE_PV="${XEN_PRE_VERSION_BASE}"
+       fi
+
+       
SRC_URI="https://downloads.xenproject.org/release/xen/${XEN_BASE_PV}/xen-${XEN_BASE_PV}.tar.gz";
+
+       if [[ -n "${XEN_PRE_PATCHSET_NUM}" ]]; then
+               XEN_UPSTREAM_PATCHES_TAG="$(ver_cut 
1-3)-pre-patchset-${XEN_PRE_PATCHSET_NUM}"
+               
XEN_UPSTREAM_PATCHES_NAME="xen-upstream-patches-${XEN_UPSTREAM_PATCHES_TAG}"
+               SRC_URI+=" 
https://github.com/Flowdalic/xen-upstream-patches/archive/refs/tags/${XEN_UPSTREAM_PATCHES_TAG}.tar.gz
 -> ${XEN_UPSTREAM_PATCHES_NAME}.tar.gz"
+               
XEN_UPSTREAM_PATCHES_DIR="${WORKDIR}/${XEN_UPSTREAM_PATCHES_NAME}"
+       fi
+       if [[ -n "${XEN_GENTOO_PATCHSET_NUM}" ]]; then
+               XEN_GENTOO_PATCHES_TAG="$(ver_cut 1-3 
${XEN_BASE_PV})-gentoo-patchset-${XEN_GENTOO_PATCHSET_NUM}"
+               
XEN_GENTOO_PATCHES_NAME="xen-gentoo-patches-${XEN_GENTOO_PATCHES_TAG}"
+               SRC_URI+=" 
https://github.com/Flowdalic/xen-gentoo-patches/archive/refs/tags/${XEN_GENTOO_PATCHES_TAG}.tar.gz
 -> ${XEN_GENTOO_PATCHES_NAME}.tar.gz"
+               XEN_GENTOO_PATCHES_DIR="${WORKDIR}/${XEN_GENTOO_PATCHES_NAME}"
+       fi
+fi
+
+DESCRIPTION="The Xen virtual machine monitor"
+HOMEPAGE="https://xenproject.org";
+
+S="${WORKDIR}/xen-$(ver_cut 1-3 ${XEN_BASE_PV})"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="+boot-symlinks debug efi flask"
+REQUIRED_USE="arm? ( debug )"
+
+DEPEND="${PYTHON_DEPS}
+       efi? ( >=sys-devel/binutils-2.22[multitarget] )
+       !efi? ( >=sys-devel/binutils-2.22 )
+       flask? ( sys-apps/checkpolicy )"
+RDEPEND=""
+PDEPEND="~app-emulation/xen-tools-${PV}"
+
+# no tests are available for the hypervisor
+# prevent the silliness of /usr/lib/debug/usr/lib/debug files
+# prevent stripping of the debug info from the /usr/lib/debug/xen-syms
+RESTRICT="test splitdebug strip"
+
+# Approved by QA team in bug #144032
+QA_WX_LOAD="boot/xen-syms-${PV}"
+
+pkg_setup() {
+       python-any-r1_pkg_setup
+       if [[ -z ${XEN_TARGET_ARCH} ]]; then
+               if 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() {
+       if [[ -v XEN_UPSTREAM_PATCHES_DIR ]]; then
+               eapply "${XEN_UPSTREAM_PATCHES_DIR}"
+       fi
+
+       if [[ -v XEN_GENTOO_PATCHES_DIR ]]; then
+               eapply "${XEN_GENTOO_PATCHES_DIR}"
+       fi
+
+       eapply "${FILESDIR}"/${PN}-4.16-efi.patch
+
+       # Symlinks do not work on fat32 volumes # 829765
+       if ! use boot-symlinks || use efi; then
+               eapply "${FILESDIR}"/${PN}-4.16-no-symlink.patch
+       fi
+
+       # Workaround new gcc-11 options
+       sed -e '/^CFLAGS/s/-Werror//g' -i xen/Makefile || die
+
+       # Drop .config
+       sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't 
drop"
+
+       if use efi; then
+               export EFI_VENDOR="gentoo"
+               export EFI_MOUNTPOINT="/boot"
+       fi
+
+       default
+}
+
+xen_make() {
+       # Setting clang to either 'y' or 'n' tells Xen's build system
+       # whether or not clang is used.
+       local clang=n
+       if tc-is-clang; then
+               clang=y
+       fi
+
+       # Send raw LDFLAGS so that --as-needed works
+       emake \
+               V=1 \
+               LDFLAGS="$(raw-ldflags)" \
+               HOSTCC="$(tc-getBUILD_CC)" \
+               HOSTCXX="$(tc-getBUILD_CXX)" \
+               clang="${clang}" \
+               "$@"
+}
+
+src_configure() {
+       cd xen || die
+
+       touch gentoo-config || die
+       if use arm; then
+          echo "CONFIG_EARLY_PRINTK=sun7i" >> gentoo-config || die
+       fi
+       if use debug; then
+               cat <<-EOF >> gentoo-config || die
+               CONFIG_DEBUG=y
+               CONFIG_CRASH_DEBUG=y
+EOF
+       fi
+       if use flask; then
+               echo "CONFIG_XSM=y" >> gentoo-config || die
+       fi
+
+       # remove flags
+       unset CFLAGS
+
+       tc-ld-disable-gold # Bug 700374
+
+       xen_make KCONFIG_ALLCONFIG=gentoo-config alldefconfig
+}
+
+src_compile() {
+       xen_make -C xen
+}
+
+src_install() {
+       # The 'make install' doesn't 'mkdir -p' the subdirs
+       if use efi; then
+               mkdir -p "${D}"${EFI_MOUNTPOINT}/efi/${EFI_VENDOR} || die
+       fi
+
+       xen_make DESTDIR="${D}" -C xen install
+
+       # make install likes to throw in some extra EFI bits if it built
+       use efi || rm -rf "${D}/usr/$(get_libdir)/efi"
+}
+
+pkg_postinst() {
+       elog "Official Xen Guide:"
+       elog " https://wiki.gentoo.org/wiki/Xen";
+
+       use efi && einfo "The efi executable is installed in /boot/efi/gentoo"
+
+       ewarn
+       ewarn "Xen 4.12+ changed the default scheduler to credit2 which can 
cause"
+       ewarn "domU lockups on multi-cpu systems. The legacy credit scheduler 
seems"
+       ewarn "to work fine."
+       ewarn
+       ewarn "Add sched=credit to xen command line options to use the legacy 
scheduler."
+       ewarn
+       ewarn 
"https://wiki.gentoo.org/wiki/Xen#Xen_domU_hanging_with_Xen_4.12.2B";
+}

diff --git a/app-emulation/xen/xen-4.16.2_pre1.ebuild 
b/app-emulation/xen/xen-4.16.2_pre1.ebuild
new file mode 100644
index 000000000000..2e8dbf6d958b
--- /dev/null
+++ b/app-emulation/xen/xen-4.16.2_pre1.ebuild
@@ -0,0 +1,185 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+
+inherit flag-o-matic mount-boot python-any-r1 toolchain-funcs
+
+if [[ ${PV} == *9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="git://xenbits.xen.org/xen.git"
+       SRC_URI=""
+else
+       KEYWORDS="~amd64 ~arm -x86"
+
+       XEN_PRE_PATCHSET_NUM=0
+       XEN_GENTOO_PATCHSET_NUM=0
+       XEN_PRE_VERSION_BASE=4.16.1
+
+       XEN_BASE_PV="${PV}"
+       if [[ -n "${XEN_PRE_VERSION_BASE}" ]]; then
+               XEN_BASE_PV="${XEN_PRE_VERSION_BASE}"
+       fi
+
+       
SRC_URI="https://downloads.xenproject.org/release/xen/${XEN_BASE_PV}/xen-${XEN_BASE_PV}.tar.gz";
+
+       if [[ -n "${XEN_PRE_PATCHSET_NUM}" ]]; then
+               XEN_UPSTREAM_PATCHES_TAG="$(ver_cut 
1-3)-pre-patchset-${XEN_PRE_PATCHSET_NUM}"
+               
XEN_UPSTREAM_PATCHES_NAME="xen-upstream-patches-${XEN_UPSTREAM_PATCHES_TAG}"
+               SRC_URI+=" 
https://github.com/Flowdalic/xen-upstream-patches/archive/refs/tags/${XEN_UPSTREAM_PATCHES_TAG}.tar.gz
 -> ${XEN_UPSTREAM_PATCHES_NAME}.tar.gz"
+               
XEN_UPSTREAM_PATCHES_DIR="${WORKDIR}/${XEN_UPSTREAM_PATCHES_NAME}"
+       fi
+       if [[ -n "${XEN_GENTOO_PATCHSET_NUM}" ]]; then
+               XEN_GENTOO_PATCHES_TAG="$(ver_cut 1-3 
${XEN_BASE_PV})-gentoo-patchset-${XEN_GENTOO_PATCHSET_NUM}"
+               
XEN_GENTOO_PATCHES_NAME="xen-gentoo-patches-${XEN_GENTOO_PATCHES_TAG}"
+               SRC_URI+=" 
https://github.com/Flowdalic/xen-gentoo-patches/archive/refs/tags/${XEN_GENTOO_PATCHES_TAG}.tar.gz
 -> ${XEN_GENTOO_PATCHES_NAME}.tar.gz"
+               XEN_GENTOO_PATCHES_DIR="${WORKDIR}/${XEN_GENTOO_PATCHES_NAME}"
+       fi
+fi
+
+DESCRIPTION="The Xen virtual machine monitor"
+HOMEPAGE="https://xenproject.org";
+
+S="${WORKDIR}/xen-$(ver_cut 1-3 ${XEN_BASE_PV})"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="+boot-symlinks debug efi flask"
+REQUIRED_USE="arm? ( debug )"
+
+DEPEND="${PYTHON_DEPS}
+       efi? ( >=sys-devel/binutils-2.22[multitarget] )
+       !efi? ( >=sys-devel/binutils-2.22 )
+       flask? ( sys-apps/checkpolicy )"
+RDEPEND=""
+PDEPEND="~app-emulation/xen-tools-${PV}"
+
+# no tests are available for the hypervisor
+# prevent the silliness of /usr/lib/debug/usr/lib/debug files
+# prevent stripping of the debug info from the /usr/lib/debug/xen-syms
+RESTRICT="test splitdebug strip"
+
+# Approved by QA team in bug #144032
+QA_WX_LOAD="boot/xen-syms-${PV}"
+
+pkg_setup() {
+       python-any-r1_pkg_setup
+       if [[ -z ${XEN_TARGET_ARCH} ]]; then
+               if 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() {
+       if [[ -v XEN_UPSTREAM_PATCHES_DIR ]]; then
+               eapply "${XEN_UPSTREAM_PATCHES_DIR}"
+       fi
+
+       if [[ -v XEN_GENTOO_PATCHES_DIR ]]; then
+               eapply "${XEN_GENTOO_PATCHES_DIR}"
+       fi
+
+       eapply "${FILESDIR}"/${PN}-4.16-efi.patch
+
+       # Symlinks do not work on fat32 volumes # 829765
+       if ! use boot-symlinks || use efi; then
+               eapply "${FILESDIR}"/${PN}-4.16-no-symlink.patch
+       fi
+
+       # Workaround new gcc-11 options
+       sed -e '/^CFLAGS/s/-Werror//g' -i xen/Makefile || die
+
+       # Drop .config
+       sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't 
drop"
+
+       if use efi; then
+               export EFI_VENDOR="gentoo"
+               export EFI_MOUNTPOINT="/boot"
+       fi
+
+       default
+}
+
+xen_make() {
+       # Setting clang to either 'y' or 'n' tells Xen's build system
+       # whether or not clang is used.
+       local clang=n
+       if tc-is-clang; then
+               clang=y
+       fi
+
+       # Send raw LDFLAGS so that --as-needed works
+       emake \
+               V=1 \
+               LDFLAGS="$(raw-ldflags)" \
+               HOSTCC="$(tc-getBUILD_CC)" \
+               HOSTCXX="$(tc-getBUILD_CXX)" \
+               clang="${clang}" \
+               "$@"
+}
+
+src_configure() {
+       cd xen || die
+
+       touch gentoo-config || die
+       if use arm; then
+          echo "CONFIG_EARLY_PRINTK=sun7i" >> gentoo-config || die
+       fi
+       if use debug; then
+               cat <<-EOF >> gentoo-config || die
+               CONFIG_DEBUG=y
+               CONFIG_CRASH_DEBUG=y
+EOF
+       fi
+       if use flask; then
+               echo "CONFIG_XSM=y" >> gentoo-config || die
+       fi
+
+       # remove flags
+       unset CFLAGS
+
+       tc-ld-disable-gold # Bug 700374
+
+       xen_make KCONFIG_ALLCONFIG=gentoo-config alldefconfig
+}
+
+src_compile() {
+       xen_make -C xen
+}
+
+src_install() {
+       # The 'make install' doesn't 'mkdir -p' the subdirs
+       if use efi; then
+               mkdir -p "${D}"${EFI_MOUNTPOINT}/efi/${EFI_VENDOR} || die
+       fi
+
+       xen_make DESTDIR="${D}" -C xen install
+
+       # make install likes to throw in some extra EFI bits if it built
+       use efi || rm -rf "${D}/usr/$(get_libdir)/efi"
+}
+
+pkg_postinst() {
+       elog "Official Xen Guide:"
+       elog " https://wiki.gentoo.org/wiki/Xen";
+
+       use efi && einfo "The efi executable is installed in /boot/efi/gentoo"
+
+       ewarn
+       ewarn "Xen 4.12+ changed the default scheduler to credit2 which can 
cause"
+       ewarn "domU lockups on multi-cpu systems. The legacy credit scheduler 
seems"
+       ewarn "to work fine."
+       ewarn
+       ewarn "Add sched=credit to xen command line options to use the legacy 
scheduler."
+       ewarn
+       ewarn 
"https://wiki.gentoo.org/wiki/Xen#Xen_domU_hanging_with_Xen_4.12.2B";
+}

Reply via email to