1
0
forked from pool/virtualbox

- Add file "fix_32_bit_builds.patch" to fix error in 32-bit builds.

Add file "switch_to_python3.6.patch" to convert to Python3.
  Update warning regarding the security hole in USB passthrough. The text no longer refers
  to an old bugzilla entry (bsc#1097248).
  Script vboxguestconfig.sh is fixed.

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=432
This commit is contained in:
Larry Finger 2018-06-19 17:53:58 +00:00 committed by Git OBS Bridge
parent daf1117235
commit 2ab1b7752d
7 changed files with 219 additions and 27 deletions

13
fix_32_bit_builds.patch Normal file
View File

@ -0,0 +1,13 @@
Index: VirtualBox-5.2.12/src/VBox/Additions/linux/sharedfolders/utils.c
===================================================================
--- VirtualBox-5.2.12.orig/src/VBox/Additions/linux/sharedfolders/utils.c
+++ VirtualBox-5.2.12/src/VBox/Additions/linux/sharedfolders/utils.c
@@ -50,7 +50,7 @@ static void sf_timespec_from_ftime(RTTIM
RTTimeSpecSetNano(ts, t);
}
#else /* >= 2.6.0 */
-static void sf_ftime_from_timespec(struct timespec *tv, RTTIMESPEC *ts)
+static void sf_ftime_from_timespec(struct timespec64 *tv, RTTIMESPEC *ts)
{
int64_t t = RTTimeSpecGetNano(ts);
int64_t nsec;

View File

@ -1,5 +1,5 @@
To eliminate an rpmlint error, the shebang for this script should be
changed to use pythin directly, rather than through env.
changed to use python directly, rather than through env.
When openSUSE switches to Python3, the shebang below should be changed
to "#!/usr/bin/python3".
@ -12,7 +12,7 @@ Index: VirtualBox-5.1.30/src/VBox/Frontends/VBoxShell/vboxshell.py
+++ VirtualBox-5.1.30/src/VBox/Frontends/VBoxShell/vboxshell.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
# $Id: vboxshell.py $

148
switch_to_python3.6.patch Normal file
View File

@ -0,0 +1,148 @@
Index: VirtualBox-5.2.12/configure
===================================================================
--- VirtualBox-5.2.12.orig/configure
+++ VirtualBox-5.2.12/configure
@@ -1953,17 +1953,17 @@ extern "C" int main(void)
{
Py_Initialize();
printf("found version %s", PY_VERSION);
-#if PY_VERSION_HEX >= 0x02060000
+#if PY_VERSION_HEX >= 0x03060000
printf(", OK.\n");
return 0;
#else
- printf(", expected version 2.6 or higher\n");
+ printf(", expected version 3.6 or higher\n");
return 1;
#endif
}
EOF
found=
- SUPPYTHONLIBS="python2.7 python2.6 python3.1 python3.2 python3.3 python3.4 python3.4m python3.5 python3.5m"
+ SUPPYTHONLIBS="python3.6m"
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: VirtualBox-5.2.12/src/VBox/Installer/linux/routines.sh
===================================================================
--- VirtualBox-5.2.12.orig/src/VBox/Installer/linux/routines.sh
+++ VirtualBox-5.2.12/src/VBox/Installer/linux/routines.sh
@@ -367,8 +367,8 @@ terminate_proc() {
maybe_run_python_bindings_installer() {
VBOX_INSTALL_PATH="${1}"
- PYTHON=python
- if [ "`python -c 'import sys
+ PYTHON=python3
+ if [ "`python3 -c 'import sys
if sys.version_info >= (2, 6):
print \"test\"' 2> /dev/null`" != "test" ]; then
echo 1>&2 "Python 2.6 or later not available, skipping bindings installation."
Index: VirtualBox-5.2.12/src/bldprogs/scm.cpp
===================================================================
--- VirtualBox-5.2.12.orig/src/bldprogs/scm.cpp
+++ VirtualBox-5.2.12/src/bldprogs/scm.cpp
@@ -2031,7 +2031,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-5.2.12/src/libs/libxml2-2.9.4/configure
===================================================================
--- VirtualBox-5.2.12.orig/src/libs/libxml2-2.9.4/configure
+++ VirtualBox-5.2.12/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-5.2.12/src/VBox/ValidationKit/testboxscript/setup.sh
===================================================================
--- VirtualBox-5.2.12.orig/src/VBox/ValidationKit/testboxscript/setup.sh
+++ VirtualBox-5.2.12/src/VBox/ValidationKit/testboxscript/setup.sh
@@ -644,7 +644,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-5.2.12/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
===================================================================
--- VirtualBox-5.2.12.orig/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
+++ VirtualBox-5.2.12/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
@@ -20,7 +20,7 @@
%define %PYTHON% 1
%define VBOXDOCDIR %{_defaultdocdir}/%NAME%
%global __requires_exclude_from ^/usr/lib/virtualbox/VBoxPython.*$
-%{!?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%
@@ -82,7 +82,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 && \
- %{__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 nls $RPM_BUILD_ROOT/usr/share/virtualbox
Index: VirtualBox-5.2.12/src/libs/libxml2-2.9.4/libxml.spec.in
===================================================================
--- VirtualBox-5.2.12.orig/src/libs/libxml2-2.9.4/libxml.spec.in
+++ VirtualBox-5.2.12/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-5.2.12/src/libs/libxml2-2.9.4/libxml2.spec
===================================================================
--- VirtualBox-5.2.12.orig/src/libs/libxml2-2.9.4/libxml2.spec
+++ VirtualBox-5.2.12/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

View File

@ -49,11 +49,10 @@ Index: VirtualBox-5.1.22/src/apps/VBoxUSB_DevRules/VBoxUSB_DevRules.cpp
===================================================================
--- /dev/null
+++ VirtualBox-5.1.22/src/apps/VBoxUSB_DevRules/VBoxUSB_DevRules.cpp
@@ -0,0 +1,26 @@
@@ -0,0 +1,25 @@
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QMessageBox>
+#include <QtWidgets/QPushButton>
+
+#include <QtWidgets/QPushButton>+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
@ -61,13 +60,13 @@ Index: VirtualBox-5.1.22/src/apps/VBoxUSB_DevRules/VBoxUSB_DevRules.cpp
+ QPushButton *myYesButton = msgBox.addButton("Enable", QMessageBox::YesRole);
+ QPushButton *myNoButton = msgBox.addButton("Disable", QMessageBox::NoRole);
+ msgBox.setWindowTitle(QObject::tr("USB Rules and Permissions !"));
+ msgBox.setText(QObject::tr("USB passthrough opens a security hole. "
+ "Please read \nhttps://bugzilla.novell.com/show_bug.cgi?id=664520\n"
+ "to understand the problem.\n\nWe regard USB passthrough to be extremely useful and worth the security risk. "
+ "Thus the code defaults to enabling this feature. If you agree that the risk is acceptable, then click 'Enable'.\n"
+ msgBox.setText(QObject::tr("USB passthrough requires read/write access to USB devices. "
+ "As a result, it opens a security hole.\n\n"
+ "Nonetheless, this feature is extremely useful and it may be worth the security risk. "
+ "Thus the code defaults to enabling it.\n\nIf you agree that the risk is acceptable, then click 'Enable'.\n"
+ "You will not be asked this question again when VB is updated. If you later change your mind, run 'rm ~/.vbox/*'\n\n"
+ "If you wish to disable USB passthrough to plug the security hole, then click 'Disable'. "
+ "You will be asked for the system password, and /etc/udev/rules.d/60-vboxdrv.rules will be changed.\n"
+ "You will be asked for the system password, and /etc/udev/rules.d/60-vboxdrv.rules will be changed.\n\n"
+ "These changes cannot be preserved through VB updates, thus this screen will be displayed again at that time."));
+ msgBox.exec();
+ app.quit();

View File

@ -12,16 +12,19 @@ INCLUDE="/lib/modules/`uname -r`/build/include"
# Test if vboxsf module loaded. If it is, skip everything else
loaded=$(lsmod | grep vboxsf)
if [ -n "$loaded" ] ; then
echo "Kernel modules available - exiting..."
exit 0
echo "Kernel modules available. but we will continue..."
fi
#
# Check if virtualbox-guest-source is installed, quit if not
if ! rpm -qf "$SOURCE/virtualbox/src/Makefile" &>/dev/null ; then
if ! rpm -qf "$SOURCE/additions/guest_src.tar.bz2" &>/dev/null ; then
echo "Sources for building guest modules are not present,"
echo "Use 'sudo zypper install virtualbox-guest-source' to install them. Quitting .."
exit 1
fi
# unpack source
pushd $SOURCE > /dev/null 2>&1
tar jxf additions/guest_src.tar.bz2 > /dev/null 2>&1
popd > /dev/null 2>&1
#
# Check if virtualbox-guest-source version matches virtualbox version
if [ "$(rpm -q virtualbox virtualbox-guest-source --queryformat='%{version}-%{release}\n' 2>/dev/null | sort -u | wc -l)" -ne "1" ] ; then
@ -29,10 +32,8 @@ if [ "$(rpm -q virtualbox virtualbox-guest-source --queryformat='%{version}-%{re
echo "This situation is probably not fatal, thus we will try to continue .."
fi
# Prerequisites are available, start build
pushd $SOURCE > /dev/null 2>&1
pushd $SOURCE/additions/src > /dev/null 2>&1
echo "Building kernel modules..."
tar jxf addition/guest_src.tar.bz2 > /dev/null 2>&1
cd additions/src
make > $LOGFILE 2>&1
if [ "$?" -ne 0 ] ; then
echo ""

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Jun 19 17:46:44 UTC 2018 - Larry.Finger@gmail.com
- Add file "fix_32_bit_builds.patch" to fix error in 32-bit builds.
Add file "switch_to_python3.6.patch" to convert to Python3.
Update warning regarding the security hole in USB passthrough. The text no longer refers
to an old bugzilla entry (bsc#1097248).
Script vboxguestconfig.sh is fixed.
-------------------------------------------------------------------
Tue Jun 19 07:43:42 UTC 2018 - msuchanek@suse.com

View File

@ -21,6 +21,18 @@
%define _fillupdir /var/adm/fillup-templates
%endif
# Use Python3 rather than Python2 by default
%define __python /usr/bin/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.*$
@ -120,6 +132,10 @@ Patch123: fixes_for_4.17.patch
Patch124: gcc8-configure.patch
# Fix build for Qt 5.11
Patch125: fixes_for_Qt5.11.patch
# Switch to Python 3.6
Patch126: switch_to_python3.6.patch
# Fix 32-bit builds
Patch127: fix_32_bit_builds.patch
#
BuildRequires: LibVNCServer-devel
BuildRequires: SDL-devel
@ -159,7 +175,7 @@ BuildRequires: libxslt-devel
BuildRequires: module-init-tools
BuildRequires: pam-devel
BuildRequires: pulseaudio-devel
BuildRequires: python2-devel
BuildRequires: python3-devel
BuildRequires: quilt
BuildRequires: sed
BuildRequires: update-desktop-files
@ -254,8 +270,8 @@ websrv GUI part for %{name}.
%package host-KMP
Summary: Host kernel module for VirtualBox
##\%kernel_module_package -t %%{_builddir}/virtualbox-kmp-template -p %%{SOURCE7} -n %%{name}-host -f %%{SOURCE5} -x kdump um xen pae xenpae pv
Group: System/Emulators/PC
%kernel_module_package -t %%{_builddir}/virtualbox-kmp-template -p %%{SOURCE7} -n %%{name}-host -f %%{SOURCE5} -x kdump um xen pae xenpae pv
Requires: %{kernel_module_package_buildreqs}
%description host-KMP
@ -303,17 +319,21 @@ Requires(pre): net-tools-deprecated
VirtualBox guest addition tools.
###########################################
%package -n python2-%{name}
%package -n python3-%{name}
Summary: Python bindings for %{name}
Group: Development/Libraries/Python
Requires: %{name} = %{version}
#rename from "ose" version:
Provides: python-%{name} = %{version}-%{release}
Provides: python3-%{name} = %{version}-%{release}
Obsoletes: python-%{name} < %{version}-%{release}
Provides: python-%{name}-ose = %{version}
Obsoletes: python2-%{name} < %{version}-%{release}
Obsoletes: python3-%{name} < %{version}-%{release}
Provides: python3-%{name}-ose = %{version}
Obsoletes: python-%{name}-ose < %{version}
Obsoletes: python2-%{name}-ose < %{version}
Obsoletes: python3-%{name}-ose < %{version}
%description -n python2-%{name}
%description -n python3-%{name}
Python XPCOM bindings to %{name}. Used e.g. by vboxgtk package.
###########################################
@ -321,7 +341,7 @@ Python XPCOM bindings to %{name}. Used e.g. by vboxgtk package.
Summary: Devel files for %{name}
Group: Development/Libraries/Other
Requires: %{name} = %{version}
Requires: python-%{name} = %{version}
Requires: python3-%{name} = %{version}
#rename from "ose" version:
Provides: %{name}-ose-devel = %{version}
Obsoletes: %{name}-ose-devel < %{version}
@ -347,8 +367,8 @@ cd %{_prefix}/src/kernel-modules/virtualbox ; make ; make install
%package guest-source
Summary: Source files for %{name} guest kernel modules
#Requires: %{name} = %{version}
Group: Development/Sources
Requires: %{name} = %{version}
Requires: gcc
Requires: make
BuildArch: noarch
@ -415,6 +435,8 @@ as an "extpack" for VirtualBox. The implementation is licensed under GPL.
%patch123 -p1
%patch124 -p1
%patch125 -p1
%patch126 -p1
%patch127 -p1
#copy user manual
cp %{SOURCE1} UserManual.pdf
@ -696,7 +718,7 @@ install -m 0755 -D src/VBox/Installer/linux/VBoxCreateUSBNode.sh %{buildroot}%{_
echo "entering python-virtualbox install section"
######################################################
pushd out/linux.*/release/bin/sdk/installer
VBOX_INSTALL_PATH=%{_vbox_instdir} python vboxapisetup.py install --prefix=%{_prefix} --root=%{buildroot} --record-rpm=%{_tmppath}/SITE_FILES
VBOX_INSTALL_PATH=%{_vbox_instdir} python3 vboxapisetup.py install --prefix=%{_prefix} --root=%{buildroot} --record-rpm=%{_tmppath}/SITE_FILES
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
@ -970,13 +992,13 @@ export DISABLE_RESTART_ON_UPDATE=yes
%dir /media
%endif
%files -n python2-%{name} -f %{_tmppath}/SITE_FILES
%files -n python3-%{name} -f %{_tmppath}/SITE_FILES
%defattr(-, root, root)
%dir %{_vbox_instdir}/sdk
%dir %{_vbox_instdir}/sdk/bindings
%dir %{_vbox_instdir}/sdk/bindings/xpcom
%{_vbox_instdir}/sdk/bindings/xpcom/python
%attr(0755, root, root) %{_vbox_instdir}/VBoxPython2_7.so
%attr(0755, root, root) %{_vbox_instdir}/VBoxPython3_6m.so
%files devel
%defattr(-,root, root)