commit:     93ab26a36f5d15fef87efa4db2a26ec844289bdc
Author:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 26 11:31:58 2023 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Sat Aug 26 11:50:08 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=93ab26a3

app-emulation/virtualbox: install python vboxapi

Closes: https://bugs.gentoo.org/378871
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 ...box-9999.ebuild => virtualbox-7.0.10-r1.ebuild} | 85 ++++++++++------------
 app-emulation/virtualbox/virtualbox-9999.ebuild    | 22 +++++-
 2 files changed, 58 insertions(+), 49 deletions(-)

diff --git a/app-emulation/virtualbox/virtualbox-9999.ebuild 
b/app-emulation/virtualbox/virtualbox-7.0.10-r1.ebuild
similarity index 92%
copy from app-emulation/virtualbox/virtualbox-9999.ebuild
copy to app-emulation/virtualbox/virtualbox-7.0.10-r1.ebuild
index 3479b65025f4..d663f08829a9 100644
--- a/app-emulation/virtualbox/virtualbox-9999.ebuild
+++ b/app-emulation/virtualbox/virtualbox-7.0.10-r1.ebuild
@@ -3,15 +3,6 @@
 
 EAPI=8
 
-# Important!
-# This compiles the latest svn version.
-# It also compiles the kernel modules.  Does not depend on virtualbox-modules.
-# It is not meant to be used, might be very unstable.
-# Upstream seem to have added support for python 3.12; I haven't checked it 
yet.
-#
-# USE=doc does not work for now.
-#
-#
 # To add a new Python here:
 # 1. Patch src/libs/xpcom18a4/python/Makefile.kmk (copy the previous impl's 
logic)
 #    Do NOT skip this part. It'll end up silently not-building the Python 
extension
@@ -24,26 +15,26 @@ EAPI=8
 #  trunk branch but not release branch.
 #
 #  See bug #785835, bug #856121.
-PYTHON_COMPAT=( python3_{9..12} )
+PYTHON_COMPAT=( python3_{10..11} )
 
-inherit desktop edo flag-o-matic java-pkg-opt-2 linux-mod-r1 multilib 
optfeature pax-utils \
-       python-single-r1 subversion tmpfiles toolchain-funcs udev xdg
+inherit desktop edo flag-o-matic java-pkg-opt-2 linux-info multilib optfeature 
pax-utils \
+       python-single-r1 tmpfiles toolchain-funcs udev xdg
 
 MY_PN="VirtualBox"
-BASE_PV=7.0.8
 MY_P=${MY_PN}-${PV}
 
 DESCRIPTION="Family of powerful x86 virtualization products for enterprise and 
home use"
 HOMEPAGE="https://www.virtualbox.org/";
-ESVN_REPO_URI="https://www.virtualbox.org/svn/vbox/trunk";
 SRC_URI="
-       
https://gitweb.gentoo.org/proj/virtualbox-patches.git/snapshot/virtualbox-patches-7.0.10_pre20230615.tar.bz2
-       gui? ( !doc? ( 
https://dev.gentoo.org/~ceamac/${CATEGORY}/${PN}/${PN}-help-${BASE_PV}.tar.xz ) 
)
+       https://download.virtualbox.org/virtualbox/${PV}/${MY_P}.tar.bz2
+       
https://gitweb.gentoo.org/proj/virtualbox-patches.git/snapshot/virtualbox-patches-7.0.8.tar.bz2
+       gui? ( !doc? ( 
https://dev.gentoo.org/~ceamac/${CATEGORY}/${PN}/${PN}-help-${PV}.tar.xz ) )
 "
-S="${WORKDIR}/trunk"
+S="${WORKDIR}/${MY_PN}-${PV}"
 
 LICENSE="GPL-2+ GPL-3 LGPL-2.1 MIT dtrace? ( CDDL )"
 SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
 IUSE="alsa dbus debug doc dtrace +gui java lvm nls pam pch pulseaudio +opengl 
python +sdk +sdl +udev vboxwebsrv vde vnc"
 
 unset WATCOM #856769
@@ -51,6 +42,7 @@ unset WATCOM #856769
 COMMON_DEPEND="
        ${PYTHON_DEPS}
        acct-group/vboxusers
+       ~app-emulation/virtualbox-modules-${PV}
        dev-libs/libtpms
        dev-libs/libxml2
        dev-libs/openssl:0=
@@ -134,7 +126,6 @@ RDEPEND="
 "
 BDEPEND="
        ${PYTHON_DEPS}
-       app-arch/makeself
        >=app-arch/tar-1.34-r2
        >=dev-lang/yasm-0.6.2
        dev-libs/libIDL
@@ -211,18 +202,15 @@ PATCHES=(
        "${FILESDIR}"/${PN}-6.1.36-fcf-protection.patch
 
        "${FILESDIR}"/${PN}-7.0.0-fix-compilation-clang.patch
-       "${FILESDIR}"/${PN}-7.0.9-python.patch
+       "${FILESDIR}"/${PN}-7.0.10-python.patch
        "${FILESDIR}"/${PN}-7.0.6-gcc-13.patch
        "${FILESDIR}"/${PN}-7.0.8-mtune-keep-size.patch
+       "${FILESDIR}"/${PN}-7.0.6-fix-libxml2.patch
 
        # Downloaded patchset
-       "${WORKDIR}"/virtualbox-patches-7.0.10_pre20230615/patches
+       "${WORKDIR}"/virtualbox-patches-7.0.8/patches
 )
 
-DOCS=()        # Don't install the default README file during einstalldocs
-
-CONFIG_CHECK="~!SPINLOCK JUMP_LABEL"
-
 pkg_pretend() {
        if ! use gui; then
                einfo "No USE=\"gui\" selected, this build will not include any 
Qt frontend."
@@ -254,12 +242,6 @@ pkg_pretend() {
 pkg_setup() {
        java-pkg-opt-2_pkg_setup
        python-single-r1_pkg_setup
-       linux-mod-r1_pkg_setup
-}
-
-src_unpack() {
-       subversion_src_unpack
-       default
 }
 
 src_prepare() {
@@ -511,21 +493,9 @@ src_compile() {
        fi
 
        MAKE="kmk" emake "${myemakeargs[@]}" all
-
-       local modlist=( 
{vboxdrv,vboxnetflt,vboxnetadp}=misc:"out/linux.${ARCH}/release/bin/src" )
-       local modargs=( KERN_DIR="${KV_OUT_DIR}" KERN_VER="${KV_FULL}" )
-       linux-mod-r1_src_compile
 }
 
 src_install() {
-       linux-mod-r1_src_install
-       insinto /usr/lib/modules-load.d/
-       newins - virtualbox.conf <<-EOF
-               vboxdrv
-               vboxnetflt
-               vboxnetadp
-       EOF
-
        cd "${S}"/out/linux.${ARCH}/$(usex debug debug release)/bin || die
 
        local vbox_inst_path="/usr/$(get_libdir)/${PN}" each size ico icofile
@@ -598,7 +568,10 @@ src_install() {
        fi
 
        # set an env-variable for 3rd party tools
-       echo -n "VBOX_APP_HOME=${vbox_inst_path}" > "${T}/90virtualbox"
+       echo "VBOX_APP_HOME=${vbox_inst_path}" > "${T}/90virtualbox"
+       # environment variables used during SDK binding installation
+       echo "VBOX_SDK_PATH=${vbox_inst_path}/sdk" >> "${T}/90virtualbox"
+       echo "VBOX_INSTALL_PATH=${vbox_inst_path}" >> "${T}/90virtualbox"
        doenvd "${T}/90virtualbox"
 
        if use sdl; then
@@ -617,6 +590,11 @@ src_install() {
                        pax-mark -m "${ED}"${vbox_inst_path}/${each}
                done
 
+               if use opengl; then
+                       vbox_inst VBoxTestOGL
+                       pax-mark -m "${ED}"${vbox_inst_path}/VBoxTestOGL
+               fi
+
                for each in virtualbox{,vm} VirtualBox{,VM} ; do
                        dosym ${vbox_inst_path}/VBox /usr/bin/${each}
                done
@@ -707,7 +685,7 @@ src_install() {
                dodoc UserManual.pdf UserManual.q{ch,hc}
                docompress -x /usr/share/doc/${PF}
        elif use gui; then
-               dodoc "${WORKDIR}"/${PN}-help-${BASE_PV}/UserManual.q{ch,hc}
+               dodoc "${WORKDIR}"/${PN}-help-${PV}/UserManual.q{ch,hc}
                docompress -x /usr/share/doc/${PF}
        fi
 
@@ -719,14 +697,27 @@ src_install() {
                        eerror "(listed in PYTHON_COMPAT in the ebuild) is 
incomplete within the Makefiles."
                        die "Incomplete installation of Python bindings! File a 
bug with Gentoo!"
                fi
+
+               # 378871
+               local 
installer_dir="${ED}/usr/$(get_libdir)/virtualbox/sdk/installer"
+               pushd "${installer_dir}" &> /dev/null || die
+               sed -e "s;%VBOX_INSTALL_PATH%;${vbox_inst_path};" \
+                       -e "s;%VBOX_SDK_PATH%;${vbox_inst_path}/sdk;" \
+                       -i vboxapi/__init__.py || die
+               # insert shebang, the files come without one
+               find vboxapi -name \*.py -exec sed -e "1 i\#! ${PYTHON}" -i {} 
\+ || die
+               python_domodule vboxapi
+               popd &> /dev/null || die
+               python_doscript vboxshell.py
+
+               # do not install the installer
+               rm -r "${installer_dir}" || die
        fi
 
        newtmpfiles "${FILESDIR}"/${PN}-vboxusb_tmpfilesd ${PN}-vboxusb.conf
 }
 
 pkg_postinst() {
-       linux-mod-r1_pkg_postinst
-
        xdg_pkg_postinst
 
        if use udev; then
@@ -743,7 +734,7 @@ pkg_postinst() {
        elog "You must be in the vboxusers group to use VirtualBox."
        elog ""
        elog "The latest user manual is available for download at:"
-       elog 
"https://download.virtualbox.org/virtualbox/${BASE_PV}/UserManual.pdf";
+       elog "https://download.virtualbox.org/virtualbox/${PV}/UserManual.pdf";
        elog ""
 
        optfeature "Advanced networking setups" net-misc/bridge-utils 
sys-apps/usermode-utilities

diff --git a/app-emulation/virtualbox/virtualbox-9999.ebuild 
b/app-emulation/virtualbox/virtualbox-9999.ebuild
index 3479b65025f4..9048fa58d8a6 100644
--- a/app-emulation/virtualbox/virtualbox-9999.ebuild
+++ b/app-emulation/virtualbox/virtualbox-9999.ebuild
@@ -24,7 +24,7 @@ EAPI=8
 #  trunk branch but not release branch.
 #
 #  See bug #785835, bug #856121.
-PYTHON_COMPAT=( python3_{9..12} )
+PYTHON_COMPAT=( python3_{10..11} )
 
 inherit desktop edo flag-o-matic java-pkg-opt-2 linux-mod-r1 multilib 
optfeature pax-utils \
        python-single-r1 subversion tmpfiles toolchain-funcs udev xdg
@@ -598,7 +598,10 @@ src_install() {
        fi
 
        # set an env-variable for 3rd party tools
-       echo -n "VBOX_APP_HOME=${vbox_inst_path}" > "${T}/90virtualbox"
+       echo "VBOX_APP_HOME=${vbox_inst_path}" > "${T}/90virtualbox"
+       # environment variables used during SDK binding installation
+       echo "VBOX_SDK_PATH=${vbox_inst_path}/sdk" >> "${T}/90virtualbox"
+       echo "VBOX_INSTALL_PATH=${vbox_inst_path}" >> "${T}/90virtualbox"
        doenvd "${T}/90virtualbox"
 
        if use sdl; then
@@ -719,6 +722,21 @@ src_install() {
                        eerror "(listed in PYTHON_COMPAT in the ebuild) is 
incomplete within the Makefiles."
                        die "Incomplete installation of Python bindings! File a 
bug with Gentoo!"
                fi
+
+               # 378871
+               local 
installer_dir="${ED}/usr/$(get_libdir)/virtualbox/sdk/installer"
+               pushd "${installer_dir}" &> /dev/null || die
+               sed -e "s;%VBOX_INSTALL_PATH%;${vbox_inst_path};" \
+                       -e "s;%VBOX_SDK_PATH%;${vbox_inst_path}/sdk;" \
+                       -i vboxapi/__init__.py || die
+               # insert shebang, the files come without one
+               find vboxapi -name \*.py -exec sed -e "1 i\#! ${PYTHON}" -i {} 
\+ || die
+               python_domodule vboxapi
+               popd &> /dev/null || die
+               python_doscript vboxshell.py
+
+               # do not install the installer
+               rm -r "${installer_dir}" || die
        fi
 
        newtmpfiles "${FILESDIR}"/${PN}-vboxusb_tmpfilesd ${PN}-vboxusb.conf

Reply via email to