From 691df78849528b358011c7a8a5446843a1fe9db8 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 5 Apr 2022 06:41:49 -0400 Subject: [PATCH] import mingw-qemu-ga-win-103.0.0-1.el9_0 --- .gitignore | 2 + .mingw-qemu-ga-win.metadata | 2 + SOURCES/0001-Change-Version.patch | 19 ++ ...01-Remove-redundant-GUID-definitions.patch | 33 +++ ...e-qga-vss-win32-meson.build-conditio.patch | 73 ++++++ SOURCES/0001-qga-Log-version-on-start.patch | 25 ++ ...S-based-on-Windows-10-by-first-build.patch | 70 ++++++ SOURCES/0002-qga-get_pci_info-leak-fix.patch | 75 ++++++ ...in-Detect-Windows-11-by-build-number.patch | 92 +++++++ SOURCES/build_configure.sh | 5 + SPECS/mingw-qemu-ga-win.spec | 227 ++++++++++++++++++ 11 files changed, 623 insertions(+) create mode 100644 .gitignore create mode 100644 .mingw-qemu-ga-win.metadata create mode 100644 SOURCES/0001-Change-Version.patch create mode 100644 SOURCES/0001-Remove-redundant-GUID-definitions.patch create mode 100644 SOURCES/0001-meson-do-not-make-qga-vss-win32-meson.build-conditio.patch create mode 100644 SOURCES/0001-qga-Log-version-on-start.patch create mode 100644 SOURCES/0001-qga-win-Detect-OS-based-on-Windows-10-by-first-build.patch create mode 100644 SOURCES/0002-qga-get_pci_info-leak-fix.patch create mode 100644 SOURCES/0002-qga-win-Detect-Windows-11-by-build-number.patch create mode 100755 SOURCES/build_configure.sh create mode 100644 SPECS/mingw-qemu-ga-win.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0fa6991 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/VSSSDK72.tar.gz +SOURCES/qemu-6.2.0.tar.bz2 diff --git a/.mingw-qemu-ga-win.metadata b/.mingw-qemu-ga-win.metadata new file mode 100644 index 0000000..4d34283 --- /dev/null +++ b/.mingw-qemu-ga-win.metadata @@ -0,0 +1,2 @@ +7dd4cfd7ad43ececee10e113f9d92cefc66ef2a4 SOURCES/VSSSDK72.tar.gz +f0d3a2e9b1565d5d7b0e25a73bf37d603a0d13fa SOURCES/qemu-6.2.0.tar.bz2 diff --git a/SOURCES/0001-Change-Version.patch b/SOURCES/0001-Change-Version.patch new file mode 100644 index 0000000..ebfe879 --- /dev/null +++ b/SOURCES/0001-Change-Version.patch @@ -0,0 +1,19 @@ +From 2b3580d0aea17648d3fb86dc8b993dfcb2b66f16 Mon Sep 17 00:00:00 2001 +From: Yan Vugenfirer +Date: Tue, 22 Jun 2021 13:13:00 +0300 +Subject: [PATCH 1/1] Change Version + +Signed-off-by: Yan Vugenfirer +--- + VERSION | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/VERSION b/VERSION +index 91ff57278e..586de296f5 100644 +--- a/VERSION ++++ b/VERSION +@@ -1 +1 @@ +-6.2.0 ++103.0.0 +-- +2.17.2 diff --git a/SOURCES/0001-Remove-redundant-GUID-definitions.patch b/SOURCES/0001-Remove-redundant-GUID-definitions.patch new file mode 100644 index 0000000..3c3da48 --- /dev/null +++ b/SOURCES/0001-Remove-redundant-GUID-definitions.patch @@ -0,0 +1,33 @@ +From e3583e102870f37f7abef4e501a718e83b5a75d1 Mon Sep 17 00:00:00 2001 +From: Yan Vugenfirer +Date: Mon, 27 Dec 2021 01:48:22 +0200 +Subject: [PATCH] Remove redundant GUID definitions. + +GUID_DEVINTERFACE_STORAGEPORT and GUID_DEVINTERFACE_DISK are already defined in glib2 + +Signed-off-by: Yan Vugenfirer +--- + qga/commands-win32.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/qga/commands-win32.c b/qga/commands-win32.c +index 830a24a..fbc5dfd 100644 +--- a/qga/commands-win32.c ++++ b/qga/commands-win32.c +@@ -505,13 +505,6 @@ static GuestDiskBusType find_bus_type(STORAGE_BUS_TYPE bus) + return win2qemu[(int)bus]; + } + +-DEFINE_GUID(GUID_DEVINTERFACE_DISK, +- 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, +- 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); +-DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT, +- 0x2accfe60L, 0xc130, 0x11d2, 0xb0, 0x82, +- 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); +- + static GuestPCIAddress *get_pci_info(int number, Error **errp) + { + HDEVINFO dev_info = INVALID_HANDLE_VALUE; +-- +1.8.3.1 + diff --git a/SOURCES/0001-meson-do-not-make-qga-vss-win32-meson.build-conditio.patch b/SOURCES/0001-meson-do-not-make-qga-vss-win32-meson.build-conditio.patch new file mode 100644 index 0000000..7187562 --- /dev/null +++ b/SOURCES/0001-meson-do-not-make-qga-vss-win32-meson.build-conditio.patch @@ -0,0 +1,73 @@ +From 2ee0253554227bd0cd26a00467765187168dda87 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Wed, 2 Feb 2022 00:23:33 +0400 +Subject: [PATCH] meson: do not make qga/vss-win32/meson.build conditional on + C++ presence +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +C++ presence is checked by the qga/ directory, so it can be assumed +when building VSS module. + +Signed-off-by: Marc-André Lureau +Reviewed-by: Konstantin Kostiuk +Signed-off-by: Paolo Bonzini +--- + qga/vss-win32/meson.build | 41 +++++++++++++++++++++++---------------- + 1 file changed, 24 insertions(+), 17 deletions(-) + +diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build +index 90825edef3..5982a6c6d8 100644 +--- a/qga/vss-win32/meson.build ++++ b/qga/vss-win32/meson.build +@@ -1,22 +1,29 @@ +-if add_languages('cpp', required: false) +- glib_dynamic = dependency('glib-2.0', static: false) +- link_args = cc.get_supported_link_arguments(['-fstack-protector-all', '-fstack-protector-strong', +- '-Wl,--add-stdcall-alias', '-Wl,--enable-stdcall-fixup']) ++glib_dynamic = dependency('glib-2.0', static: false) ++link_args = cc.get_supported_link_arguments([ ++ '-fstack-protector-all', ++ '-fstack-protector-strong', ++ '-Wl,--add-stdcall-alias', ++ '-Wl,--enable-stdcall-fixup' ++]) + +- qga_vss = shared_module('qga-vss', ['requester.cpp', 'provider.cpp', 'install.cpp'], +- name_prefix: '', +- cpp_args: ['-Wno-unknown-pragmas', '-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'], +- link_args: link_args, +- vs_module_defs: 'qga-vss.def', +- dependencies: [glib_dynamic, socket, +- cc.find_library('ole32'), +- cc.find_library('oleaut32'), +- cc.find_library('shlwapi'), +- cc.find_library('uuid'), +- cc.find_library('intl')]) ++qga_vss = shared_module( ++ 'qga-vss', ++ ['requester.cpp', 'provider.cpp', 'install.cpp'], ++ name_prefix: '', ++ cpp_args: ['-Wno-unknown-pragmas', '-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'], ++ link_args: link_args, ++ vs_module_defs: 'qga-vss.def', ++ dependencies: [ ++ glib_dynamic, socket, ++ cc.find_library('ole32'), ++ cc.find_library('oleaut32'), ++ cc.find_library('shlwapi'), ++ cc.find_library('uuid'), ++ cc.find_library('intl') ++ ] ++) + +- all_qga += qga_vss +-endif ++all_qga += qga_vss + + # rules to build qga-vss.tlb + # Currently, only native build is supported because building .tlb +-- +2.25.1 + diff --git a/SOURCES/0001-qga-Log-version-on-start.patch b/SOURCES/0001-qga-Log-version-on-start.patch new file mode 100644 index 0000000..49df653 --- /dev/null +++ b/SOURCES/0001-qga-Log-version-on-start.patch @@ -0,0 +1,25 @@ +From 66fc295c9a2e29d04fafe729a384e321a347eca3 Mon Sep 17 00:00:00 2001 +From: Kostiantyn Kostiuk +Date: Tue, 20 Jul 2021 17:19:34 +0000 +Subject: [PATCH 1/2] qga: Log version on start + +Signed-off-by: Kostiantyn Kostiuk +--- + qga/main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/qga/main.c b/qga/main.c +index dea6a3aa64..bce93dfdd0 100644 +--- a/qga/main.c ++++ b/qga/main.c +@@ -1538,6 +1538,7 @@ int main(int argc, char **argv) + goto end; + } + ++ slog("Guest agent version %s started", QEMU_VERSION); + #ifdef _WIN32 + if (config->daemonize) { + SERVICE_TABLE_ENTRY service_table[] = { +-- +2.25.1 + diff --git a/SOURCES/0001-qga-win-Detect-OS-based-on-Windows-10-by-first-build.patch b/SOURCES/0001-qga-win-Detect-OS-based-on-Windows-10-by-first-build.patch new file mode 100644 index 0000000..ad859b2 --- /dev/null +++ b/SOURCES/0001-qga-win-Detect-OS-based-on-Windows-10-by-first-build.patch @@ -0,0 +1,70 @@ +From 4eb0bed855a3f2001a3438a58933164046eefb88 Mon Sep 17 00:00:00 2001 +From: Kostiantyn Kostiuk +Date: Tue, 14 Sep 2021 10:28:44 +0000 +Subject: [PATCH 1/2] qga-win: Detect OS based on Windows 10 by first build + number + +Windows Server 2016, 2019, 2022 are based on Windows 10 and +have the same major and minor versions. So, the only way to +detect the proper version is to use the build number. + +Before this commit, the guest agent use the last build number +for each OS, but it causes problems when new OS releases. +There are few preview versions before release, and we +can't update this list. + +After this commit, the guest agent will use the first build +number. For each new preview version or release version, +Microsoft increases the build number, so we can add the number +of the first preview build and this will work until the new +OS release. + +Signed-off-by: Kostiantyn Kostiuk +--- + qga/commands-win32.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/qga/commands-win32.c b/qga/commands-win32.c +index 4e84afd83b..a8e9d40b31 100644 +--- a/qga/commands-win32.c ++++ b/qga/commands-win32.c +@@ -2179,7 +2179,7 @@ static ga_matrix_lookup_t const WIN_VERSION_MATRIX[2][8] = { + }; + + typedef struct _ga_win_10_0_server_t { +- int final_build; ++ int first_build; + char const *version; + char const *version_id; + } ga_win_10_0_server_t; +@@ -2219,18 +2219,22 @@ static char *ga_get_win_name(OSVERSIONINFOEXW const *os_version, bool id) + int tbl_idx = (os_version->wProductType != VER_NT_WORKSTATION); + ga_matrix_lookup_t const *table = WIN_VERSION_MATRIX[tbl_idx]; + ga_win_10_0_server_t const *win_10_0_table = WIN_10_0_SERVER_VERSION_MATRIX; ++ ga_win_10_0_server_t const *win_10_0_version = NULL; + while (table->version != NULL) { + if (major == 10 && minor == 0 && tbl_idx) { + while (win_10_0_table->version != NULL) { +- if (build <= win_10_0_table->final_build) { +- if (id) { +- return g_strdup(win_10_0_table->version_id); +- } else { +- return g_strdup(win_10_0_table->version); +- } ++ if (build >= win_10_0_table->first_build) { ++ win_10_0_version = win_10_0_table; + } + win_10_0_table++; + } ++ if (win_10_0_table) { ++ if (id) { ++ return g_strdup(win_10_0_version->version_id); ++ } else { ++ return g_strdup(win_10_0_version->version); ++ } ++ } + } else if (major == table->major && minor == table->minor) { + if (id) { + return g_strdup(table->version_id); +-- +2.33.0 diff --git a/SOURCES/0002-qga-get_pci_info-leak-fix.patch b/SOURCES/0002-qga-get_pci_info-leak-fix.patch new file mode 100644 index 0000000..541f87d --- /dev/null +++ b/SOURCES/0002-qga-get_pci_info-leak-fix.patch @@ -0,0 +1,75 @@ +From a956c1a2ab36a221c0a5dc7cd474ac86f4033983 Mon Sep 17 00:00:00 2001 +From: Kostiantyn Kostiuk +Date: Tue, 20 Jul 2021 17:22:18 +0000 +Subject: [PATCH 2/2] qga: get_pci_info leak fix + +Signed-off-by: Kostiantyn Kostiuk +--- + qga/commands-win32.c | 25 +++++++++++++++++++++---- + 1 file changed, 21 insertions(+), 4 deletions(-) + +diff --git a/qga/commands-win32.c b/qga/commands-win32.c +index 300b87c859..cf6d46361a 100644 +--- a/qga/commands-win32.c ++++ b/qga/commands-win32.c +@@ -514,7 +514,10 @@ DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT, + + static GuestPCIAddress *get_pci_info(int number, Error **errp) + { +- HDEVINFO dev_info; ++ HDEVINFO dev_info = INVALID_HANDLE_VALUE; ++ HDEVINFO parent_dev_info = INVALID_HANDLE_VALUE; ++ char *parent_dev_id = NULL; ++ + SP_DEVINFO_DATA dev_info_data; + SP_DEVICE_INTERFACE_DATA dev_iface_data; + HANDLE dev_file; +@@ -541,8 +544,6 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) + for (i = 0; SetupDiEnumDeviceInfo(dev_info, i, &dev_info_data); i++) { + PSP_DEVICE_INTERFACE_DETAIL_DATA pdev_iface_detail_data = NULL; + STORAGE_DEVICE_NUMBER sdn; +- char *parent_dev_id = NULL; +- HDEVINFO parent_dev_info; + SP_DEVINFO_DATA parent_dev_info_data; + DWORD j; + DWORD size = 0; +@@ -657,6 +658,7 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) + SetupDiGetClassDevs(&GUID_DEVINTERFACE_STORAGEPORT, parent_dev_id, + NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); + g_free(parent_dev_id); ++ parent_dev_id = NULL; + + if (parent_dev_info == INVALID_HANDLE_VALUE) { + error_setg_win32(errp, GetLastError(), +@@ -745,12 +747,27 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) + } + } + SetupDiDestroyDeviceInfoList(parent_dev_info); ++ parent_dev_info = INVALID_HANDLE_VALUE; + break; + } + + free_dev_info: +- SetupDiDestroyDeviceInfoList(dev_info); + out: ++ if (parent_dev_id != NULL) { ++ g_debug("get_pci_info: parent_dev_id pointer present"); ++ g_free(parent_dev_id); ++ } ++ ++ if (dev_info != INVALID_HANDLE_VALUE) { ++ g_debug("get_pci_info: dev_info handle present"); ++ SetupDiDestroyDeviceInfoList(dev_info); ++ } ++ ++ if (parent_dev_info != INVALID_HANDLE_VALUE) { ++ g_debug("get_pci_info: parent_dev_info handle present"); ++ SetupDiDestroyDeviceInfoList(parent_dev_info); ++ } ++ + return pci; + } + +-- +2.25.1 + diff --git a/SOURCES/0002-qga-win-Detect-Windows-11-by-build-number.patch b/SOURCES/0002-qga-win-Detect-Windows-11-by-build-number.patch new file mode 100644 index 0000000..9bf30bb --- /dev/null +++ b/SOURCES/0002-qga-win-Detect-Windows-11-by-build-number.patch @@ -0,0 +1,92 @@ +From e84e2d323069501ea21e780b99c99f24370fa79f Mon Sep 17 00:00:00 2001 +From: Kostiantyn Kostiuk +Date: Tue, 14 Sep 2021 10:58:13 +0000 +Subject: [PATCH 2/2] qga-win: Detect Windows 11 by build number + +Windows 10 and 11 have the same major and minor versions. +So, the only way to determine the correct version is to +use the build number. + +After this commit, the guest agent will return the proper +"version" and "version-id" for Windows 11. The "pretty-name" +is read from the registry and will be incorrect until the +MS updates the registry. We only can create some workaround +and replace 10 to 11. + +Signed-off-by: Kostiantyn Kostiuk +--- + qga/commands-win32.c | 23 ++++++++++++++--------- + 1 file changed, 14 insertions(+), 9 deletions(-) + +diff --git a/qga/commands-win32.c b/qga/commands-win32.c +index a8e9d40b31..f9ac1c31f5 100644 +--- a/qga/commands-win32.c ++++ b/qga/commands-win32.c +@@ -2154,7 +2154,7 @@ typedef struct _ga_matrix_lookup_t { + char const *version_id; + } ga_matrix_lookup_t; + +-static ga_matrix_lookup_t const WIN_VERSION_MATRIX[2][8] = { ++static ga_matrix_lookup_t const WIN_VERSION_MATRIX[2][7] = { + { + /* Desktop editions */ + { 5, 0, "Microsoft Windows 2000", "2000"}, +@@ -2163,7 +2163,6 @@ static ga_matrix_lookup_t const WIN_VERSION_MATRIX[2][8] = { + { 6, 1, "Microsoft Windows 7" "7"}, + { 6, 2, "Microsoft Windows 8", "8"}, + { 6, 3, "Microsoft Windows 8.1", "8.1"}, +- {10, 0, "Microsoft Windows 10", "10"}, + { 0, 0, 0} + },{ + /* Server editions */ +@@ -2173,24 +2172,29 @@ static ga_matrix_lookup_t const WIN_VERSION_MATRIX[2][8] = { + { 6, 2, "Microsoft Windows Server 2012", "2012"}, + { 6, 3, "Microsoft Windows Server 2012 R2", "2012r2"}, + { 0, 0, 0}, +- { 0, 0, 0}, + { 0, 0, 0} + } + }; + +-typedef struct _ga_win_10_0_server_t { ++typedef struct _ga_win_10_0_t { + int first_build; + char const *version; + char const *version_id; +-} ga_win_10_0_server_t; ++} ga_win_10_0_t; + +-static ga_win_10_0_server_t const WIN_10_0_SERVER_VERSION_MATRIX[4] = { ++static ga_win_10_0_t const WIN_10_0_SERVER_VERSION_MATRIX[4] = { + {14393, "Microsoft Windows Server 2016", "2016"}, + {17763, "Microsoft Windows Server 2019", "2019"}, + {20344, "Microsoft Windows Server 2022", "2022"}, + {0, 0} + }; + ++static ga_win_10_0_t const WIN_10_0_CLIENT_VERSION_MATRIX[3] = { ++ {10240, "Microsoft Windows 10", "10"}, ++ {22000, "Microsoft Windows 11", "11"}, ++ {0, 0} ++}; ++ + static void ga_get_win_version(RTL_OSVERSIONINFOEXW *info, Error **errp) + { + typedef NTSTATUS(WINAPI *rtl_get_version_t)( +@@ -2218,10 +2222,11 @@ static char *ga_get_win_name(OSVERSIONINFOEXW const *os_version, bool id) + DWORD build = os_version->dwBuildNumber; + int tbl_idx = (os_version->wProductType != VER_NT_WORKSTATION); + ga_matrix_lookup_t const *table = WIN_VERSION_MATRIX[tbl_idx]; +- ga_win_10_0_server_t const *win_10_0_table = WIN_10_0_SERVER_VERSION_MATRIX; +- ga_win_10_0_server_t const *win_10_0_version = NULL; ++ ga_win_10_0_t const *win_10_0_table = tbl_idx ? ++ WIN_10_0_SERVER_VERSION_MATRIX : WIN_10_0_CLIENT_VERSION_MATRIX; ++ ga_win_10_0_t const *win_10_0_version = NULL; + while (table->version != NULL) { +- if (major == 10 && minor == 0 && tbl_idx) { ++ if (major == 10 && minor == 0) { + while (win_10_0_table->version != NULL) { + if (build >= win_10_0_table->first_build) { + win_10_0_version = win_10_0_table; +-- +2.25.1 diff --git a/SOURCES/build_configure.sh b/SOURCES/build_configure.sh new file mode 100755 index 0000000..45dc0aa --- /dev/null +++ b/SOURCES/build_configure.sh @@ -0,0 +1,5 @@ +QEMU_GA_MANUFACTURER="RedHat" QEMU_GA_DISTRO="RHEL" QEMU_GA_VERSION="103.0.0" ./configure \ + --disable-docs \ + --enable-guest-agent \ + --disable-zlib-test \ + "$@" diff --git a/SPECS/mingw-qemu-ga-win.spec b/SPECS/mingw-qemu-ga-win.spec new file mode 100644 index 0000000..d7fbb31 --- /dev/null +++ b/SPECS/mingw-qemu-ga-win.spec @@ -0,0 +1,227 @@ +%{?mingw_package_header} + +%define with_vss 1 +%define qemu_version 6.2.0 + +Name: mingw-qemu-ga-win +Version: 103.0.0 +Release: 1%{?dist} +Summary: Qemus Guest agent for Windows + +Group: System Environment/Daemons +License: GPLv2+ and LGPLv2+ and BSD +URL: http://www.qemu.org/ +Requires(post): system-units +Requires(preun): systemd-units +Requires(postun): systemd-units +Source0: http://wiki.qemu.org/download/qemu-%{qemu_version}.tar.bz2 +Source1: build_configure.sh +%if %{with_vss} +Source2: VSSSDK72.tar.gz +%endif + +Patch0001: 0001-Change-Version.patch +Patch0002: 0001-qga-Log-version-on-start.patch +Patch0003: 0002-qga-get_pci_info-leak-fix.patch +Patch0004: 0001-qga-win-Detect-OS-based-on-Windows-10-by-first-build.patch +Patch0005: 0002-qga-win-Detect-Windows-11-by-build-number.patch +Patch0006: 0001-Remove-redundant-GUID-definitions.patch +Patch0007: 0001-meson-do-not-make-qga-vss-win32-meson.build-conditio.patch + + +BuildArch: noarch + +BuildRequires: libtool +BuildRequires: zlib-devel +BuildRequires: glib2-devel +BuildRequires: python3-devel +BuildRequires: gettext +BuildRequires: gettext-devel +BuildRequires: mingw32-pixman +BuildRequires: mingw64-pixman +BuildRequires: mingw32-gcc >= 7.4.0 +BuildRequires: mingw64-gcc >= 7.4.0 +BuildRequires: mingw32-glib2 +BuildRequires: mingw64-glib2 +BuildRequires: mingw64-headers +BuildRequires: mingw32-headers +BuildRequires: msitools >= 0.93.93 +BuildRequires: meson +BuildRequires: ninja-build + +%description +qemu-kvm is an open source virtualizer that provides hardware emulation for +the KVM hypervisor. + +This package provides an agent to run inside guests, which communicates +with the host over a virtio-serial channel named "org.qemu.guest_agent.0" + +This package does not need to be installed on the host OS. + +%package -n qemu-ga-win +Summary: %{summary} + +%description -n qemu-ga-win +Qemu Guest Agent for Windows + +%prep +%setup -q -n qemu-%{qemu_version} +%patch0001 -p1 +%patch0002 -p1 +%patch0003 -p1 +%patch0004 -p1 +%patch0005 -p1 +%patch0006 -p1 +%patch0007 -p1 + +%build + +cp %{SOURCE1} build_configure.sh +%if %{with_vss} + pwd + tar -zxvf %{SOURCE2} + ls VSSSDK72 +%endif +#Build for Win32 + +%{mingw32_env} +./build_configure.sh \ + --target-list=x86_64-softmmu \ + --cross-prefix=i686-w64-mingw32- \ + --enable-guest-agent-msi \ +%if %{with_vss} + --with-vss-sdk=%{_builddir}/qemu-%{qemu_version}/VSSSDK72 \ +%endif + || cat %{_builddir}/qemu-%{qemu_version}/build/config.log + +make qemu-ga + +mkdir ../build_win32 +#cp build/qga/qemu-ga.exe ../build_win32 +cp build/qga/qemu-ga-i386.msi ../build_win32 + +#Build for Win64 + +%{mingw64_env} +./build_configure.sh \ + --target-list=x86_64-softmmu \ + --cross-prefix=x86_64-w64-mingw32- \ + --enable-guest-agent-msi \ +%if %{with_vss} + --with-vss-sdk=%{_builddir}/qemu-%{qemu_version}/VSSSDK72 \ +%endif + || cat %{_builddir}/qemu-%{qemu_version}/build/config.log + +make qemu-ga + +mkdir ../build_win64 +#cp build/qga/qemu-ga.exe ../build_win64 +cp build/qga/qemu-ga-x86_64.msi ../build_win64 + +rm -rf $RPM_BUILD_ROOT + +mkdir -p $RPM_BUILD_ROOT%{mingw32_bindir} +cp "../build_win32$MINGW_BUILDDIR_SUFFIX"/qemu-ga* $RPM_BUILD_ROOT%{mingw32_bindir} + +mkdir -p $RPM_BUILD_ROOT%{mingw64_bindir} +cp "../build_win64$MINGW_BUILDDIR_SUFFIX"/qemu-ga* $RPM_BUILD_ROOT%{mingw64_bindir} + +%files -n qemu-ga-win +%defattr(-,root,root) +%{mingw32_bindir}/qemu-ga* +%{mingw64_bindir}/qemu-ga* + +%changelog +* Mon Jan 24 2022 Konstantin Kostiuk 103.0.0 +- Set version to 103.0.0 +- BZ#1992643 - Add mingw-qemu-ga-win package to CentOS stream +- Rebase to qemu-6.2.0 + +* Mon Dec 27 2021 Yan Vugenfirer 102.10.0 +- Set version to 102.10.0 +- BZ#2026167 - Add Windows11 version support for mingw-qemu-ga +- Dynamically link mingw-glib2 library + +* Thu Dec 23 2021 Yan Vugenfirer 102.9.0 +- Set version to 102.9.0 +- BZ#2026167 - Add Windows11 version support for mingw-qemu-ga +- Use mingw-glib2-2.70.1 + +* Thu Nov 25 2021 Yan Vugenfirer 102.8.8 +- Set version to 102.8.0 +- BZ#2026167 - Add Windows11 version support for mingw-qemu-ga + +* Wed Jul 21 2021 Yan Vugenfirer 102.7.0 +- Set version to 102.7.0 +- BZ#1958825 - Memory leak in qemu-ga for Windows + +* Tue Jul 13 2021 Yan Vugenfirer 102.6.0 +- Set version to 102.6.0 +- BZ#1978859 - The qemu-ga-win build version in MSI is different between checking inside guest and qga command +- BZ#1981302 - QGA version can't be upgrade directly without uninstalling old version + +* Tue Jun 22 2021 Yan Vugenfirer 102.5.0 +- Set version to 102.5.0 +- Bug 1972070 - RFE: Add Windows Server 2022 version support for mingw-qemu-ga + +* Wed Jun 16 2021 Yan Vugenfirer 102.2.0 +- Set version to 102.2.0 +- Bug 1958825 - fix memory leak in qemu-ga for Windows + +* Mon Jun 7 2021 Yan Vugenfirer 102.1.0 +- Set version to 102.1.0 +- BZ#1957377 - ownstream qemu-ga should report the build number and not QEMU version + +* Wed Feb 24 2021 Basil Salman 102.0.0 +- rebase to qemu-5.2.0 +- Set version to 102.0.0 +- BZ#1915198 - Rebase mingw-qemu-ga-win to qemu 5.2 +- BZ#1929144 - fix qemu-ga-win resource leaks +- BZ#1920874 - Some changes of qga command "get-devices" should be fix on mingw-qemu-ga-win to qemu 5.2 +- BZ#1919535 - Can not get the disks of windows guest via guest agent +- BZ#1909073 - Filesystem freeze on Windows reports errors frequently + +* Mon Aug 3 2020 Basil Salman 101.2.0 +BZ#1746667 - [qemu-guest-agent]System reserve volume's file system via guest agent is different from it's in guest +BZ#1549425 - Getting response from guest-fsfreeze-thaw need about 90s sometimes + +* Thu Mar 5 2020 Basil Salman 101.1.0 +BZ#1790455 - Add guest-get-devices command to qemu-ga-win + +* Thu Oct 24 2019 Basil Salman 101.0.0 +BZ#1733165 - QEMU Guest Agent For Windows Return Garbled NIC Name +BZ#1751431 - "guest-get-memory-block-info" is enabled but in fact it is not currently supported + +* Tue Jan 22 2019 Yan Vugenfirer 100.0.0 +BZ#1651655 - Rebase mingw-qemu-ga-win to qemu 3.1. Change the versioning scheme to independent scheme for qemu-ga-win + +* Mon Dec 24 2018 Sameeh Jubran 8.0.0 +BZ#1645018 - CVE-2018-12617 virtio-win: Qemu: qemu-guest-agent: Integer overflow causes segmentation fault in qmp_guest_file_read() + +* Sun Dec 23 2018 Sameeh Jubran 8.0.0 +BZ#1659071 [RFE]Add "windows 2019 x64" support to OS reporting + +* Thu Nov 08 2018 Sameeh Jubran 8.0.0 +#rebase mingw-qemu-ga-win to qemu 3.1.0 + +* Sun Jun 24 2018 Sameeh Jubran 7.6.0 +BZ#1565431 - "Disk" is [] in the result of guest-get-fsinfo cmd which is odd +BZ#1594113 - Error returned after issue {"execute":"guest-fstrim" } cmd for win7-32/64 and win2008-32/64/r2 guest +BZ#1536331 - Failed to upgrade qemu-ga without virtio-serial driver installed + +* Wed Jan 24 2018 Sameeh Jubran 7.5.0 +BZ#1536954 - Issuing guest-fsfreeze-freeze cmd for the first time on a new qemu-ga,can not get response. + +* Wed Dec 13 2017 Sameeh Jubran 2.9.5 +- Add resolved BZs to changelog +BZ#1514303 - QEMU Guest Agent VSS Provider service is being installed with startup type: Automatic +BZ#990629 - [Windows Guest Tools] QEMU Guest Agent service failed | After post-installation reboot another reboot is needed +BZ#1514382 - [guest-agent]Still can write to freezed file system after run "{ "execute": "guest-fsfreeze-freeze"}" cmd. +BZ#1071499 - qemu guest agent for Windows should support guest-set-time command +BZ#1082999 - [WGT] Win 2008 32bit: Detected circular dependencies demand starting RHEV Spice Agent. +BZ#1470649 - [virtio-win[qemu-ga-win][upstream]]Unable to install qemu-ga on Windows platform : QEMU guest agent -- Error 1722 +BZ#1514347 - [qemu-ga-win] QEMU guest agent's version is not correct. +BZ#1515137 - Error window pops up during installing windows qemu-ga-win.msi manually + +* Sun Jun 04 2017 Sameeh Jubran - 2.9.0 +- First release