Accepting request 978768 from Virtualization

OBS-URL: https://build.opensuse.org/request/show/978768
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/virtualbox?expand=0&rev=236
This commit is contained in:
Dominique Leuenberger 2022-05-24 18:31:10 +00:00 committed by Git OBS Bridge
commit 31e7df6a21
7 changed files with 410 additions and 350 deletions

View File

@ -30,7 +30,7 @@ B. Build the project:
the revised component.
C. Steps to take with a new release:
1. When Orable releases a new version, you will need to download then new tarball
1. When Oracle releases a new version, you will need to download the new tarball
from https://download.virtualbox.org/virtualbox/. While downloading the file, I
also get the new UserManual.pdf.
2. openSUSE makes some changes to the tarball by running the command

View File

@ -1,208 +0,0 @@
Index: VirtualBox-6.1.30/src/bldprogs/scm.cpp
===================================================================
--- VirtualBox-6.1.30.orig/src/bldprogs/scm.cpp
+++ VirtualBox-6.1.30/src/bldprogs/scm.cpp
@@ -2206,7 +2206,7 @@ static int scmProcessFileInner(PSCMRWSTA
pszTreatAs = "shell";
else if ( (cchFirst >= 15 && strncmp(pchFirst, "/usr/bin/python", 15) == 0)
|| (cchFirst >= 19 && strncmp(pchFirst, "/usr/bin/env python", 19) == 0) )
- pszTreatAs = "python";
+ pszTreatAs = "python3";
else if ( (cchFirst >= 13 && strncmp(pchFirst, "/usr/bin/perl", 13) == 0)
|| (cchFirst >= 17 && strncmp(pchFirst, "/usr/bin/env perl", 17) == 0) )
pszTreatAs = "perl";
Index: VirtualBox-6.1.30/src/libs/libxml2-2.9.4/configure
===================================================================
--- VirtualBox-6.1.30.orig/src/libs/libxml2-2.9.4/configure
+++ VirtualBox-6.1.30/src/libs/libxml2-2.9.4/configure
@@ -15153,10 +15153,10 @@ PYTHON_SITE_PACKAGES=
PYTHON_TESTS=
pythondir=
if test "$with_python" != "no" ; then
- if test -x "$with_python/bin/python"
+ if test -x "$with_python/bin/python3"
then
- echo Found python in $with_python/bin/python
- PYTHON="$with_python/bin/python"
+ echo Found python in $with_python/bin/python3
+ PYTHON="$with_python/bin/python3"
else
if test -x "$with_python/python.exe"
then
@@ -15174,7 +15174,8 @@ if test "$with_python" != "no" ; then
with_python=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
else
# Extract the first word of "python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5", so it can be a program name with args.
-set dummy python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5; ac_word=$2
+PYTHON=python3
+set dummy python3 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PYTHON+:} false; then :
Index: VirtualBox-6.1.30/src/VBox/ValidationKit/testboxscript/setup.sh
===================================================================
--- VirtualBox-6.1.30.orig/src/VBox/ValidationKit/testboxscript/setup.sh
+++ VirtualBox-6.1.30/src/VBox/ValidationKit/testboxscript/setup.sh
@@ -652,7 +652,7 @@ import sys;\
x = sys.version_info[0] == 2 and (sys.version_info[1] >= 6 or (sys.version_info[1] == 5 and sys.version_info[2] >= 1));\
sys.exit(not x);\
";
- for python in python2.7 python2.6 python2.5 python;
+ for python in python3.6 python2.7 python2.6 python2.5 python;
do
python=`which ${python} 2> /dev/null`
if [ -n "${python}" -a -x "${python}" ]; then
Index: VirtualBox-6.1.30/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
===================================================================
--- VirtualBox-6.1.30.orig/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
+++ VirtualBox-6.1.30/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
@@ -21,7 +21,7 @@
%define %CHM% 1
%define VBOXDOCDIR %{_defaultdocdir}/%NAME%
%global __requires_exclude_from ^/usr/lib/virtualbox/VBoxPython.*$|^/usr/lib/python.*$|^.*\\.py$
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%{!?python_sitelib: %define python_sitelib python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
Summary: Oracle VM VirtualBox
Name: %NAME%
@@ -101,7 +101,7 @@ install -m 755 -d $RPM_BUILD_ROOT/usr/sh
%if %{?with_python:1}%{!?with_python:0}
(export VBOX_INSTALL_PATH=/usr/lib/virtualbox && \
cd ./sdk/installer && \
- %{vbox_python} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT)
+ %{python3} ./vboxapisetup.py install --prefix %{_prefix} --root $RPM_BUILD_ROOT)
%endif
rm -rf sdk/installer
mv UnattendedTemplates $RPM_BUILD_ROOT/usr/share/virtualbox
Index: VirtualBox-6.1.30/src/libs/libxml2-2.9.4/libxml.spec.in
===================================================================
--- VirtualBox-6.1.30.orig/src/libs/libxml2-2.9.4/libxml.spec.in
+++ VirtualBox-6.1.30/src/libs/libxml2-2.9.4/libxml.spec.in
@@ -101,11 +101,11 @@ rm -fr %{buildroot}
make install DESTDIR=%{buildroot}
-%if 0%{?with_python3}
+%if 0%{?with_python}
make clean
-%configure --with-python=%{__python3}
+%configure --with-python=python3
make install DESTDIR=%{buildroot}
-%endif # with_python3
+%endif # with_python
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
Index: VirtualBox-6.1.30/src/libs/libxml2-2.9.4/libxml2.spec
===================================================================
--- VirtualBox-6.1.30.orig/src/libs/libxml2-2.9.4/libxml2.spec
+++ VirtualBox-6.1.30/src/libs/libxml2-2.9.4/libxml2.spec
@@ -103,7 +103,7 @@ make install DESTDIR=%{buildroot}
%if 0%{?with_python3}
make clean
-%configure --with-python=%{__python3}
+%configure --with-python=python3
make install DESTDIR=%{buildroot}
%endif # with_python3
Index: VirtualBox-6.1.30/src/libs/xpcom18a4/python/src/ErrorUtils.cpp
===================================================================
--- VirtualBox-6.1.30.orig/src/libs/xpcom18a4/python/src/ErrorUtils.cpp
+++ VirtualBox-6.1.30/src/libs/xpcom18a4/python/src/ErrorUtils.cpp
@@ -439,6 +439,8 @@ char *PyTraceback_AsString(PyObject *exc
{ // a temp scope so I can use temp locals.
#if PY_MAJOR_VERSION <= 2
char *tempResult = PyString_AsString(obResult);
+#elif PY_MINOR_VERSION <= 6
+ char *tempResult = PyUnicode_AsUTF8(obResult);
#else
/* PyUnicode_AsUTF8() is const char * as of Python 3.7, char * earlier. */
const char *tempResult = (const char *)PyUnicode_AsUTF8(obResult);
Index: VirtualBox-6.1.30/src/libs/xpcom18a4/python/src/PyGBase.cpp
===================================================================
--- VirtualBox-6.1.30.orig/src/libs/xpcom18a4/python/src/PyGBase.cpp
+++ VirtualBox-6.1.30/src/libs/xpcom18a4/python/src/PyGBase.cpp
@@ -183,7 +183,11 @@ PyG_Base::~PyG_Base()
// Get the correct interface pointer for this object given the IID.
void *PyG_Base::ThisAsIID( const nsIID &iid )
{
- if (this==NULL) return NULL;
+#if PY_MINOR_VERSION <= 6
+ if (!this) return NULL;
+#else
+ if (!this) return NULL;
+#endif
if (iid.Equals(NS_GET_IID(nsISupports)))
return (nsISupports *)(nsIInternalPython *)this;
if (iid.Equals(NS_GET_IID(nsISupportsWeakReference)))
Index: VirtualBox-6.1.30/src/libs/xpcom18a4/python/Makefile.kmk
===================================================================
--- VirtualBox-6.1.30.orig/src/libs/xpcom18a4/python/Makefile.kmk
+++ VirtualBox-6.1.30/src/libs/xpcom18a4/python/Makefile.kmk
@@ -579,6 +579,52 @@ VBoxPython3_9m_x86_LIBS = $(VBOX_P
endif
endif
+ifdef VBOX_PYTHON38_INC
+#
+# Python 3.8 version
+#
+DLLS += VBoxPython3_8
+VBoxPython3_8_EXTENDS = VBoxPythonBase
+VBoxPython3_8_EXTENDS_BY = appending
+VBoxPython3_8_TEMPLATE = XPCOM
+VBoxPython3_8_INCS = $(VBOX_PYTHON38_INC)
+VBoxPython3_8_LIBS = $(VBOX_PYTHON38_LIB)
+
+ ifdef VBOX_WITH_32_ON_64_MAIN_API
+ ifdef VBOX_PYTHON38_LIB_X86
+DLLS += VBoxPython3_8_x86
+VBoxPython3_8_x86_EXTENDS = VBoxPythonBase_x86
+VBoxPython3_8_x86_EXTENDS_BY = appending
+VBoxPython3_8_x86_TEMPLATE = XPCOM
+VBoxPython3_8_x86_INCS = $(VBOX_PYTHON38_INC)
+VBoxPython3_8_x86_LIBS = $(VBOX_PYTHON38_LIB_X86)
+ endif
+ endif
+endif
+
+ifdef VBOX_PYTHON38M_INC
+#
+# Python 3.8 version with pymalloc
+#
+DLLS += VBoxPython3_8m
+VBoxPython3_8m_EXTENDS = VBoxPythonBase_m
+VBoxPython3_8m_EXTENDS_BY = appending
+VBoxPython3_8m_TEMPLATE = XPCOM
+VBoxPython3_8m_INCS = $(VBOX_PYTHON38M_INC)
+VBoxPython3_8m_LIBS = $(VBOX_PYTHON38M_LIB)
+
+ ifdef VBOX_WITH_32_ON_64_MAIN_API
+ ifdef VBOX_PYTHON38M_LIB_X86
+DLLS += VBoxPython3_8m_x86
+VBoxPython3_8m_x86_EXTENDS = VBoxPythonBase_x86_m
+VBoxPython3_8m_x86_EXTENDS_BY = appending
+VBoxPython3_8m_x86_TEMPLATE_ = XPCOM
+VBoxPython3_8m_x86_INCS = $(VBOX_PYTHON38M_INC)
+VBoxPython3_8m_x86_LIBS = $(VBOX_PYTHON38M_LIB_X86)
+ endif
+ endif
+endif
+
ifdef VBOX_PYTHONDEF_INC
#
# Python without versioning
Index: VirtualBox-6.1.30/src/libs/xpcom18a4/python/gen_python_deps.py
===================================================================
--- VirtualBox-6.1.30.orig/src/libs/xpcom18a4/python/gen_python_deps.py
+++ VirtualBox-6.1.30/src/libs/xpcom18a4/python/gen_python_deps.py
@@ -16,7 +16,7 @@ from __future__ import print_function
import os,sys
from distutils.version import StrictVersion
-versions = ["2.6", "2.7", "3.1", "3.2", "3.2m", "3.3", "3.3m", "3.4", "3.4m", "3.5", "3.5m", "3.6", "3.6m", "3.7", "3.7m", "3.8", "3.8m", "3.9", "3.9m" ]
+versions = ["2.6", "2.7", "3.1", "3.2", "3.2m", "3.3", "3.3m", "3.4", "3.4m", "3.5", "3.5m", "3.6", "3.6m", "3.7", "3.7m", "3.8", "3.8m", "3.8", "3.8m", "3.9", "3.9m" ]
prefixes = ["/usr", "/usr/local", "/opt", "/opt/local"]
known = {}

View File

@ -1,51 +0,0 @@
Index: VirtualBox-5.1.8/src/libs/xpcom18a4/python/gen_python_deps.py
===================================================================
--- VirtualBox-5.1.8.orig/src/libs/xpcom18a4/python/gen_python_deps.py
+++ VirtualBox-5.1.8/src/libs/xpcom18a4/python/gen_python_deps.py
@@ -86,7 +86,7 @@ def main(argv):
else:
multi = 1
- if multi == 0:
+ if not multi:
prefixes = ["/usr"]
versions = [str(sys.version_info[0])+'.'+str(sys.version_info[1]),
str(sys.version_info[0])+'.'+str(sys.version_info[1])+'m']
@@ -114,24 +114,25 @@ def main(argv):
continue
for p in prefixes:
c = checkPair(p, v, dllpre, dllsuff, bitness_magic)
- if c is not None:
+ if c:
known[v] = c
break
- keys = list(known.keys())
- # we want default to be the lowest versioned Python
- keys.sort()
- d = None
# We need separator other than newline, to sneak through $(shell)
sep = "|"
- for k in keys:
- if d is None:
- d = k
- vers = k.replace('.', '').upper()
- print_vars(vers, known[k], sep, bitness_magic)
- if d is not None:
- print_vars("DEF", known[d], sep, bitness_magic)
+
+ if not known:
+ # this type of problem should be detected in configure
+ # print_vars("DEF", defaultpaths, sep, bitness_magic)
+ pass
else:
print(argv[0] + ": No Python development package found!", file=sys.stderr)
+ if multi:
+ for ver, paths in known.items():
+ print_vars(ver.replace('.', '').upper(), paths, sep, bitness_magic)
+ else:
+ ver = versions[0]
+ paths = known[ver]
+ print_vars(ver.replace('.', ''), paths, sep, bitness_magic)
if __name__ == '__main__':
main(sys.argv)

169
vbox-python-py310.patch Normal file
View File

@ -0,0 +1,169 @@
# https://www.virtualbox.org/changeset/90537/vbox
Index: trunk/configure
===================================================================
--- trunk/configure (revision 90536)
+++ trunk/configure (revision 90537)
@@ -3,7 +3,7 @@
# libraries VBox OSE depends on.
#
-# Copyright (C) 2006-2020 Oracle Corporation
+# Copyright (C) 2006-2021 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
@@ -2043,7 +2043,7 @@
}
EOF
found=
- SUPPYTHONLIBS="python2.7 python2.6 python3.1 python3.2 python3.3 python3.4 python3.4m python3.5 python3.5m python3.6 python3.6m python3.7 python3.7m python3.8 python3.8m python3.9 python3.9m"
+ SUPPYTHONLIBS="python2.7 python2.6 python3.1 python3.2 python3.3 python3.4 python3.4m python3.5 python3.5m python3.6 python3.6m python3.7 python3.7m python3.8 python3.8m python3.9 python3.9m python3.10 python3.10m"
for p in $PYTHONDIR; do
for d in $SUPPYTHONLIBS; do
for b in lib/x86_64-linux-gnu lib/i386-linux-gnu lib64 lib/64 lib; do
Index: trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp
===================================================================
--- trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp (revision 90536)
+++ trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp (revision 90537)
@@ -84,7 +84,11 @@
# define MANGLE_MODULE_INIT(a_Name) RT_CONCAT(a_Name, MODULE_NAME_SUFFIX)
# endif
# ifdef VBOX_PYXPCOM_VERSIONED
-# if PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
+# if PY_VERSION_HEX >= 0x030a0000 && PY_VERSION_HEX < 0x030b0000
+# define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython3_10")
+# define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_10)
+
+# elif PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
# define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython3_9")
# define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_9)
Index: trunk/src/libs/xpcom18a4/python/Makefile.kmk
===================================================================
--- trunk/src/libs/xpcom18a4/python/Makefile.kmk (revision 90536)
+++ trunk/src/libs/xpcom18a4/python/Makefile.kmk (revision 90537)
@@ -4,7 +4,7 @@
#
#
-# Copyright (C) 2009-2017 Oracle Corporation
+# Copyright (C) 2009-2021 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
@@ -20,7 +20,7 @@
#
# List of supported Python versions, defining a number of
-# VBOX_PYTHON[26|27|31|32|32M|33|33M|34|34M|35|35M|36|36M|37|37M|38|38M|39|39M|DEF]_[INC|LIB] variables
+# VBOX_PYTHON[26|27|31|32|32M|33|33M|34|34M|35|35M|36|36M|37|37M|38|38M|39|39M|310|310M|DEF]_[INC|LIB] variables
# which get picked up below.
#
ifeq ($(KBUILD_TARGET),darwin) # Relatively predictable, don't script.
@@ -646,6 +646,52 @@
endif
endif
+ifdef VBOX_PYTHON310_INC
+#
+# Python 3.10 version
+#
+DLLS += VBoxPython3_10
+VBoxPython3_10_EXTENDS = VBoxPythonBase
+VBoxPython3_10_EXTENDS_BY = appending
+VBoxPython3_10_TEMPLATE = XPCOM
+VBoxPython3_10_INCS = $(VBOX_PYTHON310_INC)
+VBoxPython3_10_LIBS = $(VBOX_PYTHON310_LIB)
+
+ ifdef VBOX_WITH_32_ON_64_MAIN_API
+ ifdef VBOX_PYTHON310_LIB_X86
+DLLS += VBoxPython3_10_x86
+VBoxPython3_10_x86_EXTENDS = VBoxPythonBase_x86
+VBoxPython3_10_x86_EXTENDS_BY = appending
+VBoxPython3_10_x86_TEMPLATE = XPCOM
+VBoxPython3_10_x86_INCS = $(VBOX_PYTHON310_INC)
+VBoxPython3_10_x86_LIBS = $(VBOX_PYTHON310_LIB_X86)
+ endif
+ endif
+endif
+
+ifdef VBOX_PYTHON310M_INC
+#
+# Python 3.10 version with pymalloc
+#
+DLLS += VBoxPython3_10m
+VBoxPython3_10m_EXTENDS = VBoxPythonBase_m
+VBoxPython3_10m_EXTENDS_BY = appending
+VBoxPython3_10m_TEMPLATE = XPCOM
+VBoxPython3_10m_INCS = $(VBOX_PYTHON310M_INC)
+VBoxPython3_10m_LIBS = $(VBOX_PYTHON310M_LIB)
+
+ ifdef VBOX_WITH_32_ON_64_MAIN_API
+ ifdef VBOX_PYTHON310M_LIB_X86
+DLLS += VBoxPython3_10m_x86
+VBoxPython3_10m_x86_EXTENDS = VBoxPythonBase_x86_m
+VBoxPython3_10m_x86_EXTENDS_BY = appending
+VBoxPython3_10m_x86_TEMPLATE_ = XPCOM
+VBoxPython3_10m_x86_INCS = $(VBOX_PYTHON310M_INC)
+VBoxPython3_10m_x86_LIBS = $(VBOX_PYTHON310M_LIB_X86)
+ endif
+ endif
+endif
+
ifdef VBOX_PYTHONDEF_INC
#
# Python without versioning
@@ -730,4 +776,3 @@
include $(FILE_KBUILD_SUB_FOOTER)
-
Index: trunk/src/libs/xpcom18a4/python/gen_python_deps.py
===================================================================
--- trunk/src/libs/xpcom18a4/python/gen_python_deps.py (revision 90536)
+++ trunk/src/libs/xpcom18a4/python/gen_python_deps.py (revision 90537)
@@ -1,7 +1,7 @@
#!/usr/bin/python
"""
-Copyright (C) 2009-2016 Oracle Corporation
+Copyright (C) 2009-2021 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
@@ -16,7 +16,7 @@
import os,sys
from distutils.version import StrictVersion
-versions = ["2.6", "2.7", "3.1", "3.2", "3.2m", "3.3", "3.3m", "3.4", "3.4m", "3.5", "3.5m", "3.6", "3.6m", "3.7", "3.7m", "3.8", "3.8m", "3.9", "3.9m" ]
+versions = ["2.6", "2.7", "3.1", "3.2", "3.2m", "3.3", "3.3m", "3.4", "3.4m", "3.5", "3.5m", "3.6", "3.6m", "3.7", "3.7m", "3.8", "3.8m", "3.9", "3.9m", "3.10", "3.10m" ]
prefixes = ["/usr", "/usr/local", "/opt", "/opt/local"]
known = {}
# https://www.virtualbox.org/changeset/86623/vbox
Index: trunk/src/libs/xpcom18a4/python/src/PyXPCOM.h
===================================================================
--- trunk/src/libs/xpcom18a4/python/src/PyXPCOM.h (revision 86622)
+++ trunk/src/libs/xpcom18a4/python/src/PyXPCOM.h (revision 86623)
@@ -137,12 +137,14 @@
# define PyInt_Check(o) PyLong_Check(o)
# define PyInt_AsLong(o) PyLong_AsLong(o)
# define PyNumber_Int(o) PyNumber_Long(o)
-# ifndef PyUnicode_AsUTF8
-# define PyUnicode_AsUTF8(o) _PyUnicode_AsString(o)
+# if !defined(Py_LIMITED_API) && PY_VERSION_HEX <= 0x03030000 /* 3.3 added PyUnicode_AsUTF8AndSize */
+# ifndef PyUnicode_AsUTF8
+# define PyUnicode_AsUTF8(o) _PyUnicode_AsString(o)
+# endif
+# ifndef PyUnicode_AsUTF8AndSize
+# define PyUnicode_AsUTF8AndSize(o,s) _PyUnicode_AsStringAndSize(o,s)
+# endif
# endif
-# ifndef PyUnicode_AsUTF8AndSize
-# define PyUnicode_AsUTF8AndSize(o,s) _PyUnicode_AsStringAndSize(o,s)
-# endif
typedef struct PyMethodChain
{
PyMethodDef *methods;

217
vbox-python-selection.patch Normal file
View File

@ -0,0 +1,217 @@
Index: VirtualBox-6.1.34/src/bldprogs/scm.cpp
===================================================================
--- VirtualBox-6.1.34.orig/src/bldprogs/scm.cpp
+++ VirtualBox-6.1.34/src/bldprogs/scm.cpp
@@ -2206,7 +2206,7 @@ static int scmProcessFileInner(PSCMRWSTA
pszTreatAs = "shell";
else if ( (cchFirst >= 15 && strncmp(pchFirst, "/usr/bin/python", 15) == 0)
|| (cchFirst >= 19 && strncmp(pchFirst, "/usr/bin/env python", 19) == 0) )
- pszTreatAs = "python";
+ pszTreatAs = "python3";
else if ( (cchFirst >= 13 && strncmp(pchFirst, "/usr/bin/perl", 13) == 0)
|| (cchFirst >= 17 && strncmp(pchFirst, "/usr/bin/env perl", 17) == 0) )
pszTreatAs = "perl";
Index: VirtualBox-6.1.34/src/libs/libxml2-2.9.4/configure
===================================================================
--- VirtualBox-6.1.34.orig/src/libs/libxml2-2.9.4/configure
+++ VirtualBox-6.1.34/src/libs/libxml2-2.9.4/configure
@@ -15153,10 +15153,10 @@ PYTHON_SITE_PACKAGES=
PYTHON_TESTS=
pythondir=
if test "$with_python" != "no" ; then
- if test -x "$with_python/bin/python"
+ if test -x "$with_python/bin/python3"
then
- echo Found python in $with_python/bin/python
- PYTHON="$with_python/bin/python"
+ echo Found python in $with_python/bin/python3
+ PYTHON="$with_python/bin/python3"
else
if test -x "$with_python/python.exe"
then
@@ -15174,7 +15174,8 @@ if test "$with_python" != "no" ; then
with_python=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
else
# Extract the first word of "python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5", so it can be a program name with args.
-set dummy python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5; ac_word=$2
+PYTHON=python3
+set dummy python3 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PYTHON+:} false; then :
Index: VirtualBox-6.1.34/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
===================================================================
--- VirtualBox-6.1.34.orig/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
+++ VirtualBox-6.1.34/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
@@ -22,6 +22,9 @@
%define VBOXDOCDIR %{_defaultdocdir}/%NAME%
%global __requires_exclude_from ^/usr/lib/virtualbox/VBoxPython.*$|^/usr/lib/python.*$|^.*\\.py$
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+# SUSE defines these in python-rpm-macros, not necessarily available here
+%{!?__python3:%{_bindir}/python3}}
+%{!?python3_sitelib: %define python_sitelib python3 -c "import sysconfig as s; print(s.get_paths().get('purelib'))"}
Summary: Oracle VM VirtualBox
Name: %NAME%
Index: VirtualBox-6.1.34/src/libs/libxml2-2.9.4/libxml.spec.in
===================================================================
--- VirtualBox-6.1.34.orig/src/libs/libxml2-2.9.4/libxml.spec.in
+++ VirtualBox-6.1.34/src/libs/libxml2-2.9.4/libxml.spec.in
@@ -1,3 +1,4 @@
+%global with_python2 0
%global with_python3 1
Summary: Library providing XML and HTML support
@@ -8,7 +9,9 @@ License: MIT
Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
+%if 0%{?with_python2}
BuildRequires: python-devel
+%endif
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif # with_python3
@@ -72,7 +75,6 @@ to read, modify and write XML and HTML f
this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.
-%if 0%{?with_python3}
%package python3
Summary: Python 3 bindings for the libxml2 library
Group: Development/Libraries
@@ -87,7 +89,6 @@ This library allows to manipulate XML fi
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.
-%endif # with_python3
%prep
%setup -q
@@ -99,11 +100,14 @@ make
%install
rm -fr %{buildroot}
+%if 0%{?with_python2}
+make clean
+%configure --with-python=python
make install DESTDIR=%{buildroot}
-
+%endif # with_python2
%if 0%{?with_python3}
make clean
-%configure --with-python=%{__python3}
+%configure --with-python=python3
make install DESTDIR=%{buildroot}
%endif # with_python3
@@ -165,6 +169,7 @@ rm -fr %{buildroot}
%{_libdir}/*a
+%if 0%{?with_python2}
%files python
%defattr(-, root, root)
@@ -176,6 +181,7 @@ rm -fr %{buildroot}
%doc python/tests/*.py
%doc doc/*.py
%doc doc/python.html
+%endif
%if 0%{?with_python3}
%files python3
Index: VirtualBox-6.1.34/src/libs/libxml2-2.9.4/libxml2.spec
===================================================================
--- VirtualBox-6.1.34.orig/src/libs/libxml2-2.9.4/libxml2.spec
+++ VirtualBox-6.1.34/src/libs/libxml2-2.9.4/libxml2.spec
@@ -103,7 +103,7 @@ make install DESTDIR=%{buildroot}
%if 0%{?with_python3}
make clean
-%configure --with-python=%{__python3}
+%configure --with-python=python3
make install DESTDIR=%{buildroot}
%endif # with_python3
Index: VirtualBox-6.1.34/src/libs/xpcom18a4/python/src/ErrorUtils.cpp
===================================================================
--- VirtualBox-6.1.34.orig/src/libs/xpcom18a4/python/src/ErrorUtils.cpp
+++ VirtualBox-6.1.34/src/libs/xpcom18a4/python/src/ErrorUtils.cpp
@@ -439,6 +439,8 @@ char *PyTraceback_AsString(PyObject *exc
{ // a temp scope so I can use temp locals.
#if PY_MAJOR_VERSION <= 2
char *tempResult = PyString_AsString(obResult);
+#elif PY_MINOR_VERSION <= 6
+ char *tempResult = PyUnicode_AsUTF8(obResult);
#else
/* PyUnicode_AsUTF8() is const char * as of Python 3.7, char * earlier. */
const char *tempResult = (const char *)PyUnicode_AsUTF8(obResult);
Index: VirtualBox-6.1.34/src/libs/xpcom18a4/python/src/PyGBase.cpp
===================================================================
--- VirtualBox-6.1.34.orig/src/libs/xpcom18a4/python/src/PyGBase.cpp
+++ VirtualBox-6.1.34/src/libs/xpcom18a4/python/src/PyGBase.cpp
@@ -183,7 +183,11 @@ PyG_Base::~PyG_Base()
// Get the correct interface pointer for this object given the IID.
void *PyG_Base::ThisAsIID( const nsIID &iid )
{
- if (this==NULL) return NULL;
+#if PY_MINOR_VERSION <= 6
+ if (!this) return NULL;
+#else
+ if (!this) return NULL;
+#endif
if (iid.Equals(NS_GET_IID(nsISupports)))
return (nsISupports *)(nsIInternalPython *)this;
if (iid.Equals(NS_GET_IID(nsISupportsWeakReference)))
Index: VirtualBox-6.1.34/src/libs/xpcom18a4/python/gen_python_deps.py
===================================================================
--- VirtualBox-6.1.34.orig/src/libs/xpcom18a4/python/gen_python_deps.py
+++ VirtualBox-6.1.34/src/libs/xpcom18a4/python/gen_python_deps.py
@@ -86,7 +86,7 @@ def main(argv):
else:
multi = 1
- if multi == 0:
+ if not multi:
prefixes = ["/usr"]
versions = [str(sys.version_info[0])+'.'+str(sys.version_info[1]),
str(sys.version_info[0])+'.'+str(sys.version_info[1])+'m']
@@ -114,24 +114,25 @@ def main(argv):
continue
for p in prefixes:
c = checkPair(p, v, dllpre, dllsuff, bitness_magic)
- if c is not None:
+ if c:
known[v] = c
break
- keys = list(known.keys())
- # we want default to be the lowest versioned Python
- keys.sort()
- d = None
# We need separator other than newline, to sneak through $(shell)
sep = "|"
- for k in keys:
- if d is None:
- d = k
- vers = k.replace('.', '').upper()
- print_vars(vers, known[k], sep, bitness_magic)
- if d is not None:
- print_vars("DEF", known[d], sep, bitness_magic)
+
+ if not known:
+ # this type of problem should be detected in configure
+ # print_vars("DEF", defaultpaths, sep, bitness_magic)
+ pass
else:
print(argv[0] + ": No Python development package found!", file=sys.stderr)
+ if multi:
+ for ver, paths in known.items():
+ print_vars(ver.replace('.', '').upper(), paths, sep, bitness_magic)
+ else:
+ ver = versions[0]
+ paths = known[ver]
+ print_vars(ver.replace('.', ''), paths, sep, bitness_magic)
if __name__ == '__main__':
main(sys.argv)

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Sat May 21 20:17:00 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update support of building with Python
* Add vbox-python-py310.patch for support of Python 3.10
https://github.com/archlinux/svntogit-community/commit/59d75cd22
https://www.virtualbox.org/changeset/90537/vbox
https://www.virtualbox.org/changeset/86623/vbox
* Drop switch_to_python3.4+.patch and vbox-python-detection.diff;
replace by vbox-python-selection.patch for what is left of the
above after removing some obvious cruft. Could still be more in
there.
* Remove unnecessary reusage of old python2 macros, we use
python-rpm-macros already.
-------------------------------------------------------------------
Tue May 17 07:14:47 UTC 2022 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@ -41,17 +41,6 @@
%if ! %{defined _distconfdir}
%define _distconfdir %{_sysconfdir}
%endif
# Use Python3 rather than Python2 by default
%define __python %{_bindir}/python3
# In /usr/lib/rpm/macros, py_compile is hard-wired to use the command "python". I think
# this is a bug for which the work-around is to redefine that macro to use python3.
%define py_compile(O) \
find %{1} -name '*.pyc' -exec rm -f {} \\; \
python3 -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %{1} \
%{-O: \
find %{1} -name '*.pyo' -exec rm -f {} \\; \
python3 -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %{1} \
}
# Do not provide libGL.so symbols - they are owned by Mesa already and this could potentially confuse rpm/zypp
%global __provides_exclude ^libE?GL.so.1.*$
# With 32-bit builds, the job limit cannot be larger than 2, otherwise the build runs out of memory.
@ -107,8 +96,6 @@ Patch2: vbox-vboxadd-init-script.diff
#with renaming we probably break some macosx functionality however ths is just quick fix
#see thread : http://lists.freebsd.org/pipermail/freebsd-acpi/2010-October/006795.html
Patch6: vbox-smc-napa.diff
#fix build of Python and dev package on openSUSE 11.3
Patch8: vbox-python-detection.diff
#deprecated old-style C++ service proxies and objects,we have to use soapcpp2 -z1 flag
Patch9: vbox-deprec-gsoap-service-proxies.diff
#fix failed linking process during build - this patch is just quick workaround
@ -153,8 +140,11 @@ Patch118: internal-headers.patch
Patch120: fixes_for_python.patch
# Fix build for Qt 5.11
Patch122: fixes_for_Qt5.11.patch
# Switch to Python 3.4+
Patch123: switch_to_python3.4+.patch
# xpcom: Support up to python 3.10 -- https://www.virtualbox.org/changeset/90537/vbox + https://www.virtualbox.org/changeset/86623/vbox, thanks to Archlinux
Patch123: vbox-python-py310.patch
# fix build of Python and dev package on openSUSE 11.3 (was vbox-detection.diff)
# use plain python3 interpreter of the distro (part of former switch_to_pyton3.4+.patch),
Patch124: vbox-python-selection.patch
# Use build parameters to control video driver problems
Patch125: remove_vbox_video_build.patch
# fix library search
@ -202,7 +192,6 @@ Source2: VirtualBox.appdata.xml
### Requirements for virtualbox main package ###
%if %{main_package}
BuildRequires: LibVNCServer-devel
BuildRequires: pkgconfig(sdl)
BuildRequires: acpica
BuildRequires: alsa-devel
BuildRequires: bin86
@ -241,6 +230,7 @@ BuildRequires: pkgconfig(randrproto)
BuildRequires: pkgconfig(renderproto)
BuildRequires: pkgconfig(resourceproto)
BuildRequires: pkgconfig(scrnsaverproto)
BuildRequires: pkgconfig(sdl)
BuildRequires: pkgconfig(udev)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xau)
@ -305,14 +295,6 @@ hardware. VirtualBox is freely available as Open Source Software under
the terms of the GNU Public License (GPL).
##########################################
%package qt
Summary: Qt GUI part for %{name}
@ -331,14 +313,6 @@ Obsoletes: %{name}-ose-qt < %{version}
This package contains the code for the GUI used to control VMs.
#########################################
%package websrv
Summary: WebService GUI part for %{name}
@ -352,14 +326,6 @@ Obsoletes: %{name}-vboxwebsrv < %{version}
The VirtualBox web server is used to control headless VMs using a browser.
#########################################
%package guest-x11
Summary: VirtualBox X11 drivers for mouse and video
@ -375,14 +341,6 @@ Obsoletes: xorg-x11-driver-virtualbox-ose < %{version}
This package contains X11 guest utilities and X11 guest mouse and video drivers
###########################################
%package guest-tools
Summary: VirtualBox guest tools
@ -402,14 +360,6 @@ Requires(pre): net-tools-deprecated
VirtualBox guest addition tools.
###########################################
%package -n python3-%{name}
Summary: Python bindings for %{name}
@ -429,14 +379,6 @@ Obsoletes: python3-%{name}-ose < %{version}
Python XPCOM bindings to %{name}. Used e.g. by vboxgtk package.
###########################################
%package devel
Summary: Devel files for %{name}
@ -451,14 +393,6 @@ Obsoletes: %{name}-ose-devel < %{version}
Development file for %{name}
###########################################
%package host-source
Summary: Source files for %{name} host kernel modules
@ -490,14 +424,6 @@ These can be built for custom kernels using
sudo %{_sbindir}/vboxguestconfig
###########################################
%package guest-desktop-icons
Summary: Icons for guest desktop files
@ -510,14 +436,6 @@ BuildArch: noarch
This package contains icons for guest desktop files that were created on the desktop.
###########################################
%package vnc
Summary: VNC desktop sharing
@ -544,7 +462,6 @@ This package contains the kernel-modules that VirtualBox uses to create or run v
%patch1 -p1
%patch2 -p1
%patch6 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch99 -p1
@ -568,6 +485,7 @@ This package contains the kernel-modules that VirtualBox uses to create or run v
%patch120 -p1
%patch122 -p1
%patch123 -p1
%patch124 -p1
%patch125 -p1
%patch128 -p1
# Adjustments that are version dependent
@ -848,7 +766,7 @@ VBOX_INSTALL_PATH=%{_vbox_instdir} python3 vboxapisetup.py install --prefix=%{_p
popd
install -d -m 755 %{buildroot}%{_vbox_instdir}/sdk/bindings/xpcom
cp -r out/linux.*/release/bin/sdk/bindings/xpcom/python %{buildroot}%{_vbox_instdir}/sdk/bindings/xpcom
%py_compile %{buildroot}%{_vbox_instdir}/sdk/bindings/xpcom/python
%py3_compile %{buildroot}%{_vbox_instdir}/sdk/bindings/xpcom/python
######################################################
echo "entering virtualbox-devel install section"