summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2017-01-13 16:49:56 -0500
committerBruce Ashfield <bruce.ashfield@windriver.com>2017-01-14 19:26:17 -0500
commitb6d051a19770e65bd23bccbd2fc6e948092a6f16 (patch)
tree6cd71317a88a7f731cf3f55a49c9ded2df4e4ab3
parent9152441483600a4f102320c805e892a4cd0252dd (diff)
downloadmeta-virtualization-b6d051a19770e65bd23bccbd2fc6e948092a6f16.tar.gz
openvswitch: fix build host contamination
There is only a single PYTHON variable for configure and yet python is used for the build as well as scripts installed on the target. If we set a path in PYTHON as we had we end up using this same path during the build and since it isn't to the sysroot we end up with host contamination (as demonstrated by python failing to import 'six' on build hosts without python-six installed. The best approach is to set PYTHON to "python" when calling configure, ie. without a path. This will use 'python' from the path during build time and by ensuring all the installed scripts use '/usr/bin/env' we can ensure python will be found on the target when the scripts are run. Since 'six' is used as part of the build we have to ensure it is -native'ly buildable and we set all the required build and runtime dependencies. Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r--recipes-devtools/python/python-six_1.10.0.bb2
-rw-r--r--recipes-networking/openvswitch/files/python-make-remaining-scripts-use-usr-bin-env.patch53
-rw-r--r--recipes-networking/openvswitch/openvswitch.inc10
-rw-r--r--recipes-networking/openvswitch/openvswitch_git.bb1
4 files changed, 61 insertions, 5 deletions
diff --git a/recipes-devtools/python/python-six_1.10.0.bb b/recipes-devtools/python/python-six_1.10.0.bb
index a84a4c49..c279f9f1 100644
--- a/recipes-devtools/python/python-six_1.10.0.bb
+++ b/recipes-devtools/python/python-six_1.10.0.bb
@@ -15,3 +15,5 @@ SRC_URI[sha256sum] = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a
15S = "${WORKDIR}/${SRCNAME}-${PV}" 15S = "${WORKDIR}/${SRCNAME}-${PV}"
16 16
17inherit setuptools 17inherit setuptools
18
19BBCLASSEXTEND = "native" \ No newline at end of file
diff --git a/recipes-networking/openvswitch/files/python-make-remaining-scripts-use-usr-bin-env.patch b/recipes-networking/openvswitch/files/python-make-remaining-scripts-use-usr-bin-env.patch
new file mode 100644
index 00000000..6091930e
--- /dev/null
+++ b/recipes-networking/openvswitch/files/python-make-remaining-scripts-use-usr-bin-env.patch
@@ -0,0 +1,53 @@
1From 33769657e951da855b9258eb91fa9838373023ad Mon Sep 17 00:00:00 2001
2From: Mark Asselstine <mark.asselstine@windriver.com>
3Date: Fri, 13 Jan 2017 16:12:55 -0500
4Subject: [PATCH] python: make remaining scripts use /usr/bin/env
5
6Unfortunately there is no concept of a host python vs. target python
7to facilitate cross compilation. There is only one PYTHON variable and
8this is used during building and in the header of python scripts after
9installation. The best approach for cross compilation is to thus to
10ensure python is in the path and avoid passing a path as part of
11PYTHON. To make this function smoothly all installed scripts should
12make use of /usr/bin/env to increase the chances of finding python.
13
14Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
15---
16 ovsdb/ovsdb-dot.in | 2 +-
17 ovsdb/ovsdb-idlc.in | 2 +-
18 utilities/bugtool/ovs-bugtool.in | 2 +-
19 3 files changed, 3 insertions(+), 3 deletions(-)
20
21diff --git a/ovsdb/ovsdb-dot.in b/ovsdb/ovsdb-dot.in
22index 134ce22..893c408 100755
23--- a/ovsdb/ovsdb-dot.in
24+++ b/ovsdb/ovsdb-dot.in
25@@ -1,4 +1,4 @@
26-#! @PYTHON@
27+#! /usr/bin/env @PYTHON@
28
29 from datetime import date
30 import ovs.db.error
31diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
32index cd4532e..dceb02f 100755
33--- a/ovsdb/ovsdb-idlc.in
34+++ b/ovsdb/ovsdb-idlc.in
35@@ -1,4 +1,4 @@
36-#! @PYTHON@
37+#! /usr/bin/env @PYTHON@
38
39 import getopt
40 import os
41diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in
42index bb771b0..152d171 100755
43--- a/utilities/bugtool/ovs-bugtool.in
44+++ b/utilities/bugtool/ovs-bugtool.in
45@@ -1,4 +1,4 @@
46-#! @PYTHON@
47+#! /usr/bin/env @PYTHON@
48
49 # This library is free software; you can redistribute it and/or
50 # modify it under the terms of version 2.1 of the GNU Lesser General Public
51--
522.7.4
53
diff --git a/recipes-networking/openvswitch/openvswitch.inc b/recipes-networking/openvswitch/openvswitch.inc
index ab1f8feb..71c746fc 100644
--- a/recipes-networking/openvswitch/openvswitch.inc
+++ b/recipes-networking/openvswitch/openvswitch.inc
@@ -11,11 +11,11 @@ HOMEPAGE = "http://openvswitch.org/"
11SECTION = "networking" 11SECTION = "networking"
12LICENSE = "Apache-2" 12LICENSE = "Apache-2"
13 13
14DEPENDS += "bridge-utils openssl python perl" 14DEPENDS += "bridge-utils openssl python perl python-six-native"
15 15
16RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid coreutils \ 16RDEPENDS_${PN} += "util-linux-uuidgen util-linux-libuuid coreutils \
17 python perl perl-module-strict ${PN}-switch \ 17 python perl perl-module-strict ${PN}-switch \
18 bash python-twisted" 18 bash python-twisted python-six"
19RDEPENDS_${PN}-testcontroller = "${PN} lsb ${PN}-pki" 19RDEPENDS_${PN}-testcontroller = "${PN} lsb ${PN}-pki"
20RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen" 20RDEPENDS_${PN}-switch = "${PN} openssl procps util-linux-uuidgen"
21RDEPENDS_${PN}-pki = "${PN}" 21RDEPENDS_${PN}-pki = "${PN}"
@@ -34,8 +34,8 @@ SRC_URI = "\
34 " 34 "
35 35
36EXTRA_OECONF += "\ 36EXTRA_OECONF += "\
37 PYTHON=${bindir}/python \ 37 PYTHON=python \
38 PYTHON3=${bindir}/python3 \ 38 PYTHON3=python3 \
39 PERL=${bindir}/perl \ 39 PERL=${bindir}/perl \
40 " 40 "
41CONFIGUREOPT_DEPTRACK = "" 41CONFIGUREOPT_DEPTRACK = ""
@@ -70,7 +70,7 @@ FILES_${PN} += "${datadir}/ovsdbmonitor"
70FILES_${PN} += "/run" 70FILES_${PN} += "/run"
71 71
72FILES_${PN} += "${libdir}/python${PYTHON_BASEVERSION}/" 72FILES_${PN} += "${libdir}/python${PYTHON_BASEVERSION}/"
73inherit autotools update-rc.d systemd python-dir 73inherit autotools update-rc.d systemd pythonnative
74 74
75SYSTEMD_PACKAGES = "${PN}-switch" 75SYSTEMD_PACKAGES = "${PN}-switch"
76SYSTEMD_SERVICE_${PN}-switch = " \ 76SYSTEMD_SERVICE_${PN}-switch = " \
diff --git a/recipes-networking/openvswitch/openvswitch_git.bb b/recipes-networking/openvswitch/openvswitch_git.bb
index 55e3a9a2..455fab05 100644
--- a/recipes-networking/openvswitch/openvswitch_git.bb
+++ b/recipes-networking/openvswitch/openvswitch_git.bb
@@ -24,6 +24,7 @@ SRC_URI += "\
24 file://disable_m4_check.patch \ 24 file://disable_m4_check.patch \
25 file://kernel_module.patch \ 25 file://kernel_module.patch \
26 file://openvswitch-ptest-Fix-python-path.patch \ 26 file://openvswitch-ptest-Fix-python-path.patch \
27 file://python-make-remaining-scripts-use-usr-bin-env.patch \
27 " 28 "
28 29
29LIC_FILES_CHKSUM = "file://COPYING;md5=17b2c9d4c70853a09c0e143137754b35" 30LIC_FILES_CHKSUM = "file://COPYING;md5=17b2c9d4c70853a09c0e143137754b35"