From 29134df4394981876f9cfaaa4b810f3777ac9026 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Fri, 25 Oct 2024 15:08:54 +0300 Subject: [PATCH] import guestfs-tools-1.52.2-1.el10 --- .gitignore | 2 + .guestfs-tools.metadata | 2 + ...of-libguestfs-winsupport-features-ex.patch | 24 + ...-builder-Disable-opensuse-repository.patch | 26 + ...ze-Implement-inject-blnsvr-operation.patch | 254 ++++++++ SOURCES/copy-patches.sh | 65 ++ SOURCES/guestfs-tools-1.52.2.tar.gz.sig | 17 + SPECS/guestfs-tools.spec | 600 ++++++++++++++++++ 8 files changed, 990 insertions(+) create mode 100644 .gitignore create mode 100644 .guestfs-tools.metadata create mode 100644 SOURCES/0001-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch create mode 100644 SOURCES/0002-RHEL-builder-Disable-opensuse-repository.patch create mode 100644 SOURCES/0003-customize-Implement-inject-blnsvr-operation.patch create mode 100755 SOURCES/copy-patches.sh create mode 100644 SOURCES/guestfs-tools-1.52.2.tar.gz.sig create mode 100644 SPECS/guestfs-tools.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..50d4b8f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/guestfs-tools-1.52.2.tar.gz +SOURCES/libguestfs.keyring diff --git a/.guestfs-tools.metadata b/.guestfs-tools.metadata new file mode 100644 index 0000000..f247829 --- /dev/null +++ b/.guestfs-tools.metadata @@ -0,0 +1,2 @@ +6eb02f4f70cb224548567ce7e4b67712c8ebb643 SOURCES/guestfs-tools-1.52.2.tar.gz +1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring diff --git a/SOURCES/0001-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch b/SOURCES/0001-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch new file mode 100644 index 0000000..e59d4e9 --- /dev/null +++ b/SOURCES/0001-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch @@ -0,0 +1,24 @@ +From dd696d00b4de2d255d66565b7207e04070656585 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 7 Jul 2015 09:28:03 -0400 +Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for + virt-* tools (RHBZ#1240276). + +Fix the tests: it doesn't let us use guestfish for arbitrary Windows +edits. +--- + test-data/phony-guests/make-windows-img.sh | 1 + + 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 +--- a/test-data/phony-guests/make-windows-img.sh ++++ b/test-data/phony-guests/make-windows-img.sh +@@ -37,6 +37,7 @@ fi + + # Create a disk image. + guestfish < +Date: Mon, 21 Nov 2022 13:03:22 +0000 +Subject: [PATCH] RHEL: builder: Disable opensuse repository + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2145160 +(cherry picked from commit 8e0e91c923bd7076fd906a71678ddd3f328ae2c0) +--- + builder/opensuse.conf.in | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/builder/opensuse.conf.in b/builder/opensuse.conf.in +index 19f979699..a57fc6977 100644 +--- a/builder/opensuse.conf.in ++++ b/builder/opensuse.conf.in +@@ -1,3 +1,7 @@ +-[opensuse.org] +-uri=http://download.opensuse.org/repositories/Virtualization:/virt-builder-images/images/index +-gpgkey=file://@SYSCONFDIR@/virt-builder/repos.d/opensuse.gpg ++# https://bugzilla.redhat.com/show_bug.cgi?id=2145160 ++# This is disabled in RHEL by default, but you can enable it by ++# uncommenting the lines below. ++ ++#[opensuse.org] ++#uri=http://download.opensuse.org/repositories/Virtualization:/virt-builder-images/images/index ++#gpgkey=file://@SYSCONFDIR@/virt-builder/repos.d/opensuse.gpg diff --git a/SOURCES/0003-customize-Implement-inject-blnsvr-operation.patch b/SOURCES/0003-customize-Implement-inject-blnsvr-operation.patch new file mode 100644 index 0000000..2c4bb5d --- /dev/null +++ b/SOURCES/0003-customize-Implement-inject-blnsvr-operation.patch @@ -0,0 +1,254 @@ +From d3153501860dd9327cdd9c9f5ead0883918b0643 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 16 May 2024 12:49:24 +0100 +Subject: [PATCH] customize: Implement --inject-blnsvr operation + +Also updates the common submodule with the generated changes from +libguestfs, and the implementation of Inject_virtio_win.inject_blnsvr. + +(cherry picked from commit 80d258baa49214c8e59b91d6085595c9b989fc0d) +--- + common | 2 +- + customize/customize_run.ml | 13 +++++++++++-- + 2 files changed, 12 insertions(+), 3 deletions(-) + +Submodule common 7cbb3ba35...a78839676: +diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod +index ff93630d8..b2ac57526 100644 +--- a/common/mlcustomize/customize-options.pod ++++ b/common/mlcustomize/customize-options.pod +@@ -193,6 +193,18 @@ L. + Set the hostname of the guest to C. You can use a + dotted hostname.domainname (FQDN) if you want. + ++=item B<--inject-blnsvr> METHOD ++ ++Inject the Balloon Server (F) into a Windows guest. ++This operation also injects a firstboot script so that the Balloon ++Server is installed when the guest boots. ++ ++The parameter is the same as used by the I<--inject-virtio-win> operation. ++ ++Note that to do a full conversion of a Windows guest from a ++foreign hypervisor like VMware (which involves many other operations) ++you should use the L tool instead of this. ++ + =item B<--inject-qemu-ga> METHOD + + Inject the QEMU Guest Agent into a Windows guest. The guest +diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod +index bb0ce1255..957de8cf2 100644 +--- a/common/mlcustomize/customize-synopsis.pod ++++ b/common/mlcustomize/customize-synopsis.pod +@@ -3,16 +3,16 @@ + [--copy SOURCE:DEST] [--copy-in LOCALPATH:REMOTEDIR] + [--delete PATH] [--edit FILE:EXPR] [--firstboot SCRIPT] + [--firstboot-command 'CMD+ARGS'] [--firstboot-install PKG,PKG..] +- [--hostname HOSTNAME] [--inject-qemu-ga METHOD] +- [--inject-virtio-win METHOD] [--install PKG,PKG..] +- [--link TARGET:LINK[:LINK..]] [--mkdir DIR] [--move SOURCE:DEST] +- [--password USER:SELECTOR] [--root-password SELECTOR] +- [--run SCRIPT] [--run-command 'CMD+ARGS'] [--scrub FILE] +- [--sm-attach SELECTOR] [--sm-register] [--sm-remove] +- [--sm-unregister] [--ssh-inject USER[:SELECTOR]] +- [--tar-in TARFILE:REMOTEDIR] [--timezone TIMEZONE] [--touch FILE] +- [--truncate FILE] [--truncate-recursive PATH] +- [--uninstall PKG,PKG..] [--update] [--upload FILE:DEST] +- [--write FILE:CONTENT] [--no-logfile] ++ [--hostname HOSTNAME] [--inject-blnsvr METHOD] ++ [--inject-qemu-ga METHOD] [--inject-virtio-win METHOD] ++ [--install PKG,PKG..] [--link TARGET:LINK[:LINK..]] [--mkdir DIR] ++ [--move SOURCE:DEST] [--password USER:SELECTOR] ++ [--root-password SELECTOR] [--run SCRIPT] ++ [--run-command 'CMD+ARGS'] [--scrub FILE] [--sm-attach SELECTOR] ++ [--sm-register] [--sm-remove] [--sm-unregister] ++ [--ssh-inject USER[:SELECTOR]] [--tar-in TARFILE:REMOTEDIR] ++ [--timezone TIMEZONE] [--touch FILE] [--truncate FILE] ++ [--truncate-recursive PATH] [--uninstall PKG,PKG..] [--update] ++ [--upload FILE:DEST] [--write FILE:CONTENT] [--no-logfile] + [--password-crypto md5|sha256|sha512] [--no-selinux-relabel] + [--selinux-relabel] [--sm-credentials SELECTOR] +diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml +index 48ee33445..c4d6a77d5 100644 +--- a/common/mlcustomize/customize_cmdline.ml ++++ b/common/mlcustomize/customize_cmdline.ml +@@ -61,6 +61,8 @@ and op = [ + (* --firstboot-install PKG,PKG.. *) + | `Hostname of string + (* --hostname HOSTNAME *) ++ | `InjectBalloonServer of string ++ (* --inject-blnsvr METHOD *) + | `InjectQemuGA of string + (* --inject-qemu-ga METHOD *) + | `InjectVirtioWin of string +@@ -286,6 +288,12 @@ let rec argspec () = + s_"Set the hostname" + ), + Some "HOSTNAME", "Set the hostname of the guest to C. You can use a\ndotted hostname.domainname (FQDN) if you want."; ++ ( ++ [ L"inject-blnsvr" ], ++ Getopt.String (s_"METHOD", fun s -> List.push_front (`InjectBalloonServer s) ops), ++ s_"Inject the Balloon Server into a Windows guest" ++ ), ++ Some "METHOD", "Inject the Balloon Server (F) into a Windows guest.\nThis operation also injects a firstboot script so that the Balloon\nServer is installed when the guest boots.\n\nThe parameter is the same as used by the I<--inject-virtio-win> operation.\n\nNote that to do a full conversion of a Windows guest from a\nforeign hypervisor like VMware (which involves many other operations)\nyou should use the L tool instead of this."; + ( + [ L"inject-qemu-ga" ], + Getopt.String (s_"METHOD", fun s -> List.push_front (`InjectQemuGA s) ops), +diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli +index 51a156eae..ee62961a1 100644 +--- a/common/mlcustomize/customize_cmdline.mli ++++ b/common/mlcustomize/customize_cmdline.mli +@@ -53,6 +53,8 @@ and op = [ + (* --firstboot-install PKG,PKG.. *) + | `Hostname of string + (* --hostname HOSTNAME *) ++ | `InjectBalloonServer of string ++ (* --inject-blnsvr METHOD *) + | `InjectQemuGA of string + (* --inject-qemu-ga METHOD *) + | `InjectVirtioWin of string +diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml +index 0a4b8dac0..afec1e456 100644 +--- a/common/mlcustomize/inject_virtio_win.ml ++++ b/common/mlcustomize/inject_virtio_win.ml +@@ -24,6 +24,8 @@ open Common_gettext.Gettext + + open Regedit + ++let re_blnsvr = PCRE.compile ~caseless:true "\\bblnsvr\\.exe$" ++ + type t = { + g : Guestfs.guestfs; (** guestfs handle *) + +@@ -274,6 +276,25 @@ and inject_qemu_ga ({ g; root } as t) = + configure_qemu_ga t tempdir_win msi_files; + msi_files <> [] (* return true if we found some qemu-ga MSI files *) + ++and inject_blnsvr ({ g; root } as t) = ++ (* Copy the files to the guest. *) ++ let dir, dir_win = Firstboot.firstboot_dir g root in ++ let dir_win = Option.value dir_win ~default:dir in ++ let tempdir = sprintf "%s/Temp" dir in ++ let tempdir_win = sprintf "%s\\Temp" dir_win in ++ g#mkdir_p tempdir; ++ ++ let files = copy_blnsvr t tempdir in ++ match files with ++ | [] -> false (* Didn't find or install anything. *) ++ ++ (* We usually find blnsvr.exe in two locations (drivers/by-os and ++ * drivers/by-driver). Pick the first. ++ *) ++ | blnsvr :: _ -> ++ configure_blnsvr t tempdir_win blnsvr; ++ true ++ + and add_guestor_to_registry t ((g, root) as reg) drv_name drv_pciid = + let ddb_node = g#hivex_node_get_child root "DriverDatabase" in + +@@ -358,6 +379,11 @@ and copy_qemu_ga t tempdir = + (fun () -> + error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) + ++and copy_blnsvr t tempdir = ++ copy_from_virtio_win t "/" tempdir (virtio_iso_path_matches_blnsvr t) ++ (fun () -> ++ error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) ++ + (* Copy all files from virtio_win directory/ISO located in [srcdir] + * subdirectory and all its subdirectories to the [destdir]. The directory + * hierarchy is not preserved, meaning all files will be directly in [destdir]. +@@ -452,10 +478,7 @@ and virtio_iso_path_matches_guest_os t path = + * "./drivers/amd64/Win2012R2/netkvm.sys". + * Note we check lowercase paths. + *) +- let pathelem elem = +- String.find lc_path ("/" ^ elem ^ "/") >= 0 || +- String.is_prefix lc_path (elem ^ "/") +- in ++ let pathelem elem = String.find lc_path ("/" ^ elem ^ "/") >= 0 in + let p_arch = + if pathelem "x86" || pathelem "i386" then "i386" + else if pathelem "amd64" then "x86_64" +@@ -499,11 +522,7 @@ and virtio_iso_path_matches_guest_os t path = + else + raise Not_found in + +- let p_sriov = pathelem "sriov" in +- +- arch = p_arch && +- not p_sriov && (* always ignored, see RHEL-56383 *) +- os_major = p_os_major && os_minor = p_os_minor && ++ arch = p_arch && os_major = p_os_major && os_minor = p_os_minor && + match_os_variant os_variant && + match_osinfo osinfo + +@@ -527,6 +546,10 @@ and virtio_iso_path_matches_qemu_ga t path = + | ("x86_64", "rhev-qga64.msi") -> true + | _ -> false + ++(* Find blnsvr for the current Windows version. *) ++and virtio_iso_path_matches_blnsvr t path = ++ virtio_iso_path_matches_guest_os t path && PCRE.matches re_blnsvr path ++ + (* Look up in libosinfo for the OS, and copy all the locally + * available files specified as drivers for that OS to the [destdir]. + * +@@ -591,3 +614,10 @@ and configure_qemu_ga t tempdir_win files = + ) files; + + Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga" !script ++ ++and configure_blnsvr t tempdir_win blnsvr = ++ let cmd = sprintf "\ ++ @echo off\n\ ++ echo Installing %s\n\ ++ \"%s\\%s\" -i\n" blnsvr tempdir_win blnsvr in ++ Firstboot.add_firstboot_script t.g t.root "install-blnsvr" cmd +diff --git a/common/mlcustomize/inject_virtio_win.mli b/common/mlcustomize/inject_virtio_win.mli +index d14f04973..d273c4dd3 100644 +--- a/common/mlcustomize/inject_virtio_win.mli ++++ b/common/mlcustomize/inject_virtio_win.mli +@@ -93,3 +93,11 @@ val inject_qemu_ga : t -> bool + the MSI(s). + + Returns [true] iff we were able to inject qemu-ga. *) ++ ++val inject_blnsvr : t -> bool ++(** Inject the Balloon Server ([blnsvr.exe]) into a Windows guest. ++ ++ A firstboot script is also injected which should install ++ the server by running [blnsvr -i]. ++ ++ Returns [true] iff we were able to inject the Balloon Server. *) +diff --git a/customize/customize_run.ml b/customize/customize_run.ml +index 1314d6e30..1d7c13eaf 100644 +--- a/customize/customize_run.ml ++++ b/customize/customize_run.ml +@@ -113,8 +113,8 @@ let run (g : G.guestfs) root (ops : ops) = + Hashtbl.replace passwords user pw + in + +- (* Helper function to convert --inject-qemu-ga/--inject-virtio-win +- * method parameter into a virtio-win handle. ++ (* Helper function to convert --inject-blnsvr/--inject-qemu-ga/ ++ * --inject-virtio-win method parameter into a virtio-win handle. + *) + let get_virtio_win_handle op meth = + if g#inspect_get_type root <> "windows" then ( +@@ -216,6 +216,15 @@ let run (g : G.guestfs) root (ops : ops) = + if not (Hostname.set_hostname g root hostname) then + warning (f_"hostname could not be set for this type of guest") + ++ | `InjectBalloonServer meth -> ++ (match get_virtio_win_handle "--inject-blnsvr" meth with ++ | None -> () ++ | Some t -> ++ if not (Inject_virtio_win.inject_blnsvr t) then ++ warning (f_"--inject-blnsvr: blnsvr.exe not found in \ ++ virtio-win source that you specified") ++ ) ++ + | `InjectQemuGA meth -> + (match get_virtio_win_handle "--inject-qemu-ga" meth with + | None -> () diff --git a/SOURCES/copy-patches.sh b/SOURCES/copy-patches.sh new file mode 100755 index 0000000..57ccf1f --- /dev/null +++ b/SOURCES/copy-patches.sh @@ -0,0 +1,65 @@ +#!/bin/bash - + +set -e + +# Maintainer script to copy patches from the git repo to the current +# directory. Use it like this: +# ./copy-patches.sh + +project=guestfs-tools +rhel_version=10.0 + +# Check we're in the right directory. +if [ ! -f $project.spec ]; then + echo "$0: run this from the directory containing '$project.spec'" + exit 1 +fi + +case `id -un` in + rjones) git_checkout=$HOME/d/$project-rhel-$rhel_version ;; + lacos) git_checkout=$HOME/src/v2v/$project ;; + *) git_checkout=$HOME/d/$project-rhel-$rhel_version ;; +esac +if [ ! -d $git_checkout ]; then + echo "$0: $git_checkout does not exist" + echo "This script is only for use by the maintainer when preparing a" + echo "$project release on RHEL." + exit 1 +fi + +# Get the base version of the project. +version=`grep '^Version:' $project.spec | awk '{print $2}'` +tag="v$version" + +# Remove any existing patches. +git rm -f [0-9]*.patch ||: +rm -f [0-9]*.patch + +# Get the patches. +( + cd $git_checkout + rm -f [0-9]*.patch + git -c core.abbrev=9 format-patch -O/dev/null --subject-prefix=PATCH -N \ + --submodule=diff --no-signature --patience $tag +) +mv $git_checkout/[0-9]*.patch . + +# Remove any not to be applied. +rm -f *NOT-FOR-RPM*.patch + +# Add the patches. +git add [0-9]*.patch + +# Print out the patch lines. +echo +echo "--- Copy the following text into $project.spec file" +echo + +echo "# Patches." +for f in [0-9]*.patch; do + n=`echo $f | awk -F- '{print $1}'` + echo "Patch$n: $f" +done + +echo +echo "--- End of text" diff --git a/SOURCES/guestfs-tools-1.52.2.tar.gz.sig b/SOURCES/guestfs-tools-1.52.2.tar.gz.sig new file mode 100644 index 0000000..b4f51cb --- /dev/null +++ b/SOURCES/guestfs-tools-1.52.2.tar.gz.sig @@ -0,0 +1,17 @@ +-----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----- diff --git a/SPECS/guestfs-tools.spec b/SPECS/guestfs-tools.spec new file mode 100644 index 0000000..3b3c000 --- /dev/null +++ b/SPECS/guestfs-tools.spec @@ -0,0 +1,600 @@ +# Architectures that we run the test suite on. +# +# As the test suite takes a very long time to run and is somewhat +# unreliable on !x86 architectures, only run it on x86-64. +%global test_arches x86_64 + +# 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 + +# Filter perl provides. +%{?perl_default_filter} + +Summary: Tools to access and modify virtual machine disk images +Name: guestfs-tools +Version: 1.52.2 +Release: 1%{?dist} +License: GPL-2.0-or-later AND LGPL-2.0-or-later + +# Build only for architectures that have a kernel +ExclusiveArch: %{kernel_arches} +%if 0%{?rhel} +# No qemu-kvm on POWER (RHBZ#1946532). +ExcludeArch: %{power64} +%endif + +# Source and patches. +URL: http://libguestfs.org/ +Source0: http://download.libguestfs.org/guestfs-tools/%{source_directory}/%{name}-%{version}.tar.gz +%if 0%{verify_tarball_signature} +Source1: http://download.libguestfs.org/guestfs-tools/%{source_directory}/%{name}-%{version}.tar.gz.sig +%endif + +# Keyring used to verify tarball signature. +%if 0%{verify_tarball_signature} +Source2: libguestfs.keyring +%endif + +# Maintainer script which helps with handling patches. +Source3: copy-patches.sh + +# Patches are maintained in the following repository: +# https://github.com/rwmjones/guestfs-tools/commits/rhel-10.0 + +# 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 + +%if 0%{patches_touch_autotools} +BuildRequires: autoconf, automake, libtool, gettext-devel +%endif + +# Basic build requirements. +BuildRequires: gcc, gcc-c++ +BuildRequires: make +BuildRequires: libguestfs-devel >= 1:1.49.8-1 +BuildRequires: libguestfs-xfs +BuildRequires: perl(Pod::Simple) +BuildRequires: perl(Pod::Man) +BuildRequires: perl(Module::Build) +BuildRequires: perl(Test::More) +BuildRequires: /usr/bin/pod2text +BuildRequires: po4a +BuildRequires: pcre2-devel +BuildRequires: libxml2-devel +BuildRequires: jansson-devel +BuildRequires: libvirt-devel +BuildRequires: libosinfo-devel +BuildRequires: libxcrypt-devel +BuildRequires: ncurses-devel +%ifarch x86_64 +BuildRequires: glibc-static +%endif +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 +%if !0%{?rhel} +BuildRequires: zip +BuildRequires: unzip +%endif +%if !0%{?rhel} +BuildRequires: perl(Expect) +%endif +BuildRequires: bash-completion +BuildRequires: /usr/bin/qemu-img +BuildRequires: xorriso +BuildRequires: hwdata-devel +BuildRequires: perl(Locale::TextDomain) +BuildRequires: perl(Sys::Guestfs) +BuildRequires: perl(Win::Hivex) +BuildRequires: perl(Win::Hivex::Regedit) +BuildRequires: perl-generators + +%if 0%{verify_tarball_signature} +BuildRequires: gnupg2 +%endif + +# Ensure a minimum version of libguestfs is installed. This contains +# a workaround for openssl bug RHBZ#2133884 and the hang where we +# called setenv between fork and exec. +Requires: libguestfs >= 1.49.6-1 + +# For virt-builder: +Requires: curl +Requires: gnupg2 +Requires: /usr/bin/qemu-img +Requires: xz + +# For virt-builder-repository: +Suggests: osinfo-db + +# For virt-drivers: +Recommends: hwdata + +# For virt-inspector, since Fedora and RHEL >= 7 use XFS: +Recommends: libguestfs-xfs + +# For virt-edit and virt-customize: +Suggests: perl + +# This replaces the libguestfs-tools-c package. +Provides: libguestfs-tools-c = 1:%{version}-%{release} +Obsoletes: libguestfs-tools-c <= 1:1.45.2-1 + + +%description +guestfs-tools is a set of tools that can be used to make batch +configuration changes to guests, get disk used/free statistics +(virt-df), perform backups and guest clones, change +registry/UUID/hostname info, build guests from scratch (virt-builder) +and much more. + +Virt-alignment-scan scans virtual machines looking for partition +alignment problems. + +Virt-builder is a command line tool for rapidly making disk images +of popular free operating systems. + +Virt-cat is a command line tool to display the contents of a file in a +virtual machine. + +Virt-customize is a command line tool for customizing virtual machine +disk images. + +Virt-df is a command line tool to display free space on virtual +machine filesystems. Unlike other tools, it doesn’t just display the +amount of space allocated to a virtual machine, but can look inside +the virtual machine to see how much space is really being used. It is +like the df(1) command, but for virtual machines, except that it also +works for Windows virtual machines. + +Virt-diff shows the differences between virtual machines. + +Virt-drivers detects the bootloader, kernel and drivers inside a guest. + +Virt-edit is a command line tool to edit the contents of a file in a +virtual machine. + +Virt-filesystems is a command line tool to display the filesystems, +partitions, block devices, LVs, VGs and PVs found in a disk image +or virtual machine. It replaces the deprecated programs +virt-list-filesystems and virt-list-partitions with a much more +capable tool. + +Virt-format is a command line tool to erase and make blank disks. + +Virt-get-kernel extracts a kernel/initrd from a disk image. + +Virt-inspector examines a virtual machine and tries to determine the +version of the OS, the kernel version, what drivers are installed, +whether the virtual machine is fully virtualized (FV) or +para-virtualized (PV), what applications are installed and more. + +Virt-log is a command line tool to display the log files from a +virtual machine. + +Virt-ls is a command line tool to list out files in a virtual machine. + +Virt-make-fs is a command line tool to build a filesystem out of +a collection of files or a tarball. + +Virt-resize can resize existing virtual machine disk images. + +Virt-sparsify makes virtual machine disk images sparse (thin-provisioned). + +Virt-sysprep lets you reset or unconfigure virtual machines in +preparation for cloning them. + +Virt-tail follows (tails) a log file within a guest, like 'tail -f'. + + +%package -n virt-win-reg +Summary: Access and modify the Windows Registry of a Windows VM +License: GPL-2.0-or-later +BuildArch: noarch + +# This replaces the libguestfs-tools package. +Provides: libguestfs-tools = 1:%{version}-%{release} +Obsoletes: libguestfs-tools <= 1:1.45.2-1 + + +%description -n virt-win-reg +Virt-win-reg lets you look at and modify the Windows Registry of +Windows virtual machines. + + +%package bash-completion +Summary: Bash tab-completion scripts for %{name} +BuildArch: noarch +Requires: bash-completion >= 2.0 +Requires: %{name} = %{version}-%{release} + + +%description bash-completion +Install this package if you want intelligent bash tab-completion +for the virt-* tools. + + +%package man-pages-ja +Summary: Japanese (ja) man pages for %{name} +BuildArch: noarch +Requires: %{name} = %{version}-%{release} + +%description man-pages-ja +%{name}-man-pages-ja contains Japanese (ja) man pages +for %{name}. + + +%package man-pages-uk +Summary: Ukrainian (uk) man pages for %{name} +BuildArch: noarch +Requires: %{name} = %{version}-%{release} + +%description man-pages-uk +%{name}-man-pages-uk contains Ukrainian (uk) man pages +for %{name}. + + +%prep +%if 0%{verify_tarball_signature} +%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +%endif +%setup -q +%autopatch -p1 + +%if 0%{patches_touch_autotools} +autoreconf -i +%endif + + +%build +%{configure} + +# 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 +# other, resulting in a corrupted file. +make -j1 -C builder index-parse.c + +make V=1 %{?_smp_mflags} + + +%check +%ifarch %{test_arches} +# Only run the tests with non-debug (ie. non-Rawhide) kernels. +# XXX This tests for any debug kernel installed. +if grep CONFIG_DEBUG_MUTEXES=y /lib/modules/*/config ; then + echo "Skipping tests because debug kernel is installed" + exit 0 +fi + +# Enable debugging. +export LIBGUESTFS_DEBUG=1 +export LIBGUESTFS_TRACE=1 + +# This test is currently broken and needs further investigation. +export SKIP_TEST_MACHINE_READABLE_SH=1 + +# This test fails for me in local mock and Koji, but not when running +# in an unrestricted environment. +export SKIP_TEST_VIRT_FORMAT_SH=1 + +# This test takes too long to run under Koji and times out. It runs +# fine with KVM enabled. +export SKIP_TEST_VIRT_RESIZE_PL=1 + +if ! make check -k ; then + # Dump out the log files of any failing tests to make + # debugging test failures easier. + for f in `find -name test-suite.log | xargs grep -l ^FAIL:`; do + echo '*****' $f '*****' + cat $f + echo + done + exit 1 +fi +%endif + + +%install +make DESTDIR=$RPM_BUILD_ROOT install + +# Delete libtool files. +find $RPM_BUILD_ROOT -name '*.la' -delete + +# Move installed documentation back to the source directory so +# we can install it using a %%doc rule. +mv $RPM_BUILD_ROOT%{_docdir}/%{name} installed-docs +gzip --best installed-docs/*.xml + +# Find locale files. +%find_lang %{name} + + +# Fix upgrades from old libguestfs-tools-c package +# which had /etc/virt-builder -> xdg/virt-builder. +# https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/ +# This can be removed in Fedora > 36. +%pretrans -p +path = "/etc/virt-builder" +st = posix.stat(path) +if st and st.type == "link" then + os.remove(path) +end + + +%files -f %{name}.lang +%license COPYING +%doc README +%doc installed-docs/* +%dir %{_sysconfdir}/virt-builder +%dir %{_sysconfdir}/virt-builder/repos.d +%config(noreplace) %{_sysconfdir}/virt-builder/repos.d/* +%{_bindir}/virt-alignment-scan +%{_bindir}/virt-builder +%{_bindir}/virt-builder-repository +%{_bindir}/virt-cat +%{_bindir}/virt-customize +%{_bindir}/virt-df +%{_bindir}/virt-diff +%{_bindir}/virt-drivers +%{_bindir}/virt-edit +%{_bindir}/virt-filesystems +%{_bindir}/virt-format +%{_bindir}/virt-get-kernel +%{_bindir}/virt-index-validate +%{_bindir}/virt-inspector +%{_bindir}/virt-log +%{_bindir}/virt-ls +%{_bindir}/virt-make-fs +%{_bindir}/virt-resize +%{_bindir}/virt-sparsify +%{_bindir}/virt-sysprep +%{_bindir}/virt-tail +%{_mandir}/man1/guestfs-tools-release-notes-1*.1* +%{_mandir}/man1/virt-alignment-scan.1* +%{_mandir}/man1/virt-builder-repository.1* +%{_mandir}/man1/virt-builder.1* +%{_mandir}/man1/virt-cat.1* +%{_mandir}/man1/virt-customize.1* +%{_mandir}/man1/virt-df.1* +%{_mandir}/man1/virt-diff.1* +%{_mandir}/man1/virt-drivers.1* +%{_mandir}/man1/virt-edit.1* +%{_mandir}/man1/virt-filesystems.1* +%{_mandir}/man1/virt-format.1* +%{_mandir}/man1/virt-get-kernel.1* +%{_mandir}/man1/virt-index-validate.1* +%{_mandir}/man1/virt-inspector.1* +%{_mandir}/man1/virt-log.1* +%{_mandir}/man1/virt-ls.1* +%{_mandir}/man1/virt-make-fs.1* +%{_mandir}/man1/virt-resize.1* +%{_mandir}/man1/virt-sparsify.1* +%{_mandir}/man1/virt-sysprep.1* +%{_mandir}/man1/virt-tail.1* + + +%files -n virt-win-reg +%license COPYING +%doc README +%{_bindir}/virt-win-reg +%{_mandir}/man1/virt-win-reg.1* + + +%files bash-completion +%license COPYING +%dir %{_datadir}/bash-completion/completions +%{_datadir}/bash-completion/completions/virt-* + + +%files man-pages-ja +%lang(ja) %{_mandir}/ja/man1/*.1* + + +%files man-pages-uk +%lang(uk) %{_mandir}/uk/man1/*.1* + + +%changelog +* Fri Oct 25 2024 MSVSphere Packaging Team - 1.52.2-1 +- Rebuilt for MSVSphere 10 + +* Fri Oct 04 2024 Richard W.M. Jones - 1.52.2-1 +- Rebase to guestfs-tools 1.52.2 + resolves: RHEL-56812 + +* Tue Aug 27 2024 Richard W.M. Jones - 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-56319 +- customize: Implement --inject-blnsvr operation + resolves: RHEL-56330 +- Add support for nbd+unix:// URIs + resolves: RHEL-56332 + +* Tue Jun 25 2024 Troy Dawson - 1.52.0-6 +- Bump release for June 2024 mass rebuild + +* Wed Jun 19 2024 Richard W.M. Jones - 1.52.0-5 +- OCaml 5.2.0 ppc64le fix + +* Fri May 31 2024 Richard W.M. Jones - 1.52.0-4 +- Rebuild for OCaml 5.2 + +* Wed Jan 24 2024 Fedora Release Engineering - 1.52.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Richard W.M. Jones - 1.52.0-2 +- Fix virt-customize --chown invalid format error +- New upstream github repository. + +* Thu Jan 4 2024 Richard W.M. Jones - 1.52.0-1 +- New stable version 1.52.0 + +* Tue Dec 19 2023 Richard W.M. Jones - 1.51.7-1 +- New development version 1.51.7 + +* Mon Dec 18 2023 Richard W.M. Jones - 1.51.6-5 +- OCaml 5.1.1 + s390x code gen fix for Fedora 40 + +* Tue Dec 12 2023 Richard W.M. Jones - 1.51.6-4 +- Bump release and rebuild + +* Tue Dec 12 2023 Richard W.M. Jones - 1.51.6-3 +- OCaml 5.1.1 rebuild for Fedora 40 + +* Sat Dec 9 2023 Richard W.M. Jones - 1.51.6-2 +- New development version 1.51.6 + +* Mon Nov 27 2023 Richard W.M. Jones - 1.51.5-2 +- Fix build for libxml2 2.12.1 + +* Thu Nov 02 2023 Richard W.M. Jones - 1.51.5-1 +- New development version 1.51.5 + +* Thu Oct 05 2023 Richard W.M. Jones - 1.51.4-2 +- OCaml 5.1 rebuild for Fedora 40 + +* Thu Jul 20 2023 Richard W.M. Jones - 1.51.4-1 +- New development version 1.51.4 + +* Thu Jul 20 2023 Fedora Release Engineering - 1.51.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Fri Jul 14 2023 Richard W.M. Jones - 1.51.3-1 +- New development version 1.51.3 + +* Mon Jun 05 2023 Richard W.M. Jones - 1.51.2-2 +- Migrated to SPDX license + +* Thu Apr 06 2023 Richard W.M. Jones - 1.51.2-1 +- New development version 1.51.2 + +* Tue Feb 21 2023 Richard W.M. Jones - 1.51.1-2 +- Fix BR hwdata-devel for PCI IDs data + +* Mon Feb 20 2023 Richard W.M. Jones - 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 - 1.50.0-2 +- Remove virt-dib (RHBZ#2169550) + +* Tue Feb 07 2023 Richard W.M. Jones - 1.50.0-1 +- New upstream stable version 1.50.0 + +* Thu Jan 26 2023 Richard W.M. Jones - 1.49.10-1 +- New upstream development version 1.49.10 + +* Thu Jan 19 2023 Richard W.M. Jones - 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 - 1.49.8-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Tue Jan 17 2023 Richard W.M. Jones - 1.49.8-2 +- New upstream development version 1.49.8 +- +BR libosinfo-devel + +* Sat Dec 10 2022 Richard W.M. Jones - 1.49.7-2 +- New upstream development version 1.49.7 + +* Fri Nov 25 2022 Richard W.M. Jones - 1.49.6-1 +- New upstream development version 1.49.6 +- Enable opensuse repository again + +* Mon Nov 21 2022 Richard W.M. Jones - 1.49.5-2 +- Disable opensuse repository + +* Wed Oct 12 2022 Richard W.M. Jones - 1.49.5-1 +- New upstream development version 1.49.5 + +* Mon Aug 01 2022 Richard W.M. Jones - 1.49.4-1 +- New upstream development version 1.49.4 + +* Thu Jul 21 2022 Fedora Release Engineering - 1.49.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Fri Jul 01 2022 Richard W.M. Jones - 1.49.3-1 +- New upstream development version 1.49.3 + +* Thu May 26 2022 Richard W.M. Jones - 1.49.2-1 +- New upstream development version 1.49.2 + +* Thu May 12 2022 Richard W.M. Jones - 1.49.1-1 +- New upstream development version 1.49.1 + +* Mon Mar 14 2022 Richard W.M. Jones - 1.48.0-1 +- New upstream stable branch version 1.48.0 + +* Tue Mar 08 2022 Richard W.M. Jones - 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 - 1.47.4-1 +- New upstream development version 1.47.4 + +* Thu Jan 20 2022 Fedora Release Engineering - 1.47.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Sat Dec 04 2021 Richard W.M. Jones - 1.47.3-1 +- New upstream development version 1.47.3 + +* Thu Jul 22 2021 Fedora Release Engineering - 1.47.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Wed Jun 16 2021 Richard W.M. Jones - 1.47.2-1 +- New upstream development version 1.47.2 + +* Wed Jun 2 2021 Richard W.M. Jones - 1.46.1-3 +- Add gating tests (for RHEL 9) + +* Thu May 13 2021 Richard W.M. Jones - 1.46.1-2 +- BR perl-generators so deps of virt-win-reg subpackage are correct. + +* Sat May 08 2021 Richard W.M. Jones - 1.46.1-1 +- New stable branch version 1.46.1. + +* Tue Apr 27 2021 Richard W.M. Jones - 1.46.0-1 +- New stable branch version 1.46.0. + +* Wed Apr 07 2021 Richard W.M. Jones - 1.45.3-4 +- Use Epoch 1 for virt-dib subpackage (only). + +* Wed Mar 31 2021 Richard W.M. Jones - 1.45.3-3 +- Add BR xorriso, needed to run the tests. + +* Mon Mar 29 2021 Richard W.M. Jones - 1.45.3-1 +- New upstream version 1.45.3. +- Fix symlink replacement of virt-builder directory (RHBZ#1943838). + +* Fri Mar 26 2021 Richard W.M. Jones - 1.45.2-5 +- Skip test-virt-resize.pl that takes too long to run. + +* Thu Mar 25 2021 Richard W.M. Jones - 1.45.2-4 +- Add perl(Test::More) dependency for the Perl test suite. +- Add perl(Module::Build) dependency for the Perl bindings. +- Fix ounit2 dependency again. + +* Wed Mar 24 2021 Richard W.M. Jones - 1.45.2-2 +- Add perl(Locale::TextDomain) dependency for virt-win-reg. +- Fix ounit2 dependency upstream. + +* Tue Mar 23 2021 Richard W.M. Jones - 1.45.2-1 +- New guestfs-tools package, split off from libguestfs.