Compare commits

...

No commits in common. "c9-beta" and "c10s" have entirely different histories.

37 changed files with 1867 additions and 1295 deletions

5
.gitignore vendored
View File

@ -1,2 +1,3 @@
SOURCES/guestfs-tools-1.52.2.tar.gz
SOURCES/libguestfs.keyring
*~
/guestfs-tools-*.tar.gz
/guestfs-tools-*.tar.gz.sig

View File

@ -1,2 +0,0 @@
6eb02f4f70cb224548567ce7e4b67712c8ebb643 SOURCES/guestfs-tools-1.52.2.tar.gz
1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring

View File

@ -0,0 +1,34 @@
From 3a99e87bdee6c20a6286aa3e10bb2c2d896fb2ed Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 21 May 2025 15:02:44 +0100
Subject: [PATCH] docs: Move release note about GNU gettext to build section
Fixes: commit 9b7410c220f1111e6acef88efbbaee3fea4019b8
Updates: commit 80ce443e5eb7323e9b7b5cef30b8f7673ca51d67
(cherry picked from commit bf4fef4f2b45a2016c42094f8e4fe18abc8d90e2)
---
docs/guestfs-tools-release-notes-1.54.pod | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/guestfs-tools-release-notes-1.54.pod b/docs/guestfs-tools-release-notes-1.54.pod
index b44eb19a2..ab9062303 100644
--- a/docs/guestfs-tools-release-notes-1.54.pod
+++ b/docs/guestfs-tools-release-notes-1.54.pod
@@ -78,6 +78,8 @@ Some deprecated autoconf macros are no longer used.
Fix some issues when building on macOS (Mohamed Akram).
+Fix compatibility with GNU gettext 0.25.
+
=head2 Internals
The tests were modified to use a set of common functions and remove
@@ -87,8 +89,6 @@ nbdkit.
Some internal OCaml List and String functions that we used have been
replaced by ones from the OCaml stdlib, reducing code maintenance.
-Fix compatibility with GNU gettext 0.25.
-
=head2 Bugs fixed
=begin comment

View File

@ -1,4 +1,4 @@
From a0fbbc98f5fb069bcbf15a5a8ec51e4c778a2bd5 Mon Sep 17 00:00:00 2001
From 2eae3778a32b18944a6a561e10a35eae74fa11f0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 3 Jun 2025 08:29:57 +0100
Subject: [PATCH] builder: Update link to templates to use https

View File

@ -0,0 +1,32 @@
From b6401279c65497506eac2eaf61470bf6f49e89e7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 16 Jun 2025 21:47:41 +0100
Subject: [PATCH] builder: Replace -cpu host with -cpu max in example
When KVM isn't present, some versions of qemu may print:
qemu-system-x86_64: Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
qemu-system-x86_64: CPU model 'host' requires KVM or HVF
Use -cpu max instead which should work in both cases.
(cherry picked from commit 2e93abca5acaa69cd6fd08b70079e8f432539076)
---
builder/virt-builder.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod
index 05bef1e05..ff0ec250c 100644
--- a/builder/virt-builder.pod
+++ b/builder/virt-builder.pod
@@ -1043,7 +1043,7 @@ following could be used to boot the virtual machine:
qemu-system-x86_64 \
-machine accel=kvm:tcg \
- -cpu host \
+ -cpu max \
-m 2048 \
-drive file=disk.img,format=raw,if=virtio

View File

@ -0,0 +1,143 @@
From 6a1e751d4b10ae1833ee18c0796306711e842e76 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 13 Aug 2025 16:51:39 +0100
Subject: [PATCH] customize: Fixes for selinux relabelling and Windows
firstboot
This updates the common submodule to add the fixes below. These
changes allow SELinux relabelling to work correctly on Linux split-
/usr configurations, and allow Windows firstboot scripts to be
deferred until after a reboot.
The SELinux relabelling change requires libguestfs >= 1.57.1 (for the
new guestfs_setfiles API).
Richard W.M. Jones (4):
mlstdutils: Add List.combine4 function
mlcustomize/SELinux_relabel.ml: Add comment
mlcustomize/SELinux_relabel.ml: Use new guestfs_setfiles API
mlcustomize/SELinux_relabel.ml: Relabel every mountpoint
Vadim Rozenfeld (1):
Modify the firstboot script to check the scripts execution return status
Fixes: https://issues.redhat.com/browse/RHEL-108174
Related: https://issues.redhat.com/browse/RHEL-100682
(cherry picked from commit ea0f9cf0743c3e50a996a9d7ec488d58a9312b11)
---
common | 2 +-
m4/guestfs-libraries.m4 | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
Submodule common d4a81e9dd..89f1eb2d3:
diff --git a/common/mlcustomize/SELinux_relabel.ml b/common/mlcustomize/SELinux_relabel.ml
index 2f3a09bf7..f1729e3f4 100644
--- a/common/mlcustomize/SELinux_relabel.ml
+++ b/common/mlcustomize/SELinux_relabel.ml
@@ -1,5 +1,5 @@
(* virt-customize
- * Copyright (C) 2016 Red Hat Inc.
+ * Copyright (C) 2016-2025 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,10 @@ open Printf
module G = Guestfs
+(* XXX A lot of this code could usefully be moved into
+ * [libguestfs.git/daemon/selinux.ml].
+ *)
+
let rec relabel (g : G.guestfs) =
(* Is the guest using SELinux? (Otherwise this is a no-op). *)
if is_selinux_guest g then (
@@ -109,5 +113,13 @@ and use_setfiles g =
g#copy_attributes ~all:true old_specfile specfile
);
+ (* Get the list of mountpoints, since setfiles does not cross
+ * filesystems (RHEL-108174).
+ *)
+ let mps = g#mountpoints () |>
+ List.map snd |> (* the list of directories *)
+ List.sort compare |> (* sort them for consistency *)
+ Array.of_list in
+
(* Relabel everything. *)
- g#selinux_relabel ~force:true specfile "/"
+ g#setfiles ~force:true specfile mps
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 6aca4c34a..5f2642b06 100644
--- a/common/mlcustomize/firstboot.ml
+++ b/common/mlcustomize/firstboot.ml
@@ -305,13 +305,19 @@ if not exist \"%%scripts_done%%\" (
:: Pick the next script to run.
for %%%%f in (\"%%scripts%%\"\\*.bat) do (
echo running \"%%%%f\"
- move \"%%%%f\" \"%%scripts_done%%\"
- pushd \"%%scripts_done%%\"
+ pushd \"%%scripts%%\"
call \"%%%%~nf\"
set elvl=!errorlevel!
echo .... exit code !elvl!
popd
+ if !elvl! NEQ 249 (
+ echo Script succeeded, moving to scripts-done
+ move \"%%%%f\" \"%%scripts_done%%\"
+ ) else (
+ echo Script failed, will retry on next boot
+ )
+
:: Reboot the computer. This is necessary to free any locked
:: files which may prevent later scripts from running.
shutdown /r /t 0 /y
diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml
index 4850a5598..16032d992 100644
--- a/common/mlstdutils/std_utils.ml
+++ b/common/mlstdutils/std_utils.ml
@@ -80,6 +80,12 @@ module List = struct
| x::xs, y::ys, z::zs -> (x, y, z) :: combine3 xs ys zs
| _ -> invalid_arg "combine3"
+ let rec combine4 ws xs ys zs =
+ match ws, xs, ys, zs with
+ | [], [], [], [] -> []
+ | w::ws, x::xs, y::ys, z::zs -> (w, x, y, z) :: combine4 ws xs ys zs
+ | _ -> invalid_arg "combine4"
+
let rec assoc_lbl ?(cmp = Stdlib.compare) ~default x = function
| [] -> default
| (y, y') :: _ when cmp x y = 0 -> y'
diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli
index fe6bf1a7c..a20e720c2 100644
--- a/common/mlstdutils/std_utils.mli
+++ b/common/mlstdutils/std_utils.mli
@@ -106,6 +106,11 @@ module List : sig
(** Like {!List.combine} but for triples.
All lists must be the same length. *)
+ val combine4 : 'a list -> 'b list -> 'c list -> 'd list ->
+ ('a * 'b * 'c * 'd) list
+ (** Like {!List.combine} but for 4-tuples.
+ All lists must be the same length. *)
+
val assoc_lbl : ?cmp:('a -> 'a -> int) -> default:'b -> 'a -> ('a * 'b) list -> 'b
(** Like {!assoc} but with a user-defined comparison function, and
instead of raising [Not_found], it returns the [~default] value. *)
diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4
index c9fbf58b2..82e62d54f 100644
--- a/m4/guestfs-libraries.m4
+++ b/m4/guestfs-libraries.m4
@@ -19,8 +19,8 @@ dnl Any C libraries required by the libguestfs C library (not the daemon).
dnl Of course we need libguestfs.
dnl
-dnl We need libguestfs 1.55.6 for guestfs_sh_out.
-PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.55.6])
+dnl We need libguestfs 1.57.1 for guestfs_setfiles.
+PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.57.1])
printf "libguestfs version is "; $PKG_CONFIG --modversion libguestfs
dnl Test if it's GNU or XSI strerror_r.

View File

@ -0,0 +1,122 @@
From a01095308d22a5ab4d5858dfe0ee46f0b1bec28c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 20 Aug 2025 10:34:24 +0100
Subject: [PATCH] Update common submodule
Pulls in this fix which should have no effect:
Richard W.M. Jones (1):
mlcustomize/firstboot.ml: Use quoted string literals for firstboot
(cherry picked from virt-v2v commit b7aadeac02ef326d542cd83e441b5a9d99ced793)
(cherry picked from commit 038b30fb08107487cdba4bc0dbabb33dbf75f4c3)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 89f1eb2d3..7ecf3992b:
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 5f2642b06..360c33d67 100644
--- a/common/mlcustomize/firstboot.ml
+++ b/common/mlcustomize/firstboot.ml
@@ -35,8 +35,7 @@ let sanitize_name =
module Linux = struct
let firstboot_dir = "/usr/lib/virt-sysprep"
- let firstboot_sh = sprintf "\
-#!/bin/sh -
+ let firstboot_sh = sprintf {|#!/bin/sh -
### BEGIN INIT INFO
# Provides: virt-sysprep
@@ -57,14 +56,14 @@ d=%s/scripts
d_done=%s/scripts-done
logfile=~root/virt-sysprep-firstboot.log
-echo \"$0\" \"$@\" 2>&1 | tee -a $logfile
-echo \"Scripts dir: $d\" 2>&1 | tee -a $logfile
+echo "$0" "$@" 2>&1 | tee -a $logfile
+echo "Scripts dir: $d" 2>&1 | tee -a $logfile
-if test \"$1\" = \"start\"
+if test "$1" = "start"
then
mkdir -p $d_done
for f in $d/* ; do
- if test -x \"$f\"
+ if test -x "$f"
then
# move the script to the 'scripts-done' directory, so it is not
# executed again at the next boot
@@ -75,7 +74,7 @@ then
done
rm -f $d_done/*
fi
-" firstboot_dir firstboot_dir
+|} firstboot_dir firstboot_dir
let systemd_target = "multi-user.target"
@@ -282,38 +281,37 @@ module Windows = struct
* XXX It would be better to use powershell here. For some ideas see
* https://github.com/HCK-CI/HLK-Setup-Scripts/
*)
- let firstboot_script = sprintf "\
-@echo off
+ let firstboot_script = sprintf {|@echo off
setlocal EnableDelayedExpansion
set firstboot=%s
-set log=%%firstboot%%\\log.txt
+set log=%%firstboot%%\log.txt
-set scripts=%%firstboot%%\\scripts
-set scripts_done=%%firstboot%%\\scripts-done
+set scripts=%%firstboot%%\scripts
+set scripts_done=%%firstboot%%\scripts-done
-call :main >> \"%%log%%\" 2>&1
+call :main >> "%%log%%" 2>&1
exit /b
:main
echo starting firstboot service
-if not exist \"%%scripts_done%%\" (
- mkdir \"%%scripts_done%%\"
+if not exist "%%scripts_done%%" (
+ mkdir "%%scripts_done%%"
)
:: Pick the next script to run.
-for %%%%f in (\"%%scripts%%\"\\*.bat) do (
- echo running \"%%%%f\"
- pushd \"%%scripts%%\"
- call \"%%%%~nf\"
+for %%%%f in ("%%scripts%%"\*.bat) do (
+ echo running "%%%%f"
+ pushd "%%scripts%%"
+ call "%%%%~nf"
set elvl=!errorlevel!
echo .... exit code !elvl!
popd
if !elvl! NEQ 249 (
echo Script succeeded, moving to scripts-done
- move \"%%%%f\" \"%%scripts_done%%\"
+ move "%%%%f" "%%scripts_done%%"
) else (
echo Script failed, will retry on next boot
)
@@ -329,8 +327,8 @@ for %%%%f in (\"%%scripts%%\"\\*.bat) do (
:: Fallthrough here if there are no scripts.
echo uninstalling firstboot service
-\"%%firstboot%%\\%s\" -s firstboot uninstall
-" firstboot_dir_win srvany in
+"%%firstboot%%\%s" -s firstboot uninstall
+|} firstboot_dir_win srvany in
g#write (firstboot_dir // "firstboot.bat")
(String.unix2dos firstboot_script);

View File

@ -0,0 +1,22 @@
From 9ee5fdf8146231087a461f4cddc0280db762c2f4 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 1 Sep 2025 17:33:07 +0100
Subject: [PATCH] .gitignore: Ignore *.bak files
(cherry picked from commit cd5ea5cd63a11bc85077e6296021bd25b3c84662)
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 9c2e200e6..94f77ac74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
*.1
*.a
*.annot
+*.bak
*.cmi
*.cmo
*.cmx

View File

@ -0,0 +1,206 @@
From 0074de5f6eccb75dad814527813eba3524bb22e0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 1 Sep 2025 18:41:24 +0100
Subject: [PATCH] builder, sysprep: Use quoted string literals in a few places
This change was automated using the script in:
https://github.com/libguestfs/libguestfs/commit/02b64d5cec1ac0a6f7627d5489996de4474a67f6
However I manually only picked a few of the changes suggested
by the script.
(cherry picked from commit 624df48b3d14d2e5420d758a425bcae509cfe318)
---
builder/templates/make-template.ml | 62 ++++++++++++++---------------
sysprep/sysprep_operation_script.ml | 5 ++-
2 files changed, 33 insertions(+), 34 deletions(-)
diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
index 73a55bd45..515c3da8b 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -535,8 +535,7 @@ and make_kickstart_common ks_filename os arch =
| _ -> bpf "install\n";
);
- bpf "\
-text
+ bpf {|text
reboot
lang en_US.UTF-8
keyboard us
@@ -544,7 +543,7 @@ network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
timezone --utc America/New_York
-";
+|};
(match os with
| RHEL (ver, _) when ver <= 4 ->
@@ -586,19 +585,19 @@ mouse generic
| CentOS ((3|4|5|6) as major, _) | RHEL ((3|4|5|6) as major, _) ->
let bootfs = if major <= 5 then "ext2" else "ext4" in
let rootfs = if major <= 4 then "ext3" else "ext4" in
- bpf "\
+ bpf {|
zerombr
clearpart --all --initlabel
part /boot --fstype=%s --size=512 --asprimary
part swap --size=1024 --asprimary
part / --fstype=%s --size=1024 --grow --asprimary
-" bootfs rootfs;
+|} bootfs rootfs;
| Alma _ | CentOS _ | CentOSStream _ | RHEL _ | Fedora _ ->
- bpf "\
+ bpf {|
zerombr
clearpart --all --initlabel --disklabel=gpt
autopart --type=plain
-";
+|};
| _ -> assert false (* cannot happen, see caller *)
);
bpf "\n";
@@ -753,16 +752,16 @@ and make_unattend_iso os arch =
* file called \Windows\Panther\Setupact.log (NB:
* not \Windows\Setupact.log)
*)
- fprintf chan "
-<unattend xmlns=\"urn:schemas-microsoft-com:unattend\"
- xmlns:ms=\"urn:schemas-microsoft-com:asm.v3\"
- xmlns:wcm=\"http://schemas.microsoft.com/WMIConfig/2002/State\">
- <settings pass=\"windowsPE\">
- <component name=\"Microsoft-Windows-Setup\"
- publicKeyToken=\"31bf3856ad364e35\"
- language=\"neutral\"
- versionScope=\"nonSxS\"
- processorArchitecture=\"%s\">
+ fprintf chan {|
+<unattend xmlns="urn:schemas-microsoft-com:unattend"
+ xmlns:ms="urn:schemas-microsoft-com:asm.v3"
+ xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
+ <settings pass="windowsPE">
+ <component name="Microsoft-Windows-Setup"
+ publicKeyToken="31bf3856ad364e35"
+ language="neutral"
+ versionScope="nonSxS"
+ processorArchitecture="%s">
<UserData>
<AcceptEula>true</AcceptEula>
<ProductKey>
@@ -772,18 +771,18 @@ and make_unattend_iso os arch =
</UserData>
<DiskConfiguration>
- <Disk wcm:action=\"add\">
+ <Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<!-- System partition -->
- <CreatePartition wcm:action=\"add\">
+ <CreatePartition wcm:action="add">
<Order>1</Order>
<Type>Primary</Type>
<Size>300</Size>
</CreatePartition>
<!-- Windows partition -->
- <CreatePartition wcm:action=\"add\">
+ <CreatePartition wcm:action="add">
<Order>2</Order>
<Type>Primary</Type>
<Extend>true</Extend>
@@ -791,7 +790,7 @@ and make_unattend_iso os arch =
</CreatePartitions>
<ModifyPartitions>
<!-- System partition -->
- <ModifyPartition wcm:action=\"add\">
+ <ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<Label>System</Label>
@@ -799,7 +798,7 @@ and make_unattend_iso os arch =
<Active>true</Active>
</ModifyPartition>
<!-- Windows partition -->
- <ModifyPartition wcm:action=\"add\">
+ <ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>2</PartitionID>
<Label>Windows</Label>
@@ -828,11 +827,11 @@ and make_unattend_iso os arch =
</ImageInstall>
</component>
- <component name=\"Microsoft-Windows-International-Core-WinPE\"
- publicKeyToken=\"31bf3856ad364e35\"
- language=\"neutral\"
- versionScope=\"nonSxS\"
- processorArchitecture=\"%s\">
+ <component name="Microsoft-Windows-International-Core-WinPE"
+ publicKeyToken="31bf3856ad364e35"
+ language="neutral"
+ versionScope="nonSxS"
+ processorArchitecture="%s">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
@@ -841,7 +840,7 @@ and make_unattend_iso os arch =
<UserLocale>en-US</UserLocale>
</component>
</settings>
-</unattend>"
+</unattend>|}
arch product_key arch;
close_out chan;
@@ -1411,14 +1410,13 @@ baseurl=%s
enabled=0
gpgcheck=0
keepcache=0
-" major major baseurl major major srpms;
+|} major major baseurl major major srpms;
(match optional with
| None -> ()
| Some (name, optionalbaseurl, optionalsrpms) ->
let lc_name = String.lowercase_ascii name in
- bpf "\
-
+ bpf {|
[rhel%d-%s]
name=RHEL %d Server %s
baseurl=%s
@@ -1432,7 +1430,7 @@ baseurl=%s
enabled=0
gpgcheck=0
keepcache=0
-" major lc_name major lc_name optionalbaseurl
+|} major lc_name major lc_name optionalbaseurl
major lc_name major lc_name optionalsrpms
)
) else (
diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml
index fff5e4d51..a91cea26b 100644
--- a/sysprep/sysprep_operation_script.ml
+++ b/sysprep/sysprep_operation_script.ml
@@ -81,7 +81,7 @@ let rec script_perform (g : Guestfs.guestfs) root side_effects =
and run_scripts mp scripts =
let sh = "/bin/bash" in
let cmd =
- sprintf "\
+ sprintf {|
set -e
#set -x
cleanup ()
@@ -91,7 +91,8 @@ cleanup ()
guestunmount %s ||:
exit $status
}
-trap cleanup INT TERM QUIT EXIT ERR\n"
+trap cleanup INT TERM QUIT EXIT ERR
+|}
(Filename.quote mp) ^
String.concat "\n" scripts in
let args = [| sh; "-c"; cmd |] in

View File

@ -0,0 +1,26 @@
From cde27ebd4775cfa9a23a53a48b47303557bcb537 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 2 Sep 2025 09:05:27 +0100
Subject: [PATCH] builder/templates/make-template.ml: Fix quoting
Fix mistake introduced by manual editing of the previous commit.
Fixes: commit 624df48b3d14d2e5420d758a425bcae509cfe318
(cherry picked from commit 7e63b2142682582ec87bdd8c0d98bb22fcc0dabf)
---
builder/templates/make-template.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
index 515c3da8b..a69d3ad3f 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -1394,7 +1394,7 @@ and make_rhel_yum_conf major minor arch =
sprintf "%s/AppStream/source/tree" topurl)
| _ -> assert false in
- bpf "\
+ bpf {|
# Yum configuration pointing to Red Hat servers.
[rhel%d]

View File

@ -0,0 +1,33 @@
From 1fca99c9bed60cd9a9c62826d4e6995052d0c5dd Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 2 Sep 2025 09:06:33 +0100
Subject: [PATCH] builder/templates/make-template.ml: Use quoted string
literals for regexps
(cherry picked from commit aafb271e8ffd961c529f90ef65df75a70102f0fc)
---
builder/templates/make-template.ml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
index a69d3ad3f..f8b41209e 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -374,7 +374,7 @@ and os_of_string os ver =
eprintf "%s: unknown or unsupported OS (%s, %s)\n" prog os ver; exit 1
and parse_major_minor ver =
- let rex = Str.regexp "^\\([0-9]+\\)\\.\\([0-9]+\\)$" in
+ let rex = Str.regexp {|^\([0-9]+\)\.\([0-9]+\)$|} in
if Str.string_match rex ver 0 then (
int_of_string (Str.matched_group 1 ver),
int_of_string (Str.matched_group 2 ver)
@@ -1631,7 +1631,7 @@ and read_revision filename =
| None -> `No_file
| Some chan ->
let r = ref `No_revision in
- let rex = Str.regexp "^revision=\\([0-9]+\\)$" in
+ let rex = Str.regexp {|^revision=\([0-9]+\)$|} in
(try
let rec loop () =
let line = input_line chan in

View File

@ -0,0 +1,43 @@
From 7b2125b42535e6768d8f162d19463af4c4e8df1b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 2 Sep 2025 09:07:34 +0100
Subject: [PATCH] builder/templates/make-template.ml: Add +str and +unix for
OCaml 5
Removes these warnings:
File "_none_", line 1:
Alert ocaml_deprecated_auto_include:
OCaml's lib directory layout changed in 5.0. The str subdirectory has been
automatically added to the search path, but you should add -I +str to the
command-line to silence this alert (e.g. by adding str to the list of
libraries in your dune file, or adding use_str to your _tags file for
ocamlbuild, or using -package str for ocamlfind).
File "_none_", line 1:
Alert ocaml_deprecated_auto_include:
OCaml's lib directory layout changed in 5.0. The unix subdirectory has been
automatically added to the search path, but you should add -I +unix to the
command-line to silence this alert (e.g. by adding unix to the list of
libraries in your dune file, or adding use_unix to your _tags file for
ocamlbuild, or using -package unix for ocamlfind).
(cherry picked from commit 046309b31c22da5ac64feac12bcf4501377a8b3f)
---
builder/templates/make-template.ml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
index f8b41209e..2ce803e2b 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -24,7 +24,9 @@
* shell scripts located in libguestfs.git/builder/website.
*)
+#directory "+str";;
#load "str.cma";;
+#directory "+unix";;
#load "unix.cma";;
#directory "+guestfs";; (* use globally installed guestfs *)
#load "mlguestfs.cma";;

View File

@ -0,0 +1,76 @@
From 68a3719888f36719cef8bcd7817ed634c4524012 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 12 Sep 2025 08:37:58 +0100
Subject: [PATCH] daemon, generator: Use power of 2 for initial size of
Hashtbl.create
Before 2011 it was recommended to use a prime number for the initial
size. In 2011 the OCaml hash table was reimplemented using a hash
function based on Murmur 3. Hashtbl.create now adjusts the initial
size to the next power of 2 (minimum 16). So replace obsolete
'Hashtbl.create 13' with 'Hashtbl.create 16'.
(cherry picked from commit 51f7dfa8612e8e273e3ef15eddd7a5714122cc57)
---
builder/builder.ml | 2 +-
builder/index_parser.ml | 4 ++--
resize/resize.ml | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builder/builder.ml b/builder/builder.ml
index bbe2808f5..2df2fa5c7 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -46,7 +46,7 @@ let remove_duplicates index =
* (name, arch) tuples, so it possible to ignore duplicates,
* and versions with a lower revision.
*)
- let nseen = Hashtbl.create 13 in
+ let nseen = Hashtbl.create 16 in
List.iter (
fun (name, { Index.arch; revision }) ->
let id = name, arch in
diff --git a/builder/index_parser.ml b/builder/index_parser.ml
index 3e19e489e..2cb89488f 100644
--- a/builder/index_parser.ml
+++ b/builder/index_parser.ml
@@ -55,7 +55,7 @@ let get_index ~downloader ~sigchecker ?(template = false)
in
n, (find_arch fields)
) sections in
- let nseen = Hashtbl.create 13 in
+ let nseen = Hashtbl.create 16 in
List.iter (
fun (n, arch) ->
let id = n, arch in
@@ -71,7 +71,7 @@ let get_index ~downloader ~sigchecker ?(template = false)
(* Check for repeated fields. *)
List.iter (
fun (n, fields) ->
- let fseen = Hashtbl.create 13 in
+ let fseen = Hashtbl.create 16 in
List.iter (
fun (field, subkey, _) ->
let hashkey = (field, subkey) in
diff --git a/resize/resize.ml b/resize/resize.ml
index fffe2de77..707def8e9 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -630,7 +630,7 @@ read the man page virt-resize(1).
* that the user has asked to be ignored or deleted.
*)
let find_partition =
- let hash = Hashtbl.create 13 in
+ let hash = Hashtbl.create 16 in
List.iter (fun ({ p_name = name } as p) -> Hashtbl.add hash name p)
partitions;
fun ~option name ->
@@ -881,7 +881,7 @@ read the man page virt-resize(1).
surplus in
(* Mark the --lv-expand LVs. *)
- let hash = Hashtbl.create 13 in
+ let hash = Hashtbl.create 16 in
List.iter (fun ({ lv_name = name } as lv) -> Hashtbl.add hash name lv) lvs;
List.iter (

View File

@ -0,0 +1,123 @@
From abb56223e0a35c3e5d1158f32789c44c28bacf40 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 24 May 2025 13:27:00 +0100
Subject: [PATCH] builder: Build fedora-42 template
Thanks: Jeff Layton
---
builder/templates/fedora-42.index-fragment | 22 +++++++++
builder/templates/fedora-42.ks | 48 ++++++++++++++++++++
builder/templates/fedora-42.virt-install-cmd | 20 ++++++++
3 files changed, 90 insertions(+)
create mode 100644 builder/templates/fedora-42.index-fragment
create mode 100644 builder/templates/fedora-42.ks
create mode 100644 builder/templates/fedora-42.virt-install-cmd
diff --git a/builder/templates/fedora-42.index-fragment b/builder/templates/fedora-42.index-fragment
new file mode 100644
index 000000000..6d21b742c
--- /dev/null
+++ b/builder/templates/fedora-42.index-fragment
@@ -0,0 +1,22 @@
+[fedora-42]
+name=Fedora® 42 Server
+osinfo=fedora42
+arch=x86_64
+file=fedora-42.xz
+checksum[sha512]=dda921f3c522da8d8a67e31948260f52a9aa5bdeca4382a5c557635d77ad91d11b9aded70a225f59503b268ec73815ceac2eac5b70c1d47f22056febdd9da6bb
+format=raw
+size=6442450944
+compressed_size=927728896
+expand=/dev/sda3
+notes=Fedora® 42 Server
+
+ This Fedora image contains only unmodified @Core group packages.
+
+ Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
+ Source and further information is available from http://fedoraproject.org/
+
+ This template was generated by a script in the libguestfs source tree:
+ builder/templates/make-template.ml
+ Associated files used to prepare this template can be found in the
+ same directory.
+
diff --git a/builder/templates/fedora-42.ks b/builder/templates/fedora-42.ks
new file mode 100644
index 000000000..17e2e3f15
--- /dev/null
+++ b/builder/templates/fedora-42.ks
@@ -0,0 +1,48 @@
+# Kickstart file for fedora-42
+# Generated by libguestfs.git/builder/templates/make-template.ml
+
+text
+reboot
+lang en_US.UTF-8
+keyboard us
+network --bootproto dhcp
+rootpw builder
+firewall --enabled --ssh
+timezone --utc America/New_York
+selinux --enforcing
+
+bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
+
+
+zerombr
+clearpart --all --initlabel --disklabel=gpt
+autopart --type=plain
+
+# Halt the system once configuration has finished.
+poweroff
+
+%packages
+@core
+%end
+
+%post
+# Ensure the installation is up-to-date.
+dnf -y --best upgrade
+# This required otherwise the kernel will not be bootable, see
+# https://bugzilla.redhat.com/show_bug.cgi?id=1911177
+# https://bugzilla.redhat.com/show_bug.cgi?id=1945835#c24
+grub2-mkconfig -o '/etc/grub2.cfg'
+# Enable Xen domU support.
+pushd /etc/dracut.conf.d
+echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf
+popd
+# To make dracut config changes permanent, we need to rerun dracut.
+# Rerun dracut for the installed kernel (not the running kernel).
+# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and
+# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045
+KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' |
+ sort -V | tail -1)"
+dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
+%end
+
+# EOF
diff --git a/builder/templates/fedora-42.virt-install-cmd b/builder/templates/fedora-42.virt-install-cmd
new file mode 100644
index 000000000..2a3256bbd
--- /dev/null
+++ b/builder/templates/fedora-42.virt-install-cmd
@@ -0,0 +1,20 @@
+# This is the virt-install command which was used to create
+# the virt-builder template 'fedora-42'
+# NB: This file is generated for documentation purposes ONLY!
+# This script was never run, and is not intended to be run.
+
+'virt-install' \
+ '--transient' \
+ '--name=tmp-oeg15xnl' \
+ '--ram=4096' \
+ '--arch=x86_64' \
+ '--cpu=host' \
+ '--vcpus=4' \
+ '--os-variant=fedora34' \
+ '--initrd-inject=fedora-42.ks' \
+ '--extra-args=inst.ks=file:/fedora-42.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \
+ '--disk=/home/rjones/d/guestfs-tools/builder/templates/tmp-oeg15xnl.img,size=6,format=raw' \
+ '--location=https://lon.mirror.rackspace.com/fedora/releases/42/Server/x86_64/os/' \
+ '--serial=pty' \
+ '--nographics'
+

View File

@ -0,0 +1,61 @@
From 2d808c89eee6369df62b3afe16681a41ca42e0b9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 20 Sep 2025 17:20:25 +0100
Subject: [PATCH] Update common submodule
Richard W.M. Jones (3):
mlstdutils: Export List.find_opt
daemon, generator: Use power of 2 for initial size of Hashtbl.create
mlcustomize/inject_virtio_win.ml: Use viostor.inf instead of guestor
See-also: https://github.com/libguestfs/libguestfs-common/pull/17
(cherry picked from commit 13bcff3c2ca3e7ad355527a13b3aa2941ec1ff5b)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 7ecf3992b..da55dc4d7:
diff --git a/common/mlcustomize/customize_run.ml b/common/mlcustomize/customize_run.ml
index ff719f4ec..64afd3ab5 100644
--- a/common/mlcustomize/customize_run.ml
+++ b/common/mlcustomize/customize_run.ml
@@ -97,7 +97,7 @@ let run (g : G.guestfs) root (ops : ops) =
) in
(* Store the passwords and set them all at the end. *)
- let passwords = Hashtbl.create 13 in
+ let passwords = Hashtbl.create 16 in
let set_password user pw =
if Hashtbl.mem passwords user then
error (f_"multiple --root-password/--password options set the \
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
index b26b14d34..114df0641 100644
--- a/common/mlcustomize/inject_virtio_win.ml
+++ b/common/mlcustomize/inject_virtio_win.ml
@@ -310,8 +310,13 @@ and ddb_regedits inspect drv_name drv_pciid =
* one must add keys into the DriverDatabase.
*)
+ let winarch =
+ match inspect.i_arch with
+ | "i386" -> "x86" | "x86_64" -> "amd64"
+ | _ -> assert false in
+
let drv_inf = "guestor.inf" in
- let drv_inf_label = drv_inf ^ "_tmp" in
+ let drv_inf_label = sprintf "%s_%s_0000000000000000" drv_inf winarch in
let drv_config = "guestor_conf" in
[
diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli
index a20e720c2..6c1911da8 100644
--- a/common/mlstdutils/std_utils.mli
+++ b/common/mlstdutils/std_utils.mli
@@ -46,6 +46,7 @@ module List : sig
val mem : 'a -> 'a list -> bool
val memq : 'a -> 'a list -> bool
val find : ('a -> bool) -> 'a list -> 'a
+ val find_opt : ('a -> bool) -> 'a list -> 'a option
val filter : ('a -> bool) -> 'a list -> 'a list
val find_all : ('a -> bool) -> 'a list -> 'a list
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list

View File

@ -0,0 +1,427 @@
From 5ed99959b689fc6fa287d9c6100e92a18bc1c9be Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Tue, 14 Oct 2025 14:07:40 -0400
Subject: [PATCH] common: update submodule
Cole Robinson (1):
mlcustomize: deprecate and remove --sm-* options
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 57b225d8d324d15d79fab2ccc6944868c1168a42)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common da55dc4d7..90399dd18:
diff --git a/common/mlcustomize/Makefile.am b/common/mlcustomize/Makefile.am
index 6e03bfea3..351524c80 100644
--- a/common/mlcustomize/Makefile.am
+++ b/common/mlcustomize/Makefile.am
@@ -47,7 +47,6 @@ SOURCES_MLI = \
random_seed.mli \
SELinux_relabel.mli \
ssh_key.mli \
- subscription_manager.mli \
timezone.mli
# This list must be in dependency order.
@@ -58,7 +57,6 @@ SOURCES_ML = \
perl_edit.ml \
random_seed.ml \
ssh_key.ml \
- subscription_manager.ml \
timezone.ml \
crypt.ml \
password.ml \
diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod
index 157145ebc..c8de3953c 100644
--- a/common/mlcustomize/customize-options.pod
+++ b/common/mlcustomize/customize-options.pod
@@ -392,35 +392,6 @@ It cannot delete directories, only regular files.
This is a compatibility option that does nothing.
-=item B<--sm-attach> SELECTOR
-
-Attach to a pool using C<subscription-manager>.
-
-See L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of
-the C<SELECTOR> field.
-
-=item B<--sm-credentials> SELECTOR
-
-Set the credentials for C<subscription-manager>.
-
-See L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of
-the C<SELECTOR> field.
-
-=item B<--sm-register>
-
-Register the guest using C<subscription-manager>.
-
-This requires credentials being set using I<--sm-credentials>.
-
-=item B<--sm-remove>
-
-Remove all the subscriptions from the guest using
-C<subscription-manager>.
-
-=item B<--sm-unregister>
-
-Unregister the guest using C<subscription-manager>.
-
=item B<--ssh-inject> USER[:SELECTOR]
Inject an ssh key so the given C<USER> will be able to log in over
diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod
index 957de8cf2..f5eeb69dd 100644
--- a/common/mlcustomize/customize-synopsis.pod
+++ b/common/mlcustomize/customize-synopsis.pod
@@ -8,11 +8,10 @@
[--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]
+ [--run-command 'CMD+ARGS'] [--scrub FILE]
[--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]
+ [--selinux-relabel]
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index 7451f1325..786f4ee49 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -85,14 +85,6 @@ and op = [
(* --run-command 'CMD+ARGS' *)
| `Scrub of string
(* --scrub FILE *)
- | `SMAttach of Subscription_manager.sm_pool
- (* --sm-attach SELECTOR *)
- | `SMRegister
- (* --sm-register *)
- | `SMRemove
- (* --sm-remove *)
- | `SMUnregister
- (* --sm-unregister *)
| `SSHInject of string * Ssh_key.ssh_key_selector
(* --ssh-inject USER[:SELECTOR] *)
| `TarIn of string * string
@@ -123,8 +115,6 @@ and flags = {
(* --no-selinux-relabel *)
selinux_relabel_ignored : bool;
(* --selinux-relabel *)
- sm_credentials : Subscription_manager.sm_credentials option;
- (* --sm-credentials SELECTOR *)
}
type argspec = Getopt.keys * Getopt.spec * Getopt.doc
@@ -135,7 +125,6 @@ let rec argspec ?(v2v = false) () =
let password_crypto = ref None in
let no_selinux_relabel = ref false in
let selinux_relabel_ignored = ref false in
- let sm_credentials = ref None in
let rec get_ops () = {
ops = List.rev !ops;
@@ -146,7 +135,6 @@ let rec argspec ?(v2v = false) () =
password_crypto = !password_crypto;
no_selinux_relabel = !no_selinux_relabel;
selinux_relabel_ignored = !selinux_relabel_ignored;
- sm_credentials = !sm_credentials;
}
in
@@ -386,35 +374,6 @@ let rec argspec ?(v2v = false) () =
s_"Scrub a file"
),
Some "FILE", "Scrub a file from the guest. This is like I<--delete> except that:\n\n=over 4\n\n=item *\n\nIt scrubs the data so a guest could not recover it.\n\n=item *\n\nIt cannot delete directories, only regular files.\n\n=back", false;
- (
- [ L"sm-attach" ],
- Getopt.String (
- s_"SELECTOR",
- fun s ->
- let sel = Subscription_manager.parse_pool_selector s in
- List.push_front (`SMAttach sel) ops
- ),
- s_"Attach to a subscription-manager pool"
- ),
- Some "SELECTOR", "Attach to a pool using C<subscription-manager>.\n\nSee L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of\nthe C<SELECTOR> field.", false;
- (
- [ L"sm-register" ],
- Getopt.Unit (fun () -> List.push_front `SMRegister ops),
- s_"Register using subscription-manager"
- ),
- None, "Register the guest using C<subscription-manager>.\n\nThis requires credentials being set using I<--sm-credentials>.", false;
- (
- [ L"sm-remove" ],
- Getopt.Unit (fun () -> List.push_front `SMRemove ops),
- s_"Remove all the subscriptions"
- ),
- None, "Remove all the subscriptions from the guest using\nC<subscription-manager>.", false;
- (
- [ L"sm-unregister" ],
- Getopt.Unit (fun () -> List.push_front `SMUnregister ops),
- s_"Unregister using subscription-manager"
- ),
- None, "Unregister the guest using C<subscription-manager>.", false;
(
[ L"ssh-inject" ],
Getopt.String (
@@ -529,16 +488,6 @@ let rec argspec ?(v2v = false) () =
s_"Compatibility option doing nothing"
),
None, "This is a compatibility option that does nothing.", false;
- (
- [ L"sm-credentials" ],
- Getopt.String (
- s_"SELECTOR",
- fun s ->
- sm_credentials := Some (Subscription_manager.parse_credentials_selector s)
- ),
- s_"Credentials for subscription-manager"
- ),
- Some "SELECTOR", "Set the credentials for C<subscription-manager>.\n\nSee L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of\nthe C<SELECTOR> field.", false;
]
and customize_read_from_file filename =
let forbidden_commands = [
diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli
index cc32f3af4..baacda9d3 100644
--- a/common/mlcustomize/customize_cmdline.mli
+++ b/common/mlcustomize/customize_cmdline.mli
@@ -77,14 +77,6 @@ and op = [
(* --run-command 'CMD+ARGS' *)
| `Scrub of string
(* --scrub FILE *)
- | `SMAttach of Subscription_manager.sm_pool
- (* --sm-attach SELECTOR *)
- | `SMRegister
- (* --sm-register *)
- | `SMRemove
- (* --sm-remove *)
- | `SMUnregister
- (* --sm-unregister *)
| `SSHInject of string * Ssh_key.ssh_key_selector
(* --ssh-inject USER[:SELECTOR] *)
| `TarIn of string * string
@@ -115,8 +107,6 @@ and flags = {
(* --no-selinux-relabel *)
selinux_relabel_ignored : bool;
(* --selinux-relabel *)
- sm_credentials : Subscription_manager.sm_credentials option;
- (* --sm-credentials SELECTOR *)
}
type argspec = Getopt.keys * Getopt.spec * Getopt.doc
diff --git a/common/mlcustomize/customize_run.ml b/common/mlcustomize/customize_run.ml
index 64afd3ab5..1baf0f3cf 100644
--- a/common/mlcustomize/customize_run.ml
+++ b/common/mlcustomize/customize_run.ml
@@ -279,43 +279,6 @@ let run (g : G.guestfs) root (ops : ops) =
message (f_"Scrubbing: %s") path;
g#scrub_file path
- | `SMAttach pool ->
- (match pool with
- | Subscription_manager.PoolAuto ->
- message (f_"Attaching to compatible subscriptions");
- let cmd = "subscription-manager attach --auto" in
- do_run ~display:cmd ~warn_failed_no_network:true cmd
- | Subscription_manager.PoolId id ->
- message (f_"Attaching to the pool %s") id;
- let cmd = sprintf "subscription-manager attach --pool=%s" (quote id) in
- do_run ~display:cmd ~warn_failed_no_network:true cmd
- )
-
- | `SMRegister ->
- message (f_"Registering with subscription-manager");
- let creds =
- match ops.flags.sm_credentials with
- | None ->
- error (f_"subscription-manager credentials required for \
- --sm-register")
- | Some c -> c in
- let cmd = sprintf "subscription-manager register \
- --username=%s --password=%s"
- (quote creds.Subscription_manager.sm_username)
- (quote creds.Subscription_manager.sm_password) in
- do_run ~display:"subscription-manager register"
- ~warn_failed_no_network:true cmd
-
- | `SMRemove ->
- message (f_"Removing all the subscriptions");
- let cmd = "subscription-manager remove --all" in
- do_run ~display:cmd ~warn_failed_no_network:true cmd
-
- | `SMUnregister ->
- message (f_"Unregistering with subscription-manager");
- let cmd = "subscription-manager unregister" in
- do_run ~display:cmd ~warn_failed_no_network:true cmd
-
| `SSHInject (user, selector) ->
if unix_like (g#inspect_get_type root) then (
message (f_"SSH key inject: %s") user;
diff --git a/common/mlcustomize/subscription_manager.ml b/common/mlcustomize/subscription_manager.ml
deleted file mode 100644
index 104602462..000000000
--- a/common/mlcustomize/subscription_manager.ml
+++ /dev/null
@@ -1,54 +0,0 @@
-(* virt-customize
- * Copyright (C) 2015 Red Hat Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *)
-
-open Std_utils
-open Tools_utils
-open Common_gettext.Gettext
-
-type sm_credentials = {
- sm_username : string;
- sm_password : string;
-}
-
-type sm_pool =
-| PoolAuto
-| PoolId of string
-
-let rec parse_credentials_selector arg =
- parse_credentials_selector_list arg (String.nsplit ":" arg)
-
-and parse_credentials_selector_list orig_arg = function
- | [ username; "password"; password ] ->
- { sm_username = username; sm_password = password }
- | [ username; "file"; filename ] ->
- { sm_username = username; sm_password = read_first_line_from_file filename }
- | _ ->
- error (f_"invalid sm-credentials selector %s; see the man page") orig_arg
-
-let rec parse_pool_selector arg =
- parse_pool_selector_list arg (String.nsplit ":" arg)
-
-and parse_pool_selector_list orig_arg = function
- | [ "auto" ] ->
- PoolAuto
- | [ "pool"; pool ] ->
- PoolId pool
- | [ "file"; filename ] ->
- PoolId (read_first_line_from_file filename)
- | _ ->
- error (f_"invalid sm-attach selector %s; see the man page") orig_arg
diff --git a/common/mlcustomize/subscription_manager.mli b/common/mlcustomize/subscription_manager.mli
deleted file mode 100644
index bb6b92014..000000000
--- a/common/mlcustomize/subscription_manager.mli
+++ /dev/null
@@ -1,34 +0,0 @@
-(* virt-customize
- * Copyright (C) 2015 Red Hat Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *)
-
-type sm_credentials = {
- sm_username : string;
- sm_password : string;
-}
-
-type sm_pool =
-| PoolAuto (** Automatic entitlements. *)
-| PoolId of string (** Specific pool. *)
-
-val parse_credentials_selector : string -> sm_credentials
-(** Parse the selector field in --sm-credentials. Exits if the format
- is not valid. *)
-
-val parse_pool_selector : string -> sm_pool
-(** Parse the selector field in --sm-attach. Exits if the format
- is not valid. *)
diff --git a/common/mlcustomize/v2v-customize-options.pod b/common/mlcustomize/v2v-customize-options.pod
index 0974f4592..f02f05dac 100644
--- a/common/mlcustomize/v2v-customize-options.pod
+++ b/common/mlcustomize/v2v-customize-options.pod
@@ -338,35 +338,6 @@ It cannot delete directories, only regular files.
This is a compatibility option that does nothing.
-=item B<--sm-attach> SELECTOR
-
-Attach to a pool using C<subscription-manager>.
-
-See L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of
-the C<SELECTOR> field.
-
-=item B<--sm-credentials> SELECTOR
-
-Set the credentials for C<subscription-manager>.
-
-See L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of
-the C<SELECTOR> field.
-
-=item B<--sm-register>
-
-Register the guest using C<subscription-manager>.
-
-This requires credentials being set using I<--sm-credentials>.
-
-=item B<--sm-remove>
-
-Remove all the subscriptions from the guest using
-C<subscription-manager>.
-
-=item B<--sm-unregister>
-
-Unregister the guest using C<subscription-manager>.
-
=item B<--ssh-inject> USER[:SELECTOR]
Inject an ssh key so the given C<USER> will be able to log in over
diff --git a/common/mlcustomize/v2v-customize-synopsis.pod b/common/mlcustomize/v2v-customize-synopsis.pod
index 7eb0a941c..4c1a1547b 100644
--- a/common/mlcustomize/v2v-customize-synopsis.pod
+++ b/common/mlcustomize/v2v-customize-synopsis.pod
@@ -7,11 +7,9 @@
[--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]
+ [--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]
+ [--selinux-relabel]

View File

@ -0,0 +1,150 @@
From de70086dbe2eb8a6ec023ebbd0c84489a8719ba1 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Tue, 14 Oct 2025 14:16:19 -0400
Subject: [PATCH] pod: Document removal of --sm-* options
Update podcheck.pl to allow for still documenting these
in virt-builder.pod
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 7bad703d724cd976cc3b7760b09af353aab46ff0)
---
builder/virt-builder.pod | 73 +++++++++++++-----------------------
customize/virt-customize.pod | 8 ++++
podcheck.pl | 13 ++++++-
3 files changed, 46 insertions(+), 48 deletions(-)
diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod
index ff0ec250c..f043939ca 100644
--- a/builder/virt-builder.pod
+++ b/builder/virt-builder.pod
@@ -878,53 +878,6 @@ F<C:\Program Files\Guestfs\Firstboot\log.txt>.
=back
-=head2 SUBSCRIPTION-MANAGER
-
-It is possible to automate the registration and attaching of the
-system using C<subscription-manager>. This is typical on
-Red Hat Enterprise Linux guests. There are few options which ease
-this process, avoid executing commands manually and exposing
-passwords on command line.
-
-I<--sm-register> starts the registration process, and requires
-I<--sm-credentials> to be specified; the format of the C<SELECTOR>
-of I<--sm-credentials> is one of the following formats:
-
-=over 4
-
-=item B<--sm-credentials> USER:file:FILENAME
-
-Read the password for the specified C<USER> from F<FILENAME>.
-
-=item B<--sm-credentials> USER:password:PASSWORD
-
-Use the literal string C<PASSWORD> for the specified C<USER>.
-
-=back
-
-I<--sm-attach> attaches the system to subscriptions; the format
-of its C<SELECTOR> is one of the following:
-
-=over 4
-
-=item B<--sm-attach> auto
-
-C<subscription-manager> attaches to the best-fitting subscriptions
-for the system.
-
-=item B<--sm-attach> file:FILENAME
-
-Read the pool ID from F<FILENAME>.
-
-=item B<--sm-attach> pool:POOL
-
-Use the literal string C<POOL> as pool ID.
-
-=back
-
-I<--sm-remove> removes all the subscriptions from the guest, while
-I<--sm-unregister> completely unregister the system.
-
=head2 INSTALLATION PROCESS
When you invoke virt-builder, installation proceeds as follows:
@@ -1764,6 +1717,32 @@ them, which is normal and harmless.
=back
+=head2 DEPRECATED OPTIONS
+
+In version 1.56 the subscription-manager options were removed.
+
+=over 4
+
+=item B<--sm-credentials>
+
+=item B<--sm-register>
+
+Use --run='subscription-manager register --username=USER --password=PASS'
+
+=item B<--sm-unregister>
+
+Use --run='subscription-manager unregister'
+
+=item B<--sm-attach>
+
+Use --run='subscription-manager attach ...'
+
+=item B<--sm-remove>
+
+Use --run='subscription-manager remove --all'
+
+=back
+
=head1 MACHINE READABLE OUTPUT
The I<--machine-readable> option can be used to make the output more
diff --git a/customize/virt-customize.pod b/customize/virt-customize.pod
index fb3d65665..9fee64ebc 100644
--- a/customize/virt-customize.pod
+++ b/customize/virt-customize.pod
@@ -248,6 +248,14 @@ existing ones.
For further details, see L<virt-builder(1)/SELINUX>.
+=head1 DEPRECATED OPTIONS
+
+In version 1.56 the subscription-manager options were removed:
+B<--sm-credentials>, B<--sm-register>, B<--sm-unregister>,
+B<--sm-attach>, B<--sm-remove>
+
+For further details, see L<virt-builder(1)/DEPRECATED OPTIONS>.
+
=head1 EXIT STATUS
This program returns 0 on success, or 1 if there was an error.
diff --git a/podcheck.pl b/podcheck.pl
index 795fe0e9b..047bbf8da 100755
--- a/podcheck.pl
+++ b/podcheck.pl
@@ -203,7 +203,18 @@ my $pod_options_checked = 0;
my %pod_options = ();
$pod_options{$_} = 1 foreach ( $content =~ /^=item.*B<(-[-\w]+)(?:=.*)?>/gm );
-foreach (sort keys %pod_options) {
+
+my %pod_option_exists = ();
+$pod_option_exists{$_} = 1 foreach keys %pod_options;
+
+# Removed from the tool but we still document them
+delete $pod_option_exists{"--sm-credentials"};
+delete $pod_option_exists{"--sm-register"};
+delete $pod_option_exists{"--sm-unregister"};
+delete $pod_option_exists{"--sm-remove"};
+delete $pod_option_exists{"--sm-attach"};
+
+foreach (sort keys %pod_option_exists) {
unless ($ignore{$_}) {
$pod_options_checked++;
unless (exists $tool_option_exists{$_}) {

View File

@ -0,0 +1,31 @@
From 269302e1a500d3cba94194faa258f6b47fef88fb Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 4 Nov 2025 13:04:12 +0000
Subject: [PATCH] test-data/phony-guests: Increase size of Windows image
For testing I tried to upload a very large Windows registry to the
phony Windows image. However because of the 256M limit on the size of
the second partition (and NTFS overhead?) this was not possible.
There's no real penalty to increasing the size of this image since
it's just virtual space, so increase the virtual size to 2G (256M/1.7G
split).
(cherry picked from commit a39ae0b898825970549876738bd465f6a110de7c)
---
test-data/phony-guests/make-windows-img.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh
index 0ec6b4851..e72013c3d 100755
--- a/test-data/phony-guests/make-windows-img.sh
+++ b/test-data/phony-guests/make-windows-img.sh
@@ -37,7 +37,7 @@ fi
# Create a disk image.
guestfish <<EOF
-sparse windows.img-t 512M
+sparse windows.img-t 2G
run
# Format the disk.

View File

@ -0,0 +1,72 @@
From 63df59b34bb0a19f6b1e2821250106691d1945a9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 3 Nov 2025 15:26:19 +0000
Subject: [PATCH] inspector: Add new <class> field to output of virt-inspector
Rebase common submodule to pick up:
Richard W.M. Jones (1):
structs/structs-print.c: Update this generated file
Fixes: https://issues.redhat.com/browse/RHEL-125955
(cherry picked from commit 53e59d0189dc71d78559478c4924f1a1a994c455)
---
common | 2 +-
inspector/inspector.c | 2 ++
inspector/virt-inspector.rng | 1 +
m4/guestfs-libraries.m4 | 3 ++-
4 files changed, 6 insertions(+), 2 deletions(-)
Submodule common 90399dd18..b54ba2031:
diff --git a/common/structs/structs-print.c b/common/structs/structs-print.c
index bfe007cde..8c376b0ee 100644
--- a/common/structs/structs-print.c
+++ b/common/structs/structs-print.c
@@ -63,7 +63,7 @@ guestfs_int_print_application2_indent (struct guestfs_application2 *application2
fprintf (dest, "%sapp2_source_package: %s%s", indent, application2->app2_source_package, linesep);
fprintf (dest, "%sapp2_summary: %s%s", indent, application2->app2_summary, linesep);
fprintf (dest, "%sapp2_description: %s%s", indent, application2->app2_description, linesep);
- fprintf (dest, "%sapp2_spare1: %s%s", indent, application2->app2_spare1, linesep);
+ fprintf (dest, "%sapp2_class: %s%s", indent, application2->app2_class, linesep);
fprintf (dest, "%sapp2_spare2: %s%s", indent, application2->app2_spare2, linesep);
fprintf (dest, "%sapp2_spare3: %s%s", indent, application2->app2_spare3, linesep);
fprintf (dest, "%sapp2_spare4: %s%s", indent, application2->app2_spare4, linesep);
diff --git a/inspector/inspector.c b/inspector/inspector.c
index 1177f44a4..cccc209d0 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -697,6 +697,8 @@ output_applications (xmlTextWriterPtr xo, char *root)
single_element ("summary", apps->val[i].app2_summary);
if (apps->val[i].app2_description && apps->val[i].app2_description[0])
single_element ("description", apps->val[i].app2_description);
+ if (apps->val[i].app2_class && apps->val[i].app2_class[0])
+ single_element ("class", apps->val[i].app2_class);
} end_element ();
}
} end_element ();
diff --git a/inspector/virt-inspector.rng b/inspector/virt-inspector.rng
index 29c5798e1..e30686d4f 100644
--- a/inspector/virt-inspector.rng
+++ b/inspector/virt-inspector.rng
@@ -212,6 +212,7 @@
<optional><element name="source_package"><text/></element></optional>
<optional><element name="summary"><text/></element></optional>
<optional><element name="description"><text/></element></optional>
+ <optional><element name="class"><text/></element></optional>
</element>
</zeroOrMore>
</element>
diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4
index 82e62d54f..4ca86161c 100644
--- a/m4/guestfs-libraries.m4
+++ b/m4/guestfs-libraries.m4
@@ -20,7 +20,8 @@ dnl Any C libraries required by the libguestfs C library (not the daemon).
dnl Of course we need libguestfs.
dnl
dnl We need libguestfs 1.57.1 for guestfs_setfiles.
-PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.57.1])
+dnl We need libguestfs 1.57.6 for guestfs_inspect_get_applications2 app2_class.
+PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.57.6])
printf "libguestfs version is "; $PKG_CONFIG --modversion libguestfs
dnl Test if it's GNU or XSI strerror_r.

View File

@ -0,0 +1,52 @@
From c715ed2a3b82ce6cfcd44fbb8a29476621ebe049 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 3 Nov 2025 15:56:56 +0000
Subject: [PATCH] inspector: Add <windows_group_policy/> is Windows GPOs
detected in guest
Fixes: https://issues.redhat.com/browse/RHEL-125955
(cherry picked from commit d56129cfccedd26739ee5b813060e7547d977c53)
---
inspector/inspector.c | 3 +++
inspector/virt-inspector.rng | 1 +
m4/guestfs-libraries.m4 | 1 +
3 files changed, 5 insertions(+)
diff --git a/inspector/inspector.c b/inspector/inspector.c
index cccc209d0..6b5d50157 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -439,6 +439,9 @@ output_root (xmlTextWriterPtr xo, char *root)
if (str)
single_element ("windows_current_control_set", str);
free (str);
+ i = guestfs_inspect_get_windows_group_policy (g, root);
+ if (i > 0)
+ empty_element ("windows_group_policy");
guestfs_pop_error_handler (g);
str = guestfs_inspect_get_hostname (g, root);
diff --git a/inspector/virt-inspector.rng b/inspector/virt-inspector.rng
index e30686d4f..90f74cf78 100644
--- a/inspector/virt-inspector.rng
+++ b/inspector/virt-inspector.rng
@@ -35,6 +35,7 @@
<element name="minor_version"><text/></element>
<optional><element name="windows_systemroot"><text/></element></optional>
<optional><element name="windows_current_control_set"><text/></element></optional>
+ <optional><element name="windows_group_policy"><empty/></element></optional>
<optional><ref name="ospackageformat"/></optional>
<optional><ref name="ospackagemanagement"/></optional>
<optional><element name="hostname"><text/></element></optional>
diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4
index 4ca86161c..02f2281f8 100644
--- a/m4/guestfs-libraries.m4
+++ b/m4/guestfs-libraries.m4
@@ -21,6 +21,7 @@ dnl Of course we need libguestfs.
dnl
dnl We need libguestfs 1.57.1 for guestfs_setfiles.
dnl We need libguestfs 1.57.6 for guestfs_inspect_get_applications2 app2_class.
+dnl We need libguestfs 1.57.6 for guestfs_inspect_get_windows_group_policy
PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.57.6])
printf "libguestfs version is "; $PKG_CONFIG --modversion libguestfs

View File

@ -1,4 +1,4 @@
From 1107ededf2cad9982befb4d4b90353117b29d474 Mon Sep 17 00:00:00 2001
From 185264d510814eb1e14c770aa826c82d6a747bb3 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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 e72013c3d..ac661f180 100755
--- a/test-data/phony-guests/make-windows-img.sh
+++ b/test-data/phony-guests/make-windows-img.sh
@@ -37,6 +37,7 @@ fi
@ -19,6 +19,6 @@ index 16debd129..1c13ddac3 100755
# Create a disk image.
guestfish <<EOF
+set-program virt-testing
sparse windows.img-t 512M
sparse windows.img-t 2G
run

View File

@ -1,4 +1,4 @@
From 517a2ad502fa3773db50e883c0bece69b03b31ca Mon Sep 17 00:00:00 2001
From b8b3b8b6dbcb5b9ccc382b8a4b779104a4e86b87 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 21 Nov 2022 13:03:22 +0000
Subject: [PATCH] RHEL: builder: Disable opensuse repository

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# guestfs-tools
The guestfs-tools package

View File

@ -1,254 +0,0 @@
From 1cb20d561c6b2e93980ba9c7c7269b32f6d768eb Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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<virt-builder(1)/INSTALLING PACKAGES>.
Set the hostname of the guest to C<HOSTNAME>. You can use a
dotted hostname.domainname (FQDN) if you want.
+=item B<--inject-blnsvr> METHOD
+
+Inject the Balloon Server (F<blnsvr.exe>) 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<virt-v2v(1)> 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<HOSTNAME>. 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<blnsvr.exe>) 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<virt-v2v(1)> 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 -> ()

View File

@ -1,33 +0,0 @@
From 9cdb27fb0fde8b2eb57453480c4fed4746414aeb Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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])

View File

@ -1,267 +0,0 @@
From 02a911960b5916df93bf896afc94c8d250797f17 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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 <caml/memory.h>
#include <caml/mlvalues.h>
-#include <jansson.h>
+#include <json.h>
#include <stdio.h>
#include <string.h>
@@ -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

View File

@ -1,27 +0,0 @@
From 5879249a32d50ab746f515abc2679b91f64a2098 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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])

View File

@ -1,151 +0,0 @@
From 065f95e7afa45bf465e8799baa11c019f9403bd6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 19 Feb 2025 15:15:30 +0000
Subject: [PATCH] test-data: phony fedora: Add simple static /bin/sh
This is able to do enough to run commands via g#sh and related calls
inside the phony Fedora image.
(cherry picked from commit 4c5854f54e1da0d96807acb1b047bbf34694a0bb)
---
cat/test-virt-ls.sh | 1 +
test-data/phony-guests/fedora.c | 76 +++++++++++++++++++++--
test-data/phony-guests/make-fedora-img.pl | 6 +-
3 files changed, 76 insertions(+), 7 deletions(-)
diff --git a/cat/test-virt-ls.sh b/cat/test-virt-ls.sh
index e98faa42b..577a44860 100755
--- a/cat/test-virt-ls.sh
+++ b/cat/test-virt-ls.sh
@@ -24,6 +24,7 @@ skip_if_skipped
# Read out the test directory using virt-ls.
if [ "$($VG virt-ls --format=raw -a ../test-data/phony-guests/fedora.img /bin)" != "ls
rpm
+sh
test1
test2
test3
diff --git a/test-data/phony-guests/fedora.c b/test-data/phony-guests/fedora.c
index c57fa57cc..df097e9e6 100644
--- a/test-data/phony-guests/fedora.c
+++ b/test-data/phony-guests/fedora.c
@@ -16,13 +16,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/* This is "just enough" of a binary to look like RPM and dracut, as
- * far as virt-v2v is concerned.
+/* This is "just enough" of a binary to look like /bin/sh, RPM and
+ * dracut, as far as virt-v2v is concerned.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
/* NB: This is also defined in make-fedora-img.pl */
#define KVER "5.19.0-0.rc1.14.fc37.x86_64"
@@ -34,6 +35,27 @@ get_basename (const char *str)
return ret == NULL ? str : ret + 1;
}
+static void
+add_str (char ***argv, size_t *argc, char *str)
+{
+ (*argc)++;
+ (*argv) = realloc (*argv, *argc * sizeof (char *));
+ (*argv)[*argc-1] = str;
+}
+
+static void
+add_null (char ***argv, size_t *argc)
+{
+ add_str (argv, argc, NULL);
+}
+
+static void
+add (char ***argv, size_t *argc, const char *s, size_t len)
+{
+ char *copy = strndup (s, len);
+ add_str (argv, argc, copy);
+}
+
int
main (int argc, char *argv[])
{
@@ -57,10 +79,54 @@ main (int argc, char *argv[])
strcmp (get_basename (argv[0]), "dracut") == 0) {
// do nothing, pretend to rebuild the initramfs
}
+ else if (argc == 3 &&
+ strcmp (get_basename (argv[0]), "sh") == 0 &&
+ strcmp (argv[1], "-c") == 0) {
+ /* Split the command and execute it. Only handles trivial cases. */
+ char *cmd = argv[2];
+ char **cmdv = NULL;
+ size_t i, cmdvlen = 0, n;
+ const size_t len = strlen (cmd);
+
+ for (i = 0; i < len;) {
+ switch (cmd[i]) {
+ case ' ': case '\t':
+ i++;
+ continue;
+
+ case '"':
+ n = strcspn (&cmd[i+1], "\"");
+ add (&cmdv, &cmdvlen, &cmd[i+1], n);
+ i += n+2;
+ break;
+
+ case '\'':
+ n = strcspn (&cmd[i+1], "'");
+ add (&cmdv, &cmdvlen, &cmd[i+1], n);
+ i += n+2;
+ break;
+
+ default:
+ n = strcspn (&cmd[i], " \t");
+ add (&cmdv, &cmdvlen, &cmd[i], n);
+ i += n;
+ }
+ }
+ add_null (&cmdv, &cmdvlen);
+
+ execvp (cmdv[0], cmdv);
+ perror (cmdv[0]);
+ exit (EXIT_FAILURE);
+ }
else {
- fprintf (stderr, "phony Fedora: unknown command\n");
- exit (1);
+ int i;
+
+ fprintf (stderr, "ERROR: test-data/phony-guests/fedora.c: "
+ "unexpected command:\n");
+ for (i = 0; i < argc; ++i)
+ fprintf (stderr, "argv[%d] = %s\n", i, argv[i]);
+ exit (EXIT_FAILURE);
}
- exit (0);
+ exit (EXIT_SUCCESS);
}
diff --git a/test-data/phony-guests/make-fedora-img.pl b/test-data/phony-guests/make-fedora-img.pl
index 0de506324..fef8ce032 100755
--- a/test-data/phony-guests/make-fedora-img.pl
+++ b/test-data/phony-guests/make-fedora-img.pl
@@ -369,8 +369,10 @@ $g->ln_s ('/bin/test1', '/bin/test5');
$g->mkfifo (0777, '/bin/test6');
$g->mknod (0777, 10, 10, '/bin/test7');
-# Virt-v2v needs an RPM command, or at least something which acts
-# similarly, and also a dracut command.
+# Virt-v2v needs a /bin/sh, an RPM command and a dracut command, or at
+# least something which acts similarly to those.
+$g->upload ('fedora-static-bin', '/bin/sh');
+$g->chmod (0777, '/bin/sh');
$g->upload ('fedora-static-bin', '/bin/rpm');
$g->chmod (0777, '/bin/rpm');
$g->upload ('fedora-static-bin', '/sbin/dracut');

View File

@ -1,343 +0,0 @@
From 777f3ac82c20469c9e438b9fd88a57007fd2c2bb Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 19 Feb 2025 14:16:13 +0000
Subject: [PATCH] drivers: Handle large output from 'rpm -ql' command
This requires the new guestfs_sh_out API from libguestfs 1.55.6.
Update common submodule to include:
Richard W.M. Jones (3):
mlstdutils: Reimplement String.find, add String.find_from
mlstdutils: Reimplement String.nsplit tail recursively
mldrivers: Handle large output from 'rpm -ql' command
Fixes: https://issues.redhat.com/browse/RHEL-80214
Reported-by: Nijin Ashok
(cherry picked from commit 5520f1cfae55377c2fe1db3f2974f6006822e0ea)
---
common | 2 +-
m4/guestfs-libraries.m4 | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
Submodule common 766384a45..ee88791e1:
diff --git a/common/mldrivers/linux.ml b/common/mldrivers/linux.ml
index 4e30a8e1f..0dec15495 100644
--- a/common/mldrivers/linux.ml
+++ b/common/mldrivers/linux.ml
@@ -58,76 +58,84 @@ and do_remove g root packages =
let file_list_of_package (g : Guestfs.guestfs) root app =
let package_format = g#inspect_get_package_format root in
- match package_format with
- | "deb" ->
- let cmd = [| "dpkg"; "-L"; app.G.app2_name |] in
- debug "%s" (String.concat " " (Array.to_list cmd));
- let files = g#command_lines cmd in
- let files = Array.to_list files in
+
+ let cmd =
+ match package_format with
+ | "deb" -> sprintf "dpkg -L %s" (quote app.G.app2_name)
+
+ | "rpm" ->
+ (* Since RPM allows multiple packages installed with the same
+ * name, always check the full NEVR here (RHBZ#1161250).
+ *
+ * In RPM < 4.11 query commands that use the epoch number in the
+ * package name did not work.
+ *
+ * For example:
+ * RHEL 6 (rpm 4.8.0):
+ * $ rpm -q tar-2:1.23-11.el6.x86_64
+ * package tar-2:1.23-11.el6.x86_64 is not installed
+ * Fedora 20 (rpm 4.11.2):
+ * $ rpm -q tar-2:1.26-30.fc20.x86_64
+ * tar-1.26-30.fc20.x86_64
+ *)
+ let is_rpm_lt_4_11 () =
+ let ver =
+ try
+ (* Since we're going to run 'rpm' below anyway, seems safe
+ * to run it here and assume the binary works.
+ *)
+ let cmd = [| "rpm"; "--version" |] in
+ debug "%s" (String.concat " " (Array.to_list cmd));
+ let ver = g#command_lines cmd in
+ let ver =
+ if Array.length ver > 0 then ver.(0) else raise Not_found in
+ debug "%s" ver;
+ let ver = String.nsplit " " ver in
+ let ver =
+ match ver with
+ | [ "RPM"; "version"; ver ] -> ver
+ | _ -> raise Not_found in
+ if not (PCRE.matches re_version ver) then raise Not_found;
+ (int_of_string (PCRE.sub 1), int_of_string (PCRE.sub 2))
+ with Not_found ->
+ (* 'rpm' not installed? Hmm... *)
+ (0, 0) in
+ ver < (4, 11)
+ in
+ let pkg_name =
+ if app.G.app2_epoch = Int32.zero || is_rpm_lt_4_11 () then
+ sprintf "%s-%s-%s" app.G.app2_name app.G.app2_version
+ app.G.app2_release
+ else
+ sprintf "%s-%ld:%s-%s" app.G.app2_name app.G.app2_epoch
+ app.G.app2_version app.G.app2_release in
+ sprintf "rpm -ql %s" (quote pkg_name)
+
+ | format ->
+ error (f_"dont know how to get list of files from package using %s")
+ format in
+
+ debug "file_list_of_package: running: %s" cmd;
+
+ (* Some packages have a lot of files, too many to list without
+ * breaking the maximum message size assumption in libguestfs.
+ * To cope with this, use guestfs_sh_out, added in 1.55.6.
+ * https://issues.redhat.com/browse/RHEL-80080
+ *)
+ let tmpfile = Filename.temp_file "v2vcmd" ".out" in
+ On_exit.unlink tmpfile;
+ g#sh_out cmd tmpfile;
+ let files = read_whole_file tmpfile in
+
+ (* RPM prints "(contains no files)" on stdout when a package
+ * has no files in it:
+ * https://github.com/rpm-software-management/rpm/issues/962
+ *)
+ if String.is_prefix files "(contains no files)" then []
+ else (
+ let files = String.nsplit "\n" files in
List.sort compare files
-
- | "rpm" ->
- (* Since RPM allows multiple packages installed with the same
- * name, always check the full NEVR here (RHBZ#1161250).
- *
- * In RPM < 4.11 query commands that use the epoch number in the
- * package name did not work.
- *
- * For example:
- * RHEL 6 (rpm 4.8.0):
- * $ rpm -q tar-2:1.23-11.el6.x86_64
- * package tar-2:1.23-11.el6.x86_64 is not installed
- * Fedora 20 (rpm 4.11.2):
- * $ rpm -q tar-2:1.26-30.fc20.x86_64
- * tar-1.26-30.fc20.x86_64
- *)
- let is_rpm_lt_4_11 () =
- let ver =
- try
- (* Since we're going to run 'rpm' below anyway, seems safe
- * to run it here and assume the binary works.
- *)
- let cmd = [| "rpm"; "--version" |] in
- debug "%s" (String.concat " " (Array.to_list cmd));
- let ver = g#command_lines cmd in
- let ver = if Array.length ver > 0 then ver.(0) else raise Not_found in
- debug "%s" ver;
- let ver = String.nsplit " " ver in
- let ver =
- match ver with
- | [ "RPM"; "version"; ver ] -> ver
- | _ -> raise Not_found in
- if not (PCRE.matches re_version ver) then raise Not_found;
- (int_of_string (PCRE.sub 1), int_of_string (PCRE.sub 2))
- with Not_found ->
- (* 'rpm' not installed? Hmm... *)
- (0, 0) in
- ver < (4, 11)
- in
- let pkg_name =
- if app.G.app2_epoch = Int32.zero || is_rpm_lt_4_11 () then
- sprintf "%s-%s-%s" app.G.app2_name app.G.app2_version
- app.G.app2_release
- else
- sprintf "%s-%ld:%s-%s" app.G.app2_name app.G.app2_epoch
- app.G.app2_version app.G.app2_release in
- let cmd = [| "rpm"; "-ql"; pkg_name |] in
- debug "%s" (String.concat " " (Array.to_list cmd));
- let files = g#command_lines cmd in
- (* RPM prints "(contains no files)" on stdout when a package
- * has no files in it:
- * https://github.com/rpm-software-management/rpm/issues/962
- *)
- if files = [| "(contains no files)" |] then
- []
- else (
- let files = Array.to_list files in
- List.sort compare files
- )
-
- | format ->
- error (f_"dont know how to get list of files from package using %s")
- format
+ )
let is_file_owned (g : G.guestfs) root path =
let package_format = g#inspect_get_package_format root in
diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml
index 86b21a7c5..1a36ab772 100644
--- a/common/mlstdutils/std_utils.ml
+++ b/common/mlstdutils/std_utils.ml
@@ -98,24 +98,27 @@ module String = struct
and len = length str in
len >= sufflen && sub str (len - sufflen) sufflen = suffix
- let rec find s sub =
- let len = length s in
+ let find_from str pos sub =
let sublen = length sub in
- let rec loop i =
- if i <= len-sublen then (
- let rec loop2 j =
- if j < sublen then (
- if s.[i+j] = sub.[j] then loop2 (j+1)
- else -1
- ) else
- i (* found *)
- in
- let r = loop2 0 in
- if r = -1 then loop (i+1) else r
- ) else
- -1 (* not found *)
- in
- loop 0
+ if sublen = 0 then
+ 0
+ else (
+ let found = ref 0 in
+ let len = length str in
+ try
+ for i = pos to len - sublen do
+ let j = ref 0 in
+ while unsafe_get str (i + !j) = unsafe_get sub !j do
+ incr j;
+ if !j = sublen then begin found := i; raise Exit; end;
+ done;
+ done;
+ -1
+ with
+ Exit -> !found
+ )
+
+ let find str sub = find_from str 0 sub
let rec replace s s1 s2 =
let len = length s in
@@ -145,7 +148,7 @@ module String = struct
else if n >= len then str, ""
else sub str 0 n, sub str n (len-n)
- let rec split sep str =
+ let split sep str =
let seplen = length sep in
let strlen = length str in
let i = find str sep in
@@ -154,20 +157,36 @@ module String = struct
sub str 0 i, sub str (i + seplen) (strlen - i - seplen)
)
- and nsplit ?(max = 0) sep str =
+ let nsplit ?(max = 0) sep str =
if max < 0 then
invalid_arg "String.nsplit: max parameter should not be negative";
- (* If we reached the limit, OR if the pattern does not match the string
- * at all, return the rest of the string as a single element list.
- *)
- if max = 1 || find str sep = -1 then
- [str]
- else (
- let s1, s2 = split sep str in
- let max = if max = 0 then 0 else max - 1 in
- s1 :: nsplit ~max sep s2
- )
+ let len = String.length str in
+ let seplen = String.length sep in
+
+ let rec loop iters posn acc =
+ (* If we reached the limit, OR if the pattern does not match
+ * the string at all, return the rest of the string.
+ *)
+ if max > 0 && iters = max then (
+ let rest =
+ if posn = 0 then str else String.sub str posn (len-posn) in
+ List.rev (rest :: acc)
+ )
+ else (
+ let end_ = find_from str posn sep in
+ if end_ = -1 then (
+ let rest =
+ if posn = 0 then str else String.sub str posn (len-posn) in
+ List.rev (rest :: acc)
+ )
+ else (
+ let acc = String.sub str posn (end_-posn) :: acc in
+ loop (iters+1) (end_+seplen) acc
+ )
+ )
+ in
+ loop 1 0 []
let rec lines_split str =
let buf = Buffer.create 16 in
diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli
index a39ac5f3b..7bd55fbae 100644
--- a/common/mlstdutils/std_utils.mli
+++ b/common/mlstdutils/std_utils.mli
@@ -82,6 +82,10 @@ module String : sig
val find : string -> string -> int
(** [find str sub] searches for [sub] as a substring of [str]. If
found it returns the index. If not found, it returns [-1]. *)
+ val find_from : string -> int -> string -> int
+ (** [find_from str start sub] searches for [sub] as a substring of [str],
+ starting at index [start]. If found it returns the index.
+ If not found, it returns [-1]. *)
val replace : string -> string -> string -> string
(** [replace str s1 s2] replaces all instances of [s1] appearing in
[str] with [s2]. *)
diff --git a/common/mlstdutils/std_utils_tests.ml b/common/mlstdutils/std_utils_tests.ml
index 3f5bb1a86..4e368152f 100644
--- a/common/mlstdutils/std_utils_tests.ml
+++ b/common/mlstdutils/std_utils_tests.ml
@@ -113,13 +113,19 @@ let test_string_nsplit ctx =
assert_equal_stringlist [""] (String.nsplit " " "");
assert_equal_stringlist ["abc"] (String.nsplit " " "abc");
assert_equal_stringlist ["a"; "b"; "c"] (String.nsplit " " "a b c");
+ assert_equal_stringlist ["abc"; "d"; "e"] (String.nsplit " " "abc d e");
assert_equal_stringlist ["a"; "b"; "c"; ""] (String.nsplit " " "a b c ");
assert_equal_stringlist [""; "a"; "b"; "c"] (String.nsplit " " " a b c");
assert_equal_stringlist [""; "a"; "b"; "c"; ""] (String.nsplit " " " a b c ");
assert_equal_stringlist ["a b c d"] (String.nsplit ~max:1 " " "a b c d");
assert_equal_stringlist ["a"; "b c d"] (String.nsplit ~max:2 " " "a b c d");
assert_equal_stringlist ["a"; "b"; "c d"] (String.nsplit ~max:3 " " "a b c d");
- assert_equal_stringlist ["a"; "b"; "c"; "d"] (String.nsplit ~max:10 " " "a b c d")
+ assert_equal_stringlist ["a"; "b"; "c"; "d"] (String.nsplit ~max:10 " " "a b c d");
+
+ (* Test that nsplit can handle large strings. *)
+ let xs = Array.to_list (Array.make 10_000_000 "xyz") in
+ let xs_concat = String.concat " " xs in
+ assert_equal_stringlist xs (String.nsplit " " xs_concat)
(* Test Std_utils.String.lines_split. *)
let test_string_lines_split ctx =
diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4
index 80f9425f0..7c66853dd 100644
--- a/m4/guestfs-libraries.m4
+++ b/m4/guestfs-libraries.m4
@@ -19,9 +19,8 @@ dnl Any C libraries required by the libguestfs C library (not the daemon).
dnl Of course we need libguestfs.
dnl
-dnl We need libguestfs 1.49.8 for guestfs_inspect_get_build_id in
-dnl virt-drivers.
-PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.49.8])
+dnl We need libguestfs >= 1:1.54.0-4.el9_6 for guestfs_sh_out.
+PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.54.0])
dnl Test if it's GNU or XSI strerror_r.
AC_FUNC_STRERROR_R

View File

@ -1,33 +0,0 @@
From 28d6901c72cb956f1fb13c9b6dd50691f1ccfb49 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 11 Mar 2025 11:41:34 +0000
Subject: [PATCH] Update common submodule
Richard W.M. Jones (1):
mlcustomize: Remove dnf --verbose option
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2351282
Cherry picked from commit bb3d0e5bc5f08300ce36bcccf91d02d9d7f32343
and modified to only include dnf --verbose fix.
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common ee88791e1..31d279a79:
diff --git a/common/mlcustomize/guest_packages.ml b/common/mlcustomize/guest_packages.ml
index 2602fc718..96614b6cc 100644
--- a/common/mlcustomize/guest_packages.ml
+++ b/common/mlcustomize/guest_packages.ml
@@ -61,10 +61,7 @@ let install_command packages package_management =
apt-get $apt_opts update
apt-get $apt_opts install %s
" quoted_args
- | "dnf" ->
- sprintf "dnf%s -y install %s"
- (if verbose () then " --verbose" else "")
- quoted_args
+ | "dnf" -> sprintf "dnf -y install %s" quoted_args
| "pisi" -> sprintf "pisi it %s" quoted_args
| "pacman" -> sprintf "pacman -S --noconfirm %s" quoted_args
| "urpmi" -> sprintf "urpmi %s" quoted_args

View File

@ -1,51 +0,0 @@
From 6fc2e63a599311eeff6f02588b9a8f7851141483 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 15 Aug 2025 16:58:08 +0100
Subject: [PATCH] Update common submodule
Pick up the commit below, to ensure that the firstboot.bat file we
inject into Windows is the same as the one from virt-v2v.
commit b40e534fefb74af32bd496904e44ce9bca1a7b34
Author: Vadim Rozenfeld <vrozenfe@redhat.com>
Date: Thu Jul 10 10:48:04 2025 +1000
Modify the firstboot script to check the scripts
execution return status
Related: https://issues.redhat.com/browse/RHEL-100682
Signed-off-by: Vadim Rozenfeld <vrozenfe@redhat.com>
Fixes: https://issues.redhat.com/browse/RHEL-109521
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 31d279a79..6a822ba7b:
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 52e76401e..aa3ea98ad 100644
--- a/common/mlcustomize/firstboot.ml
+++ b/common/mlcustomize/firstboot.ml
@@ -305,13 +305,19 @@ if not exist \"%%scripts_done%%\" (
:: Pick the next script to run.
for %%%%f in (\"%%scripts%%\"\\*.bat) do (
echo running \"%%%%f\"
- move \"%%%%f\" \"%%scripts_done%%\"
- pushd \"%%scripts_done%%\"
+ pushd \"%%scripts%%\"
call \"%%%%~nf\"
set elvl=!errorlevel!
echo .... exit code !elvl!
popd
+ if !elvl! NEQ 249 (
+ echo Script succeeded, moving to scripts-done
+ move \"%%%%f\" \"%%scripts_done%%\"
+ ) else (
+ echo Script failed, will retry on next boot
+ )
+
:: Reboot the computer. This is necessary to free any locked
:: files which may prevent later scripts from running.
shutdown /r /t 0 /y

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmb+mWcRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKBPWRAAmHJHvz8GRAsFEpZS6/6FjgxjASRTtMZO
02vo8KZLpF3pX0zjsgcYPsTgj90kQ8z9rsdXk70HbOvnJIuVShuT9Q/bGiYf60YB
CEvRy3b5HMgsk4Dk46Ux0RpOHTFmVKOxSdNrk1G0qRMjIYdy19KxRnMJyQXv4QRg
y6RYOt2Zm6Luj53Id+zTLiqnz5Z8PBkupWH3y1zSrN3OcASIvSKYnPUA/c63+Fzk
YZHGIf3DCHEAnzHfPMaF58L+Np3ZaC4vGBfnDfLiyTd/d2J/Ci18LcI9hC9l6SV1
ePlNBH/LV1+YYuWLhd9XPVsCiKi2zY3/DMxoxZcYhl+JalVTeK6FZk2Abe+0c9XZ
wAaQG+aLqweDHNiLJ0AxoPqinWsa2EpciZMKAzzCGM83IABm+pKSZlN077riiYNa
YRZIw/i6LFfuQSxBaav+/d6cOpxx4AklmaV1ymu4Xr2JTm4u93O72722oyhCzbAn
3DQac1H5XgJsBh6Un9Ybl3PkUGS2AlCCDTFbyWDB8i9aiWv5m/yuLD4c6hk9sRWQ
DNiH0AKaem/cPt33FV3C2viyppmGnhZDNrrKKzJCxCkRY7XU2rzEJ1SmU9CACCOj
ick58Flv52CYSeonC+7uO9jqlDcgVmJIDitCCHhIl1Kipr1mzCMQV1Vq0LP3Hv8f
MSbFdmbrh5I=
=Gu1k
-----END PGP SIGNATURE-----

View File

@ -7,7 +7,7 @@ set -e
# ./copy-patches.sh
project=guestfs-tools
rhel_version=9.7
rhel_version=10.2
# Check we're in the right directory.
if [ ! -f $project.spec ]; then

6
gating.yaml Executable file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: xen-ci.brew-build.tier1.functional}

View File

@ -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: 6%{?dist}
Version: 1.54.0
Release: 7%{?dist}
License: GPL-2.0-or-later AND LGPL-2.0-or-later
# Build only for architectures that have a kernel
@ -45,29 +42,36 @@ Source2: libguestfs.keyring
Source3: copy-patches.sh
# Patches are maintained in the following repository:
# https://github.com/rwmjones/guestfs-tools/commits/rhel-9.7
# https://github.com/rwmjones/guestfs-tools/commits/rhel-10.2
# 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
Patch0007: 0007-test-data-phony-fedora-Add-simple-static-bin-sh.patch
Patch0008: 0008-drivers-Handle-large-output-from-rpm-ql-command.patch
Patch0009: 0009-Update-common-submodule.patch
Patch0010: 0010-builder-Update-link-to-templates-to-use-https.patch
Patch0011: 0011-Update-common-submodule.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool, gettext-devel
%endif
Patch0001: 0001-docs-Move-release-note-about-GNU-gettext-to-build-se.patch
Patch0002: 0002-builder-Update-link-to-templates-to-use-https.patch
Patch0003: 0003-builder-Replace-cpu-host-with-cpu-max-in-example.patch
Patch0004: 0004-customize-Fixes-for-selinux-relabelling-and-Windows-.patch
Patch0005: 0005-Update-common-submodule.patch
Patch0006: 0006-.gitignore-Ignore-.bak-files.patch
Patch0007: 0007-builder-sysprep-Use-quoted-string-literals-in-a-few-.patch
Patch0008: 0008-builder-templates-make-template.ml-Fix-quoting.patch
Patch0009: 0009-builder-templates-make-template.ml-Use-quoted-string.patch
Patch0010: 0010-builder-templates-make-template.ml-Add-str-and-unix-.patch
Patch0011: 0011-daemon-generator-Use-power-of-2-for-initial-size-of-.patch
Patch0012: 0012-builder-Build-fedora-42-template.patch
Patch0013: 0013-Update-common-submodule.patch
Patch0014: 0014-common-update-submodule.patch
Patch0015: 0015-pod-Document-removal-of-sm-options.patch
Patch0016: 0016-test-data-phony-guests-Increase-size-of-Windows-imag.patch
Patch0017: 0017-inspector-Add-new-class-field-to-output-of-virt-insp.patch
Patch0018: 0018-inspector-Add-windows_group_policy-is-Windows-GPOs-d.patch
Patch0019: 0019-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
Patch0020: 0020-RHEL-builder-Disable-opensuse-repository.patch
# Basic build requirements.
BuildRequires: autoconf, automake, libtool, gettext-devel
BuildRequires: gcc, gcc-c++
BuildRequires: make
BuildRequires: libguestfs-devel >= 1:1.54.0-4.el9
BuildRequires: glibc-utils
BuildRequires: libguestfs-devel >= 1:1.57.6-1
BuildRequires: libguestfs-xfs
BuildRequires: perl(Pod::Simple)
BuildRequires: perl(Pod::Man)
@ -85,12 +89,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
@ -115,9 +117,8 @@ BuildRequires: perl-generators
BuildRequires: gnupg2
%endif
# Ensure a minimum version of libguestfs is installed. This contains
# new APIs sh-out and command-out, required by virt-drivers.
Requires: libguestfs >= 1:1.54.0-4.el9
# Ensure a minimum version of libguestfs is installed.
Requires: libguestfs%{?_isa} >= 1:1.57.6-1
# For virt-builder:
Requires: curl
@ -262,13 +263,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
@ -416,102 +416,187 @@ end
%changelog
* Fri Aug 15 2025 Richard W.M. Jones <rjones@redhat.com> - 1.52.2-6
- Update guestfs-tools firstboot.bat to match virt-v2v
resolves: RHEL-109521
* Wed Nov 05 2025 Richard W.M. Jones <rjones@redhat.com> - 1.54.0-7
- Synchronize spec file with Fedora
- Fix pnputils after virt-customize --inject-virtio-win
resolves: RHEL-116537
- Unify spec files between Fedora and RHEL.
- Ensure a minimum version of libguestfs is installed at build and run time.
resolves: RHEL-116716
- Remove virt-customize subscription-manager options
resolves: RHEL-122307
- Add AV and GPOs to virt-inspector output
resolves: RHEL-125955
* Tue Jun 10 2025 Richard W.M. Jones <rjones@redhat.com> - 1.52.2-5
* Wed Aug 13 2025 Richard W.M. Jones <rjones@redhat.com> - 1.54.0-3
- 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
- builder: Update link to templates to use https
resolves: RHEL-94874
* Thu Mar 13 2025 Richard W.M. Jones <rjones@redhat.com> - 1.52.2-4
- mlcustomize: Remove dnf --verbose option
resolves: RHEL-83200
* Tue Feb 25 2025 Richard W.M. Jones <rjones@redhat.com> - 1.52.2-3
- Fix virt-drivers fails on opensuse guest if kernel-source is installed
resolves: RHEL-80214
resolves: RHEL-94873
- Fix SELinux relabelling in Linux split-/usr
resolves: RHEL-109129
* Wed Oct 30 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.2-2
- Rebase to guestfs-tools 1.52.2
resolves: RHEL-56811
resolves: RHEL-56812
- Replace Jansson with json-c
resolves: RHEL-65294
resolves: RHEL-65295
* Tue Aug 27 2024 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-5
* Tue Aug 27 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.1-1
- New stable version 1.52.1
- Rebase on top of patches from RHEL 9.5
- Reboot Windows between each firstboot script to improve reliability
resolves: RHEL-55759
* Thu May 16 2024 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-4
- Add support for nbd+unix:// URIs
resolves: RHEL-33956
resolves: RHEL-56319
- customize: Implement --inject-blnsvr operation
resolves: RHEL-36634
resolves: RHEL-56330
- Add support for nbd+unix:// URIs
resolves: RHEL-56332
* Fri Jan 19 2024 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-2
- Rebase to guestfs-tools 1.51.6
- Implement --key all:...
resolves: RHEL-19030
- Fix crash because of off-by-one error
resolves: RHEL-19062
- Fix virt-customize --chown invalid format
resolves: RHEL-21899
* Tue Jun 25 2024 Troy Dawson <tdawson@redhat.com> - 1.52.0-6
- Bump release for June 2024 mass rebuild
* Thu Jun 08 2023 Laszlo Ersek <lersek@redhat.com> - 1.50.1-3
- let virt-inspector recognize "--key /dev/mapper/VG-LV:key:password"
- reenable "make check"; we now use "-cpu max" (libguestfs 30f74f38bd6e)
resolves: rhbz#2209280
* Wed Jun 19 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.0-5
- OCaml 5.2.0 ppc64le fix
* Thu Apr 06 2023 Richard W.M. Jones <rjones@redhat.com> - 1.50.1-1
- Rebase to guestfs-tools 1.50.1
resolves: rhbz#2168626
- Fix virt-drivers inspection of RHEL 9.2 guests
resolves: rhbz#2184963
* Fri May 31 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.0-4
- Rebuild for OCaml 5.2
* Thu Nov 24 2022 Richard W.M. Jones <rjones@redhat.com> - 1.48.2-8
- Support Rocky Linux in virt-customize
resolves: rhbz#2133443
- Disable OpenSUSE repo in virt-builder
resolves: rhbz#2145160
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.52.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jul 15 2022 Richard W.M. Jones <rjones@redhat.com> - 1.48.2-5
- Rebase to guestfs-tools 1.48.2
resolves: rhbz#2059286
- Default to --selinux-relabel in various tools
resolves: rhbz#2075718, rhbz#2089748
- Add lvm system.devices cleanup operation to virt-sysprep
resolves: rhbz#2072493
- Refactor virt-customize --install, --update options in common submodule
- Add support for Clevis & Tang
resolves: rhbz#1809453
- Fix CVE-2022-2211 Denial of Service in --key parameter
resolves: rhbz#2102721
- Fix virt-sysprep and LUKS-on-LVM guests
resolves: rhbz#2106286
* Fri Jan 19 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.0-2
- Fix virt-customize --chown invalid format error
- New upstream github repository.
* Sat Dec 04 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-6
- Clean up NetworkManager connection files
- Add the copy-patches.sh script from virt-v2v
resolves: rhbz#1980922
* Thu Jan 4 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.0-1
- New stable version 1.52.0
* Tue Nov 23 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-5
- Fix detection of Kylin Desktop
resolves: rhbz#2025950
* Tue Dec 19 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.7-1
- New development version 1.51.7
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.46.1-4.1
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Mon Dec 18 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-5
- OCaml 5.1.1 + s390x code gen fix for Fedora 40
* Wed Jun 2 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-3.el9.1
* Tue Dec 12 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-4
- Bump release and rebuild
* Tue Dec 12 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-3
- OCaml 5.1.1 rebuild for Fedora 40
* Sat Dec 9 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-2
- New development version 1.51.6
* Mon Nov 27 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.5-2
- Fix build for libxml2 2.12.1
* Thu Nov 02 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.5-1
- New development version 1.51.5
* Thu Oct 05 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.4-2
- OCaml 5.1 rebuild for Fedora 40
* Thu Jul 20 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.4-1
- New development version 1.51.4
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.51.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri Jul 14 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.3-1
- New development version 1.51.3
* Mon Jun 05 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.2-2
- Migrated to SPDX license
* Thu Apr 06 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.2-1
- New development version 1.51.2
* Tue Feb 21 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.1-2
- Fix BR hwdata-devel for PCI IDs data
* Mon Feb 20 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.1-1
- New development version 1.51.1
- virt-drivers: Add BuildRequires and runtime Recommends on hwdata.
* Tue Feb 14 2023 Richard W.M. Jones <rjones@redhat.com> - 1.50.0-2
- Remove virt-dib (RHBZ#2169550)
* Tue Feb 07 2023 Richard W.M. Jones <rjones@redhat.com> - 1.50.0-1
- New upstream stable version 1.50.0
* Thu Jan 26 2023 Richard W.M. Jones <rjones@redhat.com> - 1.49.10-1
- New upstream development version 1.49.10
* Thu Jan 19 2023 Richard W.M. Jones <rjones@redhat.com> - 1.49.9-1
- New upstream development version 1.49.9
- New tool: virt-drivers
- Add BR glibc-static for tests on x86_64.
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.49.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Tue Jan 17 2023 Richard W.M. Jones <rjones@redhat.com> - 1.49.8-2
- New upstream development version 1.49.8
- +BR libosinfo-devel
* Sat Dec 10 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.7-2
- New upstream development version 1.49.7
* Fri Nov 25 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.6-1
- New upstream development version 1.49.6
- Enable opensuse repository again
* Mon Nov 21 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.5-2
- Disable opensuse repository
* Wed Oct 12 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.5-1
- New upstream development version 1.49.5
* Mon Aug 01 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.4-1
- New upstream development version 1.49.4
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.49.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Fri Jul 01 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.3-1
- New upstream development version 1.49.3
* Thu May 26 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.2-1
- New upstream development version 1.49.2
* Thu May 12 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.1-1
- New upstream development version 1.49.1
* Mon Mar 14 2022 Richard W.M. Jones <rjones@redhat.com> - 1.48.0-1
- New upstream stable branch version 1.48.0
* Tue Mar 08 2022 Richard W.M. Jones <rjones@redhat.com> - 1.47.5-1
- New upstream development version 1.47.8
- Add new guestfs-tools-release-notes-1.48(1) man page.
* Tue Mar 01 2022 Richard W.M. Jones <rjones@redhat.com> - 1.47.4-1
- New upstream development version 1.47.4
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.47.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Sat Dec 04 2021 Richard W.M. Jones <rjones@redhat.com> - 1.47.3-1
- New upstream development version 1.47.3
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.47.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jun 16 2021 Richard W.M. Jones <rjones@redhat.com> - 1.47.2-1
- New upstream development version 1.47.2
* Wed Jun 2 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-3
- Add gating tests (for RHEL 9)
* Mon May 17 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-3
- Fix virt-win-reg --version
resolves: rhbz#1961160
* Thu May 13 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-2
- BR perl-generators so deps of virt-win-reg subpackage are correct.
resolves: rhbz#1960191
* Sat May 08 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-1
- New stable branch version 1.46.1.

BIN
libguestfs.keyring Normal file

Binary file not shown.

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (guestfs-tools-1.54.0.tar.gz) = db76a1cbfaa8b53b5c4609030f545b9d043161cebf54379da6418800086855f11cb3a0e5d135184c2a885094a6a7120155774377a6641a2d7fbd45206ff9ec87
SHA512 (guestfs-tools-1.54.0.tar.gz.sig) = c503f858ba5c2f79814f1f896f41c0b7558cc55534d800bafc2992c929e9a709cb7ab043205a9f5efd2cd9bcbbe3a2273970e116f00ad6625cbb86adaa42accd