From e57fabcd7cacefdfe8240f0bbc6b8ca951ea7880 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 11 Jan 2022 12:52:39 -0500 Subject: [PATCH] import guestfs-tools-1.46.1-6.el9 --- ...g-Fix-output-of-virt-win-reg-version.patch | 2 +- ...aml.m4-Fix-deprecated-warning-format.patch | 2 +- ...003-customize-Suppress-OCaml-warning.patch | 2 +- ...ng-recognize-kalilinux-and-msdos-dis.patch | 3 +- ...ng-Add-support-for-Kylin-RHBZ-199539.patch | 2 +- ...ystem-local-NetworkManager-connectio.patch | 96 +++++++++++++++++++ SOURCES/copy-patches.sh | 60 ++++++++++++ SPECS/guestfs-tools.spec | 13 ++- 8 files changed, 173 insertions(+), 7 deletions(-) create mode 100644 SOURCES/0006-sysprep-remove-system-local-NetworkManager-connectio.patch create mode 100755 SOURCES/copy-patches.sh diff --git a/SOURCES/0001-win-reg-Fix-output-of-virt-win-reg-version.patch b/SOURCES/0001-win-reg-Fix-output-of-virt-win-reg-version.patch index 71a30b6..9910422 100644 --- a/SOURCES/0001-win-reg-Fix-output-of-virt-win-reg-version.patch +++ b/SOURCES/0001-win-reg-Fix-output-of-virt-win-reg-version.patch @@ -1,7 +1,7 @@ From 83de85e717ad525423b0eabe153b48ff8af90bd1 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 17 May 2021 15:18:04 +0100 -Subject: [PATCH 1/5] win-reg: Fix output of virt-win-reg --version +Subject: [PATCH] win-reg: Fix output of virt-win-reg --version Before we split libguestfs and guestfs-tools the version of programs was exactly the same as the version of libguestfs. This was diff --git a/SOURCES/0002-m4-guestfs-ocaml.m4-Fix-deprecated-warning-format.patch b/SOURCES/0002-m4-guestfs-ocaml.m4-Fix-deprecated-warning-format.patch index 9054123..df01d43 100644 --- a/SOURCES/0002-m4-guestfs-ocaml.m4-Fix-deprecated-warning-format.patch +++ b/SOURCES/0002-m4-guestfs-ocaml.m4-Fix-deprecated-warning-format.patch @@ -1,7 +1,7 @@ From 662e12ba1a2c2f06151b0f06814e6da0025cff2d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 5 Oct 2021 20:51:19 +0100 -Subject: [PATCH 2/5] m4/guestfs-ocaml.m4: Fix deprecated warning format +Subject: [PATCH] m4/guestfs-ocaml.m4: Fix deprecated warning format In OCaml 4.13: diff --git a/SOURCES/0003-customize-Suppress-OCaml-warning.patch b/SOURCES/0003-customize-Suppress-OCaml-warning.patch index 4bff46f..3335206 100644 --- a/SOURCES/0003-customize-Suppress-OCaml-warning.patch +++ b/SOURCES/0003-customize-Suppress-OCaml-warning.patch @@ -1,7 +1,7 @@ From 89617fbe8867254b8c5a77c7fd28ab7746338751 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 5 Oct 2021 20:53:25 +0100 -Subject: [PATCH 3/5] customize: Suppress OCaml warning +Subject: [PATCH] customize: Suppress OCaml warning In OCaml 4.13: diff --git a/SOURCES/0004-virt-inspector.rng-recognize-kalilinux-and-msdos-dis.patch b/SOURCES/0004-virt-inspector.rng-recognize-kalilinux-and-msdos-dis.patch index e39eb37..bf6a1b8 100644 --- a/SOURCES/0004-virt-inspector.rng-recognize-kalilinux-and-msdos-dis.patch +++ b/SOURCES/0004-virt-inspector.rng-recognize-kalilinux-and-msdos-dis.patch @@ -1,8 +1,7 @@ From e8148241cfd6019e493269580c7fe74d62e0fbdc Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 13 Oct 2021 18:30:42 +0200 -Subject: [PATCH 4/5] virt-inspector.rng: recognize "kalilinux" and "msdos" - distros +Subject: [PATCH] virt-inspector.rng: recognize "kalilinux" and "msdos" distros As of libguestfs @ e597fc5317e0, the "string_of_distro" function [daemon/inspect_types.ml] may output "kalilinux" and "msdos" beyond what diff --git a/SOURCES/0005-virt-inspector.rng-Add-support-for-Kylin-RHBZ-199539.patch b/SOURCES/0005-virt-inspector.rng-Add-support-for-Kylin-RHBZ-199539.patch index 4228fef..017e9d9 100644 --- a/SOURCES/0005-virt-inspector.rng-Add-support-for-Kylin-RHBZ-199539.patch +++ b/SOURCES/0005-virt-inspector.rng-Add-support-for-Kylin-RHBZ-199539.patch @@ -1,7 +1,7 @@ From 8dad474829a8f6874c01a6d85749d8fd66d192ae Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 13 Oct 2021 18:30:43 +0200 -Subject: [PATCH 5/5] virt-inspector.rng: Add support for Kylin (RHBZ#1995391). +Subject: [PATCH] virt-inspector.rng: Add support for Kylin (RHBZ#1995391). Similar-to: b8bc491ff59cc1cc24a1935be99cee0c5edfb5be Signed-off-by: Laszlo Ersek diff --git a/SOURCES/0006-sysprep-remove-system-local-NetworkManager-connectio.patch b/SOURCES/0006-sysprep-remove-system-local-NetworkManager-connectio.patch new file mode 100644 index 0000000..187f906 --- /dev/null +++ b/SOURCES/0006-sysprep-remove-system-local-NetworkManager-connectio.patch @@ -0,0 +1,96 @@ +From 6f8c270b3fb7b5b3109d2553fef38f128b6137ac Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 2 Dec 2021 14:10:06 +0100 +Subject: [PATCH] sysprep: remove system-local NetworkManager connection + profiles (keyfiles) + +Add a simple (default) operation to remove + + /etc/NetworkManager/system-connections/*.nmconnection + +which arguably carry stale information after the initial creation of the +system disk image. + +Note: no side effect callback is invoked. Before commit 576f1541a20c +("sysprep: Use customize module for customizing the guest after +sysprepping.", 2014-03-25), the "delete" operation had been native to +virt-sysprep ("sysprep/sysprep_operation_delete.ml"), and it didn't invoke +side effects. In said commit, "delete" was delegated to virt-customize, +and that was when "side_effects#created_file" was introduced (most likely) +as a catch-all. (We still have the "XXX Did we?" comment today.) + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1980922 +Signed-off-by: Laszlo Ersek +Message-Id: <20211202131006.12774-1-lersek@redhat.com> +Acked-by: Richard W.M. Jones +(cherry picked from commit 903819ecf480bcefec108bdbd7e9bdec1b3b5a49) +--- + sysprep/Makefile.am | 1 + + sysprep/sysprep_operation_net_nmconn.ml | 43 +++++++++++++++++++++++++ + 2 files changed, 44 insertions(+) + create mode 100644 sysprep/sysprep_operation_net_nmconn.ml + +diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am +index d32ab20e..561a71ae 100644 +--- a/sysprep/Makefile.am ++++ b/sysprep/Makefile.am +@@ -52,6 +52,7 @@ operations = \ + mail_spool \ + net_hostname \ + net_hwaddr \ ++ net_nmconn \ + pacct_log \ + package_manager_cache \ + pam_data \ +diff --git a/sysprep/sysprep_operation_net_nmconn.ml b/sysprep/sysprep_operation_net_nmconn.ml +new file mode 100644 +index 00000000..2d8667f1 +--- /dev/null ++++ b/sysprep/sysprep_operation_net_nmconn.ml +@@ -0,0 +1,43 @@ ++(* virt-sysprep ++ * Copyright (C) 2012-2021 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 Common_gettext.Gettext ++open Sysprep_operation ++ ++let glob = "/etc/NetworkManager/system-connections/*.nmconnection" ++ ++let net_nmconn_perform (g : Guestfs.guestfs) root side_effects = ++ let typ = g#inspect_get_type root in ++ let distro = g#inspect_get_distro root in ++ match typ, distro with ++ | "linux", ("fedora"|"rhel"|"centos"|"scientificlinux"|"oraclelinux"| ++ "redhat-based") -> Array.iter g#rm_f (g#glob_expand glob) ++ | _ -> () ++ ++let op = { ++ defaults with ++ name = "net-nmconn"; ++ enabled_by_default = true; ++ heading = s_"Remove system-local NetworkManager connection profiles \ ++ (keyfiles)"; ++ pod_description = Some (s_"On Fedora and Red Hat Enterprise Linux, remove \ ++ the C<" ^ glob ^ "> files."); ++ perform_on_filesystems = Some net_nmconn_perform; ++} ++ ++let () = register_operation op +-- +2.31.1 + diff --git a/SOURCES/copy-patches.sh b/SOURCES/copy-patches.sh new file mode 100755 index 0000000..03de548 --- /dev/null +++ b/SOURCES/copy-patches.sh @@ -0,0 +1,60 @@ +#!/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=9.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 ;; + lersek) git_checkout=$HOME/src/guestfs-tools/$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 format-patch -N --submodule=diff $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/SPECS/guestfs-tools.spec b/SPECS/guestfs-tools.spec index 37a17eb..22e9879 100644 --- a/SPECS/guestfs-tools.spec +++ b/SPECS/guestfs-tools.spec @@ -26,7 +26,7 @@ Summary: Tools to access and modify virtual machine disk images Name: guestfs-tools Version: 1.46.1 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ # Build only for architectures that have a kernel @@ -48,6 +48,9 @@ Source1: http://download.libguestfs.org/guestfs-tools/%{source_directory}/ 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-9.0.0 @@ -60,6 +63,9 @@ Patch0003: 0003-customize-Suppress-OCaml-warning.patch Patch0004: 0004-virt-inspector.rng-recognize-kalilinux-and-msdos-dis.patch Patch0005: 0005-virt-inspector.rng-Add-support-for-Kylin-RHBZ-199539.patch +# Clean up NetworkManager connection files (RHBZ#1980922) +Patch0006: 0006-sysprep-remove-system-local-NetworkManager-connectio.patch + %if 0%{patches_touch_autotools} BuildRequires: autoconf, automake, libtool, gettext-devel %endif @@ -425,6 +431,11 @@ end %changelog +* Sat Dec 04 2021 Richard W.M. Jones - 1.46.1-6 +- Clean up NetworkManager connection files +- Add the copy-patches.sh script from virt-v2v + resolves: rhbz#1980922 + * Tue Nov 23 2021 Richard W.M. Jones - 1.46.1-5 - Fix detection of Kylin Desktop resolves: rhbz#2025950