diff --git a/0001-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch b/0001-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch index e59d4e9..7fc40da 100644 --- a/0001-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch +++ b/0001-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch @@ -1,4 +1,4 @@ -From dd696d00b4de2d255d66565b7207e04070656585 Mon Sep 17 00:00:00 2001 +From 2823717ec8b87fd32559c78c4bcf467ba7227cb5 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 7 Jul 2015 09:28:03 -0400 Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for @@ -11,7 +11,7 @@ edits. 1 file changed, 1 insertion(+) diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh -index 16debd129..1c13ddac3 100755 +index 0ec6b4851..9fa29f98b 100755 --- a/test-data/phony-guests/make-windows-img.sh +++ b/test-data/phony-guests/make-windows-img.sh @@ -37,6 +37,7 @@ fi diff --git a/0002-RHEL-builder-Disable-opensuse-repository.patch b/0002-RHEL-builder-Disable-opensuse-repository.patch index d2b1a45..27feb49 100644 --- a/0002-RHEL-builder-Disable-opensuse-repository.patch +++ b/0002-RHEL-builder-Disable-opensuse-repository.patch @@ -1,4 +1,4 @@ -From c1261a19aa4cd137f2d2c34c3640d971bb62bcb4 Mon Sep 17 00:00:00 2001 +From feb0d416355753832f3af160d31092e0e7f37e67 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 21 Nov 2022 13:03:22 +0000 Subject: [PATCH] RHEL: builder: Disable opensuse repository diff --git a/0003-customize-Implement-inject-blnsvr-operation.patch b/0003-customize-Implement-inject-blnsvr-operation.patch deleted file mode 100644 index 2c4bb5d..0000000 --- a/0003-customize-Implement-inject-blnsvr-operation.patch +++ /dev/null @@ -1,254 +0,0 @@ -From d3153501860dd9327cdd9c9f5ead0883918b0643 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 16 May 2024 12:49:24 +0100 -Subject: [PATCH] customize: Implement --inject-blnsvr operation - -Also updates the common submodule with the generated changes from -libguestfs, and the implementation of Inject_virtio_win.inject_blnsvr. - -(cherry picked from commit 80d258baa49214c8e59b91d6085595c9b989fc0d) ---- - common | 2 +- - customize/customize_run.ml | 13 +++++++++++-- - 2 files changed, 12 insertions(+), 3 deletions(-) - -Submodule common 7cbb3ba35...a78839676: -diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod -index ff93630d8..b2ac57526 100644 ---- a/common/mlcustomize/customize-options.pod -+++ b/common/mlcustomize/customize-options.pod -@@ -193,6 +193,18 @@ L. - Set the hostname of the guest to C. You can use a - dotted hostname.domainname (FQDN) if you want. - -+=item B<--inject-blnsvr> METHOD -+ -+Inject the Balloon Server (F) into a Windows guest. -+This operation also injects a firstboot script so that the Balloon -+Server is installed when the guest boots. -+ -+The parameter is the same as used by the I<--inject-virtio-win> operation. -+ -+Note that to do a full conversion of a Windows guest from a -+foreign hypervisor like VMware (which involves many other operations) -+you should use the L tool instead of this. -+ - =item B<--inject-qemu-ga> METHOD - - Inject the QEMU Guest Agent into a Windows guest. The guest -diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod -index bb0ce1255..957de8cf2 100644 ---- a/common/mlcustomize/customize-synopsis.pod -+++ b/common/mlcustomize/customize-synopsis.pod -@@ -3,16 +3,16 @@ - [--copy SOURCE:DEST] [--copy-in LOCALPATH:REMOTEDIR] - [--delete PATH] [--edit FILE:EXPR] [--firstboot SCRIPT] - [--firstboot-command 'CMD+ARGS'] [--firstboot-install PKG,PKG..] -- [--hostname HOSTNAME] [--inject-qemu-ga METHOD] -- [--inject-virtio-win METHOD] [--install PKG,PKG..] -- [--link TARGET:LINK[:LINK..]] [--mkdir DIR] [--move SOURCE:DEST] -- [--password USER:SELECTOR] [--root-password SELECTOR] -- [--run SCRIPT] [--run-command 'CMD+ARGS'] [--scrub FILE] -- [--sm-attach SELECTOR] [--sm-register] [--sm-remove] -- [--sm-unregister] [--ssh-inject USER[:SELECTOR]] -- [--tar-in TARFILE:REMOTEDIR] [--timezone TIMEZONE] [--touch FILE] -- [--truncate FILE] [--truncate-recursive PATH] -- [--uninstall PKG,PKG..] [--update] [--upload FILE:DEST] -- [--write FILE:CONTENT] [--no-logfile] -+ [--hostname HOSTNAME] [--inject-blnsvr METHOD] -+ [--inject-qemu-ga METHOD] [--inject-virtio-win METHOD] -+ [--install PKG,PKG..] [--link TARGET:LINK[:LINK..]] [--mkdir DIR] -+ [--move SOURCE:DEST] [--password USER:SELECTOR] -+ [--root-password SELECTOR] [--run SCRIPT] -+ [--run-command 'CMD+ARGS'] [--scrub FILE] [--sm-attach SELECTOR] -+ [--sm-register] [--sm-remove] [--sm-unregister] -+ [--ssh-inject USER[:SELECTOR]] [--tar-in TARFILE:REMOTEDIR] -+ [--timezone TIMEZONE] [--touch FILE] [--truncate FILE] -+ [--truncate-recursive PATH] [--uninstall PKG,PKG..] [--update] -+ [--upload FILE:DEST] [--write FILE:CONTENT] [--no-logfile] - [--password-crypto md5|sha256|sha512] [--no-selinux-relabel] - [--selinux-relabel] [--sm-credentials SELECTOR] -diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml -index 48ee33445..c4d6a77d5 100644 ---- a/common/mlcustomize/customize_cmdline.ml -+++ b/common/mlcustomize/customize_cmdline.ml -@@ -61,6 +61,8 @@ and op = [ - (* --firstboot-install PKG,PKG.. *) - | `Hostname of string - (* --hostname HOSTNAME *) -+ | `InjectBalloonServer of string -+ (* --inject-blnsvr METHOD *) - | `InjectQemuGA of string - (* --inject-qemu-ga METHOD *) - | `InjectVirtioWin of string -@@ -286,6 +288,12 @@ let rec argspec () = - s_"Set the hostname" - ), - Some "HOSTNAME", "Set the hostname of the guest to C. You can use a\ndotted hostname.domainname (FQDN) if you want."; -+ ( -+ [ L"inject-blnsvr" ], -+ Getopt.String (s_"METHOD", fun s -> List.push_front (`InjectBalloonServer s) ops), -+ s_"Inject the Balloon Server into a Windows guest" -+ ), -+ Some "METHOD", "Inject the Balloon Server (F) into a Windows guest.\nThis operation also injects a firstboot script so that the Balloon\nServer is installed when the guest boots.\n\nThe parameter is the same as used by the I<--inject-virtio-win> operation.\n\nNote that to do a full conversion of a Windows guest from a\nforeign hypervisor like VMware (which involves many other operations)\nyou should use the L tool instead of this."; - ( - [ L"inject-qemu-ga" ], - Getopt.String (s_"METHOD", fun s -> List.push_front (`InjectQemuGA s) ops), -diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli -index 51a156eae..ee62961a1 100644 ---- a/common/mlcustomize/customize_cmdline.mli -+++ b/common/mlcustomize/customize_cmdline.mli -@@ -53,6 +53,8 @@ and op = [ - (* --firstboot-install PKG,PKG.. *) - | `Hostname of string - (* --hostname HOSTNAME *) -+ | `InjectBalloonServer of string -+ (* --inject-blnsvr METHOD *) - | `InjectQemuGA of string - (* --inject-qemu-ga METHOD *) - | `InjectVirtioWin of string -diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml -index 0a4b8dac0..afec1e456 100644 ---- a/common/mlcustomize/inject_virtio_win.ml -+++ b/common/mlcustomize/inject_virtio_win.ml -@@ -24,6 +24,8 @@ open Common_gettext.Gettext - - open Regedit - -+let re_blnsvr = PCRE.compile ~caseless:true "\\bblnsvr\\.exe$" -+ - type t = { - g : Guestfs.guestfs; (** guestfs handle *) - -@@ -274,6 +276,25 @@ and inject_qemu_ga ({ g; root } as t) = - configure_qemu_ga t tempdir_win msi_files; - msi_files <> [] (* return true if we found some qemu-ga MSI files *) - -+and inject_blnsvr ({ g; root } as t) = -+ (* Copy the files to the guest. *) -+ let dir, dir_win = Firstboot.firstboot_dir g root in -+ let dir_win = Option.value dir_win ~default:dir in -+ let tempdir = sprintf "%s/Temp" dir in -+ let tempdir_win = sprintf "%s\\Temp" dir_win in -+ g#mkdir_p tempdir; -+ -+ let files = copy_blnsvr t tempdir in -+ match files with -+ | [] -> false (* Didn't find or install anything. *) -+ -+ (* We usually find blnsvr.exe in two locations (drivers/by-os and -+ * drivers/by-driver). Pick the first. -+ *) -+ | blnsvr :: _ -> -+ configure_blnsvr t tempdir_win blnsvr; -+ true -+ - and add_guestor_to_registry t ((g, root) as reg) drv_name drv_pciid = - let ddb_node = g#hivex_node_get_child root "DriverDatabase" in - -@@ -358,6 +379,11 @@ and copy_qemu_ga t tempdir = - (fun () -> - error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) - -+and copy_blnsvr t tempdir = -+ copy_from_virtio_win t "/" tempdir (virtio_iso_path_matches_blnsvr t) -+ (fun () -> -+ error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) -+ - (* Copy all files from virtio_win directory/ISO located in [srcdir] - * subdirectory and all its subdirectories to the [destdir]. The directory - * hierarchy is not preserved, meaning all files will be directly in [destdir]. -@@ -452,10 +478,7 @@ and virtio_iso_path_matches_guest_os t path = - * "./drivers/amd64/Win2012R2/netkvm.sys". - * Note we check lowercase paths. - *) -- let pathelem elem = -- String.find lc_path ("/" ^ elem ^ "/") >= 0 || -- String.is_prefix lc_path (elem ^ "/") -- in -+ let pathelem elem = String.find lc_path ("/" ^ elem ^ "/") >= 0 in - let p_arch = - if pathelem "x86" || pathelem "i386" then "i386" - else if pathelem "amd64" then "x86_64" -@@ -499,11 +522,7 @@ and virtio_iso_path_matches_guest_os t path = - else - raise Not_found in - -- let p_sriov = pathelem "sriov" in -- -- arch = p_arch && -- not p_sriov && (* always ignored, see RHEL-56383 *) -- os_major = p_os_major && os_minor = p_os_minor && -+ arch = p_arch && os_major = p_os_major && os_minor = p_os_minor && - match_os_variant os_variant && - match_osinfo osinfo - -@@ -527,6 +546,10 @@ and virtio_iso_path_matches_qemu_ga t path = - | ("x86_64", "rhev-qga64.msi") -> true - | _ -> false - -+(* Find blnsvr for the current Windows version. *) -+and virtio_iso_path_matches_blnsvr t path = -+ virtio_iso_path_matches_guest_os t path && PCRE.matches re_blnsvr path -+ - (* Look up in libosinfo for the OS, and copy all the locally - * available files specified as drivers for that OS to the [destdir]. - * -@@ -591,3 +614,10 @@ and configure_qemu_ga t tempdir_win files = - ) files; - - Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga" !script -+ -+and configure_blnsvr t tempdir_win blnsvr = -+ let cmd = sprintf "\ -+ @echo off\n\ -+ echo Installing %s\n\ -+ \"%s\\%s\" -i\n" blnsvr tempdir_win blnsvr in -+ Firstboot.add_firstboot_script t.g t.root "install-blnsvr" cmd -diff --git a/common/mlcustomize/inject_virtio_win.mli b/common/mlcustomize/inject_virtio_win.mli -index d14f04973..d273c4dd3 100644 ---- a/common/mlcustomize/inject_virtio_win.mli -+++ b/common/mlcustomize/inject_virtio_win.mli -@@ -93,3 +93,11 @@ val inject_qemu_ga : t -> bool - the MSI(s). - - Returns [true] iff we were able to inject qemu-ga. *) -+ -+val inject_blnsvr : t -> bool -+(** Inject the Balloon Server ([blnsvr.exe]) into a Windows guest. -+ -+ A firstboot script is also injected which should install -+ the server by running [blnsvr -i]. -+ -+ Returns [true] iff we were able to inject the Balloon Server. *) -diff --git a/customize/customize_run.ml b/customize/customize_run.ml -index 1314d6e30..1d7c13eaf 100644 ---- a/customize/customize_run.ml -+++ b/customize/customize_run.ml -@@ -113,8 +113,8 @@ let run (g : G.guestfs) root (ops : ops) = - Hashtbl.replace passwords user pw - in - -- (* Helper function to convert --inject-qemu-ga/--inject-virtio-win -- * method parameter into a virtio-win handle. -+ (* Helper function to convert --inject-blnsvr/--inject-qemu-ga/ -+ * --inject-virtio-win method parameter into a virtio-win handle. - *) - let get_virtio_win_handle op meth = - if g#inspect_get_type root <> "windows" then ( -@@ -216,6 +216,15 @@ let run (g : G.guestfs) root (ops : ops) = - if not (Hostname.set_hostname g root hostname) then - warning (f_"hostname could not be set for this type of guest") - -+ | `InjectBalloonServer meth -> -+ (match get_virtio_win_handle "--inject-blnsvr" meth with -+ | None -> () -+ | Some t -> -+ if not (Inject_virtio_win.inject_blnsvr t) then -+ warning (f_"--inject-blnsvr: blnsvr.exe not found in \ -+ virtio-win source that you specified") -+ ) -+ - | `InjectQemuGA meth -> - (match get_virtio_win_handle "--inject-qemu-ga" meth with - | None -> () diff --git a/0004-build-Add-new-dependency-on-json-c.patch b/0004-build-Add-new-dependency-on-json-c.patch deleted file mode 100644 index cd3df0a..0000000 --- a/0004-build-Add-new-dependency-on-json-c.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 63c5e9f6ce92f789d6b08a70d2f2abdaf9dc3b0c Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 22 Oct 2024 11:01:25 +0100 -Subject: [PATCH] build: Add new dependency on json-c - -This will eventually replace Jansson for all JSON parsing. However -this commit simply introduces the new dependency in the configure -script and documents it. - -I chose json-c 0.14 as the baseline since that is the version in RHEL 9. -Probably earlier versions would work. - -(cherry picked from libguestfs commit 53872a0a1a267040677572c30b68bd1e8b62ebe3) - -(cherry picked from commit 0d7fe8a0b0b429152ea02fc7a7e4f5a1b0eba590) ---- - m4/guestfs-libraries.m4 | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4 -index 32f93afda..b76511982 100644 ---- a/m4/guestfs-libraries.m4 -+++ b/m4/guestfs-libraries.m4 -@@ -167,6 +167,9 @@ LIBS="$old_LIBS" - dnl Check for Jansson JSON library (required). - PKG_CHECK_MODULES([JANSSON], [jansson >= 2.7]) - -+dnl Check for JSON-C library (required). -+PKG_CHECK_MODULES([JSON_C], [json-c >= 0.14]) -+ - dnl Check for libosinfo (mandatory) - PKG_CHECK_MODULES([LIBOSINFO], [libosinfo-1.0]) - diff --git a/0005-builder-Replace-jansson-with-json-c.patch b/0005-builder-Replace-jansson-with-json-c.patch deleted file mode 100644 index 5632d7e..0000000 --- a/0005-builder-Replace-jansson-with-json-c.patch +++ /dev/null @@ -1,267 +0,0 @@ -From 2c090e270c1acea49949914c8995c94932e70e12 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 22 Oct 2024 11:07:01 +0100 -Subject: [PATCH] builder: Replace jansson with json-c - -This pulls in the following common module commit which ports the -JSON_parser module from jansson to json-c: - - Richard W.M. Jones (1): - mltools: Replace jansson with json-c - -(cherry picked from commit 12997768d231b80dc219a518c287ecf10c83ff0e) ---- - builder/Makefile.am | 2 +- - common | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/builder/Makefile.am b/builder/Makefile.am -index b474f0c9d..0761eff4c 100644 ---- a/builder/Makefile.am -+++ b/builder/Makefile.am -@@ -206,7 +206,7 @@ OCAMLCLIBS = \ - $(LIBLZMA_LIBS) \ - $(LIBXML2_LIBS) \ - $(LIBOSINFO_LIBS) \ -- $(JANSSON_LIBS) \ -+ $(JSON_C_LIBS) \ - $(LIBINTL) \ - -lgnu - -Submodule common a78839676..766384a45: -diff --git a/common/mltools/JSON_parser-c.c b/common/mltools/JSON_parser-c.c -index bf38dd1bf..fb67b4632 100644 ---- a/common/mltools/JSON_parser-c.c -+++ b/common/mltools/JSON_parser-c.c -@@ -23,7 +23,7 @@ - #include - #include - --#include -+#include - - #include - #include -@@ -40,7 +40,7 @@ value virt_builder_json_parser_tree_parse (value stringv); - value virt_builder_json_parser_tree_parse_file (value stringv); - - static value --convert_json_t (json_t *val, int level) -+convert_json_t (json_object *val, int level) - { - CAMLparam0 (); - CAMLlocal5 (rv, v, tv, sv, consv); -@@ -48,9 +48,11 @@ convert_json_t (json_t *val, int level) - if (level > 20) - caml_invalid_argument ("too many levels of object/array nesting"); - -- if (json_is_object (val)) { -+ switch (json_object_get_type (val)) { -+ case json_type_object: { -+ struct json_object_iterator it, itend; - const char *key; -- json_t *jvalue; -+ json_object *jvalue; - - rv = caml_alloc (1, JSON_DICT_TAG); - v = Val_int (0); -@@ -60,29 +62,39 @@ convert_json_t (json_t *val, int level) - * matter (eg. simplestreams which incorrectly uses a dict when it - * really should use an array). - */ -- json_object_foreach (val, key, jvalue) { -+ it = json_object_iter_begin (val); -+ itend = json_object_iter_end (val); -+ while (!json_object_iter_equal (&it, &itend)) { -+ key = json_object_iter_peek_name (&it); - tv = caml_alloc_tuple (2); - sv = caml_copy_string (key); - Store_field (tv, 0, sv); -+ -+ jvalue = json_object_iter_peek_value (&it); - sv = convert_json_t (jvalue, level + 1); - Store_field (tv, 1, sv); -+ - consv = caml_alloc (2, 0); - Store_field (consv, 1, v); - Store_field (consv, 0, tv); - v = consv; -+ -+ json_object_iter_next (&it); - } - Store_field (rv, 0, v); -+ break; - } -- else if (json_is_array (val)) { -- const size_t len = json_array_size (val); -+ -+ case json_type_array: { -+ const size_t len = json_object_array_length (val); - size_t i; -- json_t *jvalue; -+ json_object *jvalue; - - rv = caml_alloc (1, JSON_LIST_TAG); - v = Val_int (0); - for (i = 0; i < len; ++i) { - /* Note we have to create the OCaml list backwards. */ -- jvalue = json_array_get (val, len-i-1); -+ jvalue = json_object_array_get_idx (val, len-i-1); - tv = convert_json_t (jvalue, level + 1); - consv = caml_alloc (2, 0); - Store_field (consv, 1, v); -@@ -90,32 +102,36 @@ convert_json_t (json_t *val, int level) - v = consv; - } - Store_field (rv, 0, v); -+ break; - } -- else if (json_is_string (val)) { -+ -+ case json_type_string: - rv = caml_alloc (1, JSON_STRING_TAG); -- v = caml_copy_string (json_string_value (val)); -+ v = caml_copy_string (json_object_get_string (val)); - Store_field (rv, 0, v); -- } -- else if (json_is_real (val)) { -+ break; -+ -+ case json_type_double: - rv = caml_alloc (1, JSON_FLOAT_TAG); -- v = caml_copy_double (json_real_value (val)); -+ v = caml_copy_double (json_object_get_double (val)); - Store_field (rv, 0, v); -- } -- else if (json_is_integer (val)) { -+ break; -+ -+ case json_type_int: - rv = caml_alloc (1, JSON_INT_TAG); -- v = caml_copy_int64 (json_integer_value (val)); -+ v = caml_copy_int64 (json_object_get_int64 (val)); - Store_field (rv, 0, v); -- } -- else if (json_is_true (val)) { -+ break; -+ -+ case json_type_boolean: - rv = caml_alloc (1, JSON_BOOL_TAG); -- Store_field (rv, 0, Val_true); -- } -- else if (json_is_false (val)) { -- rv = caml_alloc (1, JSON_BOOL_TAG); -- Store_field (rv, 0, Val_false); -- } -- else -+ Store_field (rv, 0, json_object_get_boolean (val) ? Val_true : Val_false); -+ break; -+ -+ case json_type_null: - rv = JSON_NULL; -+ break; -+ } - - CAMLreturn (rv); - } -@@ -125,45 +141,28 @@ virt_builder_json_parser_tree_parse (value stringv) - { - CAMLparam1 (stringv); - CAMLlocal1 (rv); -- json_t *tree; -- json_error_t err; -+ json_object *tree = NULL; -+ json_tokener *tok = NULL; -+ enum json_tokener_error err; - -- tree = json_loads (String_val (stringv), JSON_DECODE_ANY, &err); -- if (tree == NULL) { -- char buf[256 + JSON_ERROR_TEXT_LENGTH]; -- if (strlen (err.text) > 0) -- snprintf (buf, sizeof buf, "JSON parse error: %s", err.text); -- else -- snprintf (buf, sizeof buf, "unknown JSON parse error"); -+ tok = json_tokener_new (); -+ json_tokener_set_flags (tok, -+ JSON_TOKENER_STRICT | JSON_TOKENER_VALIDATE_UTF8); -+ tree = json_tokener_parse_ex (tok, -+ String_val (stringv), -+ caml_string_length (stringv)); -+ err = json_tokener_get_error (tok); -+ if (err != json_tokener_success) { -+ char buf[256]; -+ snprintf (buf, sizeof buf, "JSON parse error: %s", -+ json_tokener_error_desc (err)); -+ json_tokener_free (tok); - caml_invalid_argument (buf); - } -+ json_tokener_free (tok); - - rv = convert_json_t (tree, 1); -- json_decref (tree); -- -- CAMLreturn (rv); --} -- --value --virt_builder_json_parser_tree_parse_file (value filev) --{ -- CAMLparam1 (filev); -- CAMLlocal1 (rv); -- json_t *tree; -- json_error_t err; -- -- tree = json_load_file (String_val (filev), JSON_DECODE_ANY, &err); -- if (tree == NULL) { -- char buf[1024 + JSON_ERROR_TEXT_LENGTH]; -- if (strlen (err.text) > 0) -- snprintf (buf, sizeof buf, "%s: JSON parse error: %s", String_val (filev), err.text); -- else -- snprintf (buf, sizeof buf, "%s: unknown JSON parse error", String_val (filev)); -- caml_invalid_argument (buf); -- } -- -- rv = convert_json_t (tree, 1); -- json_decref (tree); -+ json_object_put (tree); - - CAMLreturn (rv); - } -diff --git a/common/mltools/JSON_parser.ml b/common/mltools/JSON_parser.ml -index 933057277..8bc35abdc 100644 ---- a/common/mltools/JSON_parser.ml -+++ b/common/mltools/JSON_parser.ml -@@ -21,7 +21,10 @@ open Tools_utils - open Common_gettext.Gettext - - external json_parser_tree_parse : string -> JSON.json_t = "virt_builder_json_parser_tree_parse" --external json_parser_tree_parse_file : string -> JSON.json_t = "virt_builder_json_parser_tree_parse_file" -+ -+let json_parser_tree_parse_file filename = -+ let content = read_whole_file filename in -+ json_parser_tree_parse content - - let object_find_optional key = function - | JSON.Dict fields -> -diff --git a/common/mltools/Makefile.am b/common/mltools/Makefile.am -index f510a6747..684c26946 100644 ---- a/common/mltools/Makefile.am -+++ b/common/mltools/Makefile.am -@@ -116,7 +116,7 @@ libmltools_a_CFLAGS = \ - $(LIBVIRT_CFLAGS) \ - $(LIBXML2_CFLAGS) \ - $(LIBGUESTFS_CFLAGS) \ -- $(JANSSON_CFLAGS) \ -+ $(JSON_C_CFLAGS) \ - $(LIBOSINFO_CFLAGS) \ - -fPIC - -@@ -148,7 +148,7 @@ OCAMLCLIBS = \ - $(LIBCRYPT_LIBS) \ - $(LIBVIRT_LIBS) \ - $(LIBXML2_LIBS) \ -- $(JANSSON_LIBS) \ -+ $(JSON_C_LIBS) \ - $(LIBOSINFO_LIBS) \ - $(LIBINTL) \ - -lgnu diff --git a/0006-build-Remove-Jansson-dependency.patch b/0006-build-Remove-Jansson-dependency.patch deleted file mode 100644 index 5b2ee0d..0000000 --- a/0006-build-Remove-Jansson-dependency.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 2df96c458b98e9eb994970a8040972a1e22636dd Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 22 Oct 2024 15:22:18 +0100 -Subject: [PATCH] build: Remove Jansson dependency - -After previous changes, this library is no longer used. We have -switched to json-c, for better compatibility with libvirt. - -(cherry picked from commit e6dcf7e3a7e9170978e57ce6df1b34f92fac5ae3) ---- - m4/guestfs-libraries.m4 | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4 -index b76511982..80f9425f0 100644 ---- a/m4/guestfs-libraries.m4 -+++ b/m4/guestfs-libraries.m4 -@@ -164,9 +164,6 @@ LIBS="$LIBS $LIBXML2_LIBS" - AC_CHECK_FUNCS([xmlBufferDetach]) - LIBS="$old_LIBS" - --dnl Check for Jansson JSON library (required). --PKG_CHECK_MODULES([JANSSON], [jansson >= 2.7]) -- - dnl Check for JSON-C library (required). - PKG_CHECK_MODULES([JSON_C], [json-c >= 0.14]) - diff --git a/copy-patches.sh b/copy-patches.sh index 57ccf1f..b73855f 100755 --- a/copy-patches.sh +++ b/copy-patches.sh @@ -7,7 +7,7 @@ set -e # ./copy-patches.sh project=guestfs-tools -rhel_version=10.0 +rhel_version=10.1 # Check we're in the right directory. if [ ! -f $project.spec ]; then diff --git a/guestfs-tools.spec b/guestfs-tools.spec index a13d44b..c3c8603 100644 --- a/guestfs-tools.spec +++ b/guestfs-tools.spec @@ -7,19 +7,16 @@ # Verify tarball signature with GPGv2. %global verify_tarball_signature 1 -# If there are patches which touch autotools files, set this to 1. -%global patches_touch_autotools 1 - # The source directory. -%global source_directory 1.52-stable +%global source_directory 1.54-stable # Filter perl provides. %{?perl_default_filter} Summary: Tools to access and modify virtual machine disk images Name: guestfs-tools -Version: 1.52.2 -Release: 2%{?dist} +Version: 1.54.0 +Release: 1%{?dist} License: GPL-2.0-or-later AND LGPL-2.0-or-later # Build only for architectures that have a kernel @@ -45,23 +42,17 @@ Source2: libguestfs.keyring Source3: copy-patches.sh # Patches are maintained in the following repository: -# https://github.com/rwmjones/guestfs-tools/commits/rhel-10.0 +# https://github.com/rwmjones/guestfs-tools/commits/rhel-10.1 # Patches. Patch0001: 0001-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch Patch0002: 0002-RHEL-builder-Disable-opensuse-repository.patch -Patch0003: 0003-customize-Implement-inject-blnsvr-operation.patch -Patch0004: 0004-build-Add-new-dependency-on-json-c.patch -Patch0005: 0005-builder-Replace-jansson-with-json-c.patch -Patch0006: 0006-build-Remove-Jansson-dependency.patch - -%if 0%{patches_touch_autotools} -BuildRequires: autoconf, automake, libtool, gettext-devel -%endif # Basic build requirements. +BuildRequires: autoconf, automake, libtool, gettext-devel BuildRequires: gcc, gcc-c++ BuildRequires: make +BuildRequires: glibc-utils BuildRequires: libguestfs-devel >= 1:1.49.8-1 BuildRequires: libguestfs-xfs BuildRequires: perl(Pod::Simple) @@ -80,12 +71,10 @@ BuildRequires: ncurses-devel %ifarch x86_64 BuildRequires: glibc-static %endif +BuildRequires: ocaml >= 4.08 BuildRequires: ocaml-libguestfs-devel BuildRequires: ocaml-findlib-devel BuildRequires: ocaml-gettext-devel -%if !0%{?rhel} -BuildRequires: ocaml-ounit-devel -%endif BuildRequires: flex BuildRequires: bison BuildRequires: xz-devel @@ -258,13 +247,12 @@ for %{name}. %setup -q %autopatch -p1 -%if 0%{patches_touch_autotools} -autoreconf -i -%endif - - %build -%{configure} +autoreconf -fiv + +# Preserve timestamps when copying files. Otherwise, the time of the +# build ends up in the header added by gzip when it compresses files. +%{configure} INSTALL='/usr/bin/install -p' # Building index-parse.c by hand works around a race condition in the # autotools cruft, where two or more copies of yacc race with each @@ -412,6 +400,14 @@ end %changelog +* Wed May 21 2025 Richard W.M. Jones - 1.54.0-1 +- Rebase to guestfs-tools 1.54.0 + resolves: RHEL-81734 +- virt-builder, virt-v2v & other tools with -v and --install causes dnf5 error + resolves: RHEL-83201 +- virt-drivers fails on opensuse guest if kernel-source is installed + resolves: RHEL-92604 + * Wed Oct 30 2024 Richard W.M. Jones - 1.52.2-2 - Rebase to guestfs-tools 1.52.2 resolves: RHEL-56812 diff --git a/sources b/sources index 416a0b1..87d2548 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (guestfs-tools-1.52.2.tar.gz) = a4c0b4fbefcc7787a31a5869f12a6ce46b3de21ad19f1ac9563fac03806b227a4f6e872e6416e2dfe4c246582b04356d7dc3d70b0d694011ee9bdef6ba9c5ac3 -SHA512 (guestfs-tools-1.52.2.tar.gz.sig) = 5958d6e61274e7843d76112db587da685484635b69f2c053345986ef312fbb8d7b63430acdee1acb30cb523068fe7dec3fd5c82ef57a0a0bf62d14100cc09956 +SHA512 (guestfs-tools-1.54.0.tar.gz) = db76a1cbfaa8b53b5c4609030f545b9d043161cebf54379da6418800086855f11cb3a0e5d135184c2a885094a6a7120155774377a6641a2d7fbd45206ff9ec87 +SHA512 (guestfs-tools-1.54.0.tar.gz.sig) = c503f858ba5c2f79814f1f896f41c0b7558cc55534d800bafc2992c929e9a709cb7ab043205a9f5efd2cd9bcbbe3a2273970e116f00ad6625cbb86adaa42accd