openvswitch: python: rework host and target dependency
Open vSwitch needs to run python on build machine to make build-time required files. python-six library is only required by the openvswitch python library on target machine, not a build dependency. We override host PYTHONPATH by overriding it in MAKE_VARS. This way we can remove 0003-override-pythonpath-via-make-vars.patch This also fixes shebang wrongly pointing to python on host Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
This commit is contained in:
parent
5b56acae21
commit
f53d452bd1
3 changed files with 65 additions and 32 deletions
|
@ -22,14 +22,14 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|||
PKG_SOURCE_URL:=http://openvswitch.org/releases/
|
||||
PKG_HASH:=8d1c439e26d7044f0ec823c7fef1b00b7c6465da0b83a7d0cf3191ed1dc43893
|
||||
|
||||
PKG_BUILD_DEPENDS:=python/host python-six/host
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_openvswitch-python
|
||||
PKG_BUILD_DEPENDS:=python/host
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../../lang/python/python-host.mk
|
||||
include ../../lang/python/python-package.mk
|
||||
|
||||
define Package/openvswitch/Default
|
||||
|
@ -155,12 +155,12 @@ CONFIGURE_VARS += \
|
|||
ovs_cv_flake8=no \
|
||||
ovs_cv_python3=no \
|
||||
ovs_cv_sphinx=no \
|
||||
ovs_cv_python=$(PYTHON) \
|
||||
ovs_cv_python_host=$(HOST_PYTHON_BIN) \
|
||||
KARCH=$(LINUX_KARCH)
|
||||
|
||||
MAKE_FLAGS += \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
PYTHONPATH="$(HOST_PYTHONPATH)" \
|
||||
PYTHON="$(HOST_PYTHON_BIN)"
|
||||
MAKE_VARS += PYTHONPATH="$(HOST_PYTHONPATH)"
|
||||
MAKE_FLAGS += ARCH="$(LINUX_KARCH)"
|
||||
|
||||
define OvsBinUtility
|
||||
define Package/openvswitch-$(2)
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
diff --git a/Makefile.am b/Makefile.am
|
||||
index a4dd7b8..099a3c1 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -53,7 +53,7 @@ endif
|
||||
# foo/__init__.py into an (older) version with plain foo.py, since
|
||||
# foo/__init__.pyc will cause Python to ignore foo.py.
|
||||
run_python = \
|
||||
- PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
|
||||
+ PYTHONPATH=$(top_srcdir)/python$(psep)$(PYTHONPATH) \
|
||||
PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
|
||||
|
||||
ALL_LOCAL =
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 8df66e2..98b54bf 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -1654,7 +1654,7 @@ AM_CFLAGS = -Wstrict-prototypes $(WARNING_FLAGS) $(OVS_CFLAGS) \
|
||||
# foo/__init__.py into an (older) version with plain foo.py, since
|
||||
# foo/__init__.pyc will cause Python to ignore foo.py.
|
||||
run_python = \
|
||||
- PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
|
||||
+ PYTHONPATH=$(top_srcdir)/python$(psep)$(PYTHONPATH) \
|
||||
PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
From dd52bf474a8c03a3b7a5d73229b64971d76adafd Mon Sep 17 00:00:00 2001
|
||||
From: Yousong Zhou <yszhou4tech@gmail.com>
|
||||
Date: Wed, 28 Feb 2018 13:42:44 +0800
|
||||
Subject: [PATCH] python: separate host/target python for cross-compile
|
||||
|
||||
At the moment, python-six is a requirement for openvswitch python
|
||||
library on target machine.
|
||||
|
||||
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
||||
---
|
||||
Makefile.am | 2 +-
|
||||
m4/openvswitch.m4 | 12 ++++--------
|
||||
2 files changed, 5 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 31d6331..4b9e8d4 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -59,7 +59,7 @@ endif
|
||||
# foo/__init__.pyc will cause Python to ignore foo.py.
|
||||
run_python = \
|
||||
PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
|
||||
- PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
|
||||
+ PYTHONDONTWRITEBYTECODE=yes $(PYTHON_HOST)
|
||||
|
||||
ALL_LOCAL =
|
||||
BUILT_SOURCES =
|
||||
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
|
||||
index 00ffad3..52f207b 100644
|
||||
--- a/m4/openvswitch.m4
|
||||
+++ b/m4/openvswitch.m4
|
||||
@@ -347,20 +347,16 @@ else:
|
||||
if test $ovs_cv_python = no; then
|
||||
AC_MSG_ERROR([cannot find python 2.7 or higher.])
|
||||
fi
|
||||
- AM_MISSING_PROG([PYTHON], [python])
|
||||
+ AC_SUBST([PYTHON])
|
||||
PYTHON=$ovs_cv_python
|
||||
+ AM_MISSING_PROG([PYTHON_HOST], [python])
|
||||
+ PYTHON_HOST=$ovs_cv_python_host
|
||||
|
||||
# HAVE_PYTHON is always true. (Python has not always been a build
|
||||
# requirement, so this variable is now obsolete.)
|
||||
AC_SUBST([HAVE_PYTHON])
|
||||
HAVE_PYTHON=yes
|
||||
- AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])
|
||||
-
|
||||
- AC_MSG_CHECKING([whether $PYTHON has six library])
|
||||
- if ! $PYTHON -c 'import six ; six.moves.range' >&AS_MESSAGE_LOG_FD 2>&1; then
|
||||
- AC_MSG_ERROR([Missing Python six library or version too old.])
|
||||
- fi
|
||||
- AC_MSG_RESULT([yes])])
|
||||
+ AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
|
||||
|
||||
dnl Checks for Python 3.x, x >= 4.
|
||||
AC_DEFUN([OVS_CHECK_PYTHON3],
|
||||
--
|
||||
1.8.3.1
|
||||
|
Loading…
Reference in a new issue