summaryrefslogtreecommitdiffstats
path: root/recipes-extended
diff options
context:
space:
mode:
authorAmy Fong <amy.fong@windriver.com>2014-02-03 14:36:57 -0500
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-02-05 11:29:12 -0500
commit43fe4b7d0e517a6eceb28382a8d8d89b8379f6c6 (patch)
tree689c686ebee8b9431afa38c8b39e115e3599ccef /recipes-extended
parent851547589048e0ac253d682d22b25b8baac3ce02 (diff)
downloadmeta-virtualization-43fe4b7d0e517a6eceb28382a8d8d89b8379f6c6.tar.gz
package libvirt-python
In 1.2.0, libvirt separated the python components into a separate package. Signed-off-by: Amy Fong <amy.fong@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-extended')
-rw-r--r--recipes-extended/libvirt/libvirt-python.inc37
-rw-r--r--recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch89
-rw-r--r--recipes-extended/libvirt/libvirt_1.2.1.bb6
3 files changed, 128 insertions, 4 deletions
diff --git a/recipes-extended/libvirt/libvirt-python.inc b/recipes-extended/libvirt/libvirt-python.inc
index 0d3278d2..8f553988 100644
--- a/recipes-extended/libvirt/libvirt-python.inc
+++ b/recipes-extended/libvirt/libvirt-python.inc
@@ -14,4 +14,39 @@ FILES_${PN}-python-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la"
14FILES_${PN}-python-dbg += "${PYTHON_SITEPACKAGES_DIR}/.debug/" 14FILES_${PN}-python-dbg += "${PYTHON_SITEPACKAGES_DIR}/.debug/"
15FILES_${PN}-python += "${PYTHON_SITEPACKAGES_DIR}" 15FILES_${PN}-python += "${PYTHON_SITEPACKAGES_DIR}"
16 16
17EXTRA_OECONF += "TARGET_PYTHON=${bindir}/python" 17SRC_URI += "http://libvirt.org/sources/python/libvirt-python-${PV}.tar.gz;name=libvirt_python"
18SRC_URI += "file://libvirt_api_xml_path.patch;patchdir=../libvirt-python-${PV}"
19
20SRC_URI[libvirt_python.md5sum] = "38158e5740be65f17eef9f99ffa5dadf"
21SRC_URI[libvirt_python.sha256sum] = "2fe7e341cb1b35cff130b7a04d0d58f3607094e63cbca689bc16c7b47da0f52b"
22
23export LIBVIRT_API_PATH = "${S}/docs/libvirt-api.xml"
24export LIBVIRT_CFLAGS = "-I${S}/include"
25export LIBVIRT_LIBS = "-L${S}/src/.libs -lvirt -ldl"
26export LDFLAGS="-L${S}/src/.libs"
27
28python __anonymous () {
29 pkgconfig = d.getVar('PACKAGECONFIG', True)
30 if ('python') in pkgconfig.split():
31 d.setVar('LIBVIRT_PYTHON_ENABLE', '1')
32 else:
33 d.setVar('LIBVIRT_PYTHON_ENABLE', '0')
34}
35
36do_compile_python() {
37 if [ "${LIBVIRT_PYTHON_ENABLE}" = "1" ]; then
38 cd ${WORKDIR}/libvirt-python-${PV} && \
39 ${STAGING_BINDIR_NATIVE}/python-native/python setup.py build
40 fi
41}
42addtask do_compile_python before do_install after do_compile
43
44do_install_python() {
45 if [ "${LIBVIRT_PYTHON_ENABLE}" = "1" ]; then
46 cd ${WORKDIR}/libvirt-python-${PV} && \
47 ${STAGING_BINDIR_NATIVE}/python-native/python setup.py install \
48 --install-lib=${PYTHON_SITEPACKAGES_DIR} \
49 --root=${WORKDIR}/image
50 fi
51}
52addtask do_install_python before do_populate_sysroot after do_install
diff --git a/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch b/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch
new file mode 100644
index 00000000..0aa3bde2
--- /dev/null
+++ b/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch
@@ -0,0 +1,89 @@
1Adding support for LIBVIRT_CFLAGS and LIBVIRT_LIBS
2
3Signed-off-by: Amy Fong <amy.fong@windriver.com>
4
5
6Adding a support for LIBVIRT_API_PATH evironment variable, which can
7control where the script should look for the 'libvirt-api.xml' file.
8This allows building libvirt-python against different libvirt than the
9one installed in the system. This may be used for example in autotest
10or by packagers without the need to install libvirt into the system.
11
12Signed-off-by: Martin Kletzander <mkletzan redhat com>
13---
14 setup.py | 25 ++++++++++++++++++++++---
15 1 file changed, 22 insertions(+), 3 deletions(-)
16
17Index: libvirt-python-1.2.1/setup.py
18===================================================================
19--- libvirt-python-1.2.1.orig/setup.py
20+++ libvirt-python-1.2.1/setup.py
21@@ -30,18 +30,19 @@
22 if pkgcfg is None:
23 raise Exception("pkg-config binary is required to compile libvirt-python")
24
25-spawn([pkgcfg,
26- "--print-errors",
27- "--atleast-version=%s" % MIN_LIBVIRT,
28- "libvirt"])
29+# spawn([pkgcfg,
30+# "--print-errors",
31+# "--atleast-version=%s" % MIN_LIBVIRT,
32+# "libvirt"])
33
34 have_libvirt_lxc=True
35-try:
36- spawn([pkgcfg,
37- "--atleast-version=%s" % MIN_LIBVIRT_LXC,
38- "libvirt"])
39-except DistutilsExecError:
40- have_libvirt_lxc=False
41+# try:
42+# spawn([pkgcfg,
43+# "--atleast-version=%s" % MIN_LIBVIRT_LXC,
44+# "libvirt"])
45+# except DistutilsExecError:
46+# have_libvirt_lxc=False
47+have_libvirt_lxc=True
48
49 def get_pkgconfig_data(args, mod, required=True):
50 """Run pkg-config to and return content associated with it"""
51@@ -63,7 +64,17 @@
52 """Check with pkg-config that libvirt is present and extract
53 the API XML file paths we need from it"""
54
55- libvirt_api = get_pkgconfig_data(["--variable", "libvirt_api"], "libvirt")
56+ libvirt_api = os.getenv("LIBVIRT_API_PATH")
57+
58+ if libvirt_api:
59+ if not libvirt_api.endswith("-api.xml"):
60+ raise ValueError("Invalid path '%s' for API XML" % libvirt_api)
61+ if not os.path.exists(libvirt_api):
62+ raise ValueError("API XML '%s' does not exist, "
63+ "have you built libvirt?" % libvirt_api)
64+ else:
65+ libvirt_api = get_pkgconfig_data(["--variable", "libvirt_api"],
66+ "libvirt")
67
68 offset = libvirt_api.index("-api.xml")
69 libvirt_qemu_api = libvirt_api[0:offset] + "-qemu-api.xml"
70@@ -73,8 +84,17 @@
71
72 return (libvirt_api, libvirt_qemu_api, libvirt_lxc_api)
73
74-ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False)
75-cflags = get_pkgconfig_data(["--cflags"], "libvirt", False)
76+libvirt_cflags = os.getenv("LIBVIRT_CFLAGS")
77+if libvirt_cflags:
78+ cflags = libvirt_cflags
79+else:
80+ cflags = get_pkgconfig_data(["--cflags"], "libvirt", False)
81+
82+libvirt_libs = os.getenv("LIBVIRT_LIBS")
83+if libvirt_libs:
84+ ldflags = libvirt_libs
85+else:
86+ ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False)
87
88 c_modules = []
89 py_modules = []
diff --git a/recipes-extended/libvirt/libvirt_1.2.1.bb b/recipes-extended/libvirt/libvirt_1.2.1.bb
index 4daddd36..912ca55a 100644
--- a/recipes-extended/libvirt/libvirt_1.2.1.bb
+++ b/recipes-extended/libvirt/libvirt_1.2.1.bb
@@ -19,13 +19,13 @@ RDEPENDS_libvirt-libvirtd_append_x86 = " dmidecode"
19#connman blocks the 53 port and libvirtd can't start its DNS service 19#connman blocks the 53 port and libvirtd can't start its DNS service
20RCONFLICTS_${PN}_libvirtd = "connman" 20RCONFLICTS_${PN}_libvirtd = "connman"
21 21
22SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz \ 22SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz;name=libvirt \
23 file://tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch \ 23 file://tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch \
24 file://libvirtd.sh \ 24 file://libvirtd.sh \
25 file://libvirtd.conf" 25 file://libvirtd.conf"
26 26
27SRC_URI[md5sum] = "cce374220f67895afb6331bd2ddedbfd" 27SRC_URI[libvirt.md5sum] = "cce374220f67895afb6331bd2ddedbfd"
28SRC_URI[sha256sum] = "bc29b5751bf36753c17e2fdbb75e70c7b07df3d9527586d3426e90f5f4abb898" 28SRC_URI[libvirt.sha256sum] = "bc29b5751bf36753c17e2fdbb75e70c7b07df3d9527586d3426e90f5f4abb898"
29 29
30inherit autotools gettext update-rc.d pkgconfig 30inherit autotools gettext update-rc.d pkgconfig
31 31