diff options
author | ToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp> | 2020-03-30 09:24:26 +0900 |
---|---|---|
committer | ToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp> | 2020-03-30 09:24:26 +0900 |
commit | 5b80bfd7bffd4c20d80b7c70a7130529e9a755dd (patch) | |
tree | b4bb18dcd1487dbf1ea8127e5671b7bb2eded033 /external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch | |
parent | 706ad73eb02caf8532deaf5d38995bd258725cb8 (diff) |
agl-basesystem
Diffstat (limited to 'external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch')
-rw-r--r-- | external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch new file mode 100644 index 00000000..30c30e88 --- /dev/null +++ b/external/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch @@ -0,0 +1,87 @@ +Adding support for LIBVIRT_CFLAGS and LIBVIRT_LIBS + +Signed-off-by: Amy Fong <amy.fong@windriver.com> + + +Adding a support for LIBVIRT_API_PATH evironment variable, which can +control where the script should look for the 'libvirt-api.xml' file. +This allows building libvirt-python against different libvirt than the +one installed in the system. This may be used for example in autotest +or by packagers without the need to install libvirt into the system. + +Signed-off-by: Martin Kletzander <mkletzan redhat com> +[ywei: rebased to 1.3.2] +Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com> +--- + setup.py | 35 ++++++++++++++++++++++++----------- + 1 file changed, 24 insertions(+), 11 deletions(-) + +diff --git a/setup.py b/setup.py +index eff9d54..48ec4fe 100755 +--- a/setup.py ++++ b/setup.py +@@ -43,13 +43,7 @@ def check_minimum_libvirt_version(): + "libvirt"]) + + def have_libvirt_lxc(): +- try: +- spawn([get_pkgcfg(), +- "--atleast-version=%s" % MIN_LIBVIRT_LXC, +- "libvirt"]) +- return True +- except DistutilsExecError: +- return False ++ return True + + def have_libvirtaio(): + # This depends on asyncio, which in turn depends on "yield from" syntax. +@@ -77,7 +71,17 @@ def get_api_xml_files(): + """Check with pkg-config that libvirt is present and extract + the API XML file paths we need from it""" + +- libvirt_api = get_pkgconfig_data(["--variable", "libvirt_api"], "libvirt") ++ libvirt_api = os.getenv("LIBVIRT_API_PATH") ++ ++ if libvirt_api: ++ if not libvirt_api.endswith("-api.xml"): ++ raise ValueError("Invalid path '%s' for API XML" % libvirt_api) ++ if not os.path.exists(libvirt_api): ++ raise ValueError("API XML '%s' does not exist, " ++ "have you built libvirt?" % libvirt_api) ++ else: ++ libvirt_api = get_pkgconfig_data(["--variable", "libvirt_api"], ++ "libvirt") + + offset = libvirt_api.index("-api.xml") + libvirt_qemu_api = libvirt_api[0:offset] + "-qemu-api.xml" +@@ -97,8 +101,17 @@ def get_module_lists(): + + c_modules = [] + py_modules = [] +- ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False).split() +- cflags = get_pkgconfig_data(["--cflags"], "libvirt", False).split() ++ libvirt_cflags = os.getenv("LIBVIRT_CFLAGS") ++ if libvirt_cflags: ++ cflags = libvirt_cflags.split() ++ else: ++ cflags = get_pkgconfig_data(["--cflags"], "libvirt", False).split() ++ ++ libvirt_libs = os.getenv("LIBVIRT_LIBS") ++ if libvirt_libs: ++ ldflags = libvirt_libs.split() ++ else: ++ ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False).split() + + module = Extension('libvirtmod', + sources = ['libvirt-override.c', 'build/libvirt.c', 'typewrappers.c', 'libvirt-utils.c'], +@@ -144,7 +157,7 @@ def get_module_lists(): + class my_build(build): + + def run(self): +- check_minimum_libvirt_version() ++# check_minimum_libvirt_version() + apis = get_api_xml_files() + + self.spawn([sys.executable, "generator.py", "libvirt", apis[0]]) +-- +2.17.0 |