diff options
Diffstat (limited to 'recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch')
-rw-r--r-- | recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch | 89 |
1 files changed, 89 insertions, 0 deletions
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 @@ | |||
1 | Adding support for LIBVIRT_CFLAGS and LIBVIRT_LIBS | ||
2 | |||
3 | Signed-off-by: Amy Fong <amy.fong@windriver.com> | ||
4 | |||
5 | |||
6 | Adding a support for LIBVIRT_API_PATH evironment variable, which can | ||
7 | control where the script should look for the 'libvirt-api.xml' file. | ||
8 | This allows building libvirt-python against different libvirt than the | ||
9 | one installed in the system. This may be used for example in autotest | ||
10 | or by packagers without the need to install libvirt into the system. | ||
11 | |||
12 | Signed-off-by: Martin Kletzander <mkletzan redhat com> | ||
13 | --- | ||
14 | setup.py | 25 ++++++++++++++++++++++--- | ||
15 | 1 file changed, 22 insertions(+), 3 deletions(-) | ||
16 | |||
17 | Index: 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 = [] | ||