Run SELinux relabelling in parallel [for virt-v2v]

resolves: rhbz#2190276

Also synch copy-patches.sh with the later version from virt-v2v c9s.

I had to hand-hack the patches which touch common/ because they touch
some directories that are not listed as SUBDIRS by libguestfs, so not
included in the tarball.  Hopefully this will go away when upstream
stable-1.50 does a new stable release.
This commit is contained in:
Richard W.M. Jones 2023-05-04 10:42:15 +01:00
parent 5089358fe5
commit fb7b8af04b
11 changed files with 264 additions and 64 deletions

View File

@ -0,0 +1,37 @@
From 89b6c8b458dcb00de83b543c47a6acb049f63f18 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Tue, 21 Mar 2023 16:55:15 +0100
Subject: [PATCH] update common submodule
HATAYAMA Daisuke (1):
progress: fix segmentation fault when TERM variable is "dumb"
Laszlo Ersek (2):
detect_kernels: tighten "try" scope
detect_kernels: deal with RHEL's kernel-core / kernel-modules-core split
rwmjones (1):
Merge pull request #5 from d-hatayama/fix_segfault_progress_bar
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2175703
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit be11d25b3e2770d86699e94c5087e6625477d5ec)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 360e037d..70c10a07:
diff --git a/common/progress/progress.c b/common/progress/progress.c
index 4d52b97e..e4b30663 100644
--- a/common/progress/progress.c
+++ b/common/progress/progress.c
@@ -318,7 +318,8 @@ progress_bar_set (struct progress_bar *bar,
* (b) it's just not possible to use tputs in a sane way here.
*/
/*tputs (UP, 2, putchar);*/
- fprintf (fp, "%s", UP);
+ if (UP)
+ fprintf (fp, "%s", UP);
}
bar->count++;

View File

@ -0,0 +1,63 @@
From e58cd8df467e342463d08e3d761c2e322287b13e Mon Sep 17 00:00:00 2001
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Date: Wed, 26 Apr 2023 15:59:44 +0300
Subject: [PATCH] daemon/selinux-relabel: don't exclude "/selinux" if it's
non-existent
Since RHBZ#726528, filesystem.rpm doesn't include /selinux. setfiles
then gives us the warning: "Can't stat exclude path "/sysroot/selinux",
No such file or directory - ignoring."
Though the warning is harmless, let's get rid of it by checking the
existence of /selinux directory.
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 9ced5fac8c1f0f8ff7ed2b5671c1c7f5f0bfa875)
---
daemon/selinux-relabel.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/daemon/selinux-relabel.c b/daemon/selinux-relabel.c
index 976cffe3..454486c1 100644
--- a/daemon/selinux-relabel.c
+++ b/daemon/selinux-relabel.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
#include "guestfs_protocol.h"
#include "daemon.h"
@@ -37,6 +38,17 @@ optgroup_selinuxrelabel_available (void)
return prog_exists ("setfiles");
}
+static int
+dir_exists (const char *dir)
+{
+ struct stat statbuf;
+
+ if (stat (dir, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
+ return 1;
+ else
+ return 0;
+}
+
static int
setfiles_has_option (int *flag, char opt_char)
{
@@ -99,8 +111,10 @@ do_selinux_relabel (const char *specfile, const char *path,
*/
ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, s_dev);
ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, s_proc);
- ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, s_selinux);
ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, s_sys);
+ if (dir_exists (s_selinux)) {
+ ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, s_selinux);
+ }
/* You have to use the -m option (where available) otherwise
* setfiles puts all the mountpoints on the excludes list for no

View File

@ -0,0 +1,33 @@
From c1829048c598e11950c9d355fdd5c177a99e046f Mon Sep 17 00:00:00 2001
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Date: Wed, 26 Apr 2023 15:59:45 +0300
Subject: [PATCH] daemon/selinux-relabel: search for "invalid option" in
setfiles output
'X' in the setiles' stderr doesn't necessarily mean that option 'X'
doesn't exist. For instance, when passing '-T' we get: "setfiles:
option requires an argument -- 'T'".
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 152d6e4bdf2dac88856a4ff83cf73451f897d4d4)
---
daemon/selinux-relabel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemon/selinux-relabel.c b/daemon/selinux-relabel.c
index 454486c1..60a6f48a 100644
--- a/daemon/selinux-relabel.c
+++ b/daemon/selinux-relabel.c
@@ -56,8 +56,9 @@ setfiles_has_option (int *flag, char opt_char)
if (*flag == -1) {
char option[] = { '-', opt_char, '\0' }; /* "-X" */
- char err_opt[] = { '\'', opt_char, '\'', '\0'}; /* "'X'" */
+ char err_opt[32]; /* "invalid option -- 'X'" */
+ snprintf(err_opt, sizeof(err_opt), "invalid option -- '%c'", opt_char);
ignore_value (command (NULL, &err, "setfiles", option, NULL));
*flag = err && strstr (err, /* "invalid option -- " */ err_opt) == NULL;
}

View File

@ -0,0 +1,78 @@
From 3046af080baad9935627ebb671950448cfd0fa7b Mon Sep 17 00:00:00 2001
From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Date: Wed, 26 Apr 2023 15:59:46 +0300
Subject: [PATCH] daemon/selinux-relabel: run setfiles with "-T 0", if
supported
Since SELinux userspace v3.4 [1], setfiles command supports "-T nthreads"
option, which allows parallel execution. "-T 0" allows using as many
threads as there're available CPU cores. This might speed up the process
of filesystem relabeling in case the appliance is being run with multiple
vCPUs. The latter is true for at least v2v starting from d2b64ecc67
("v2v: Set the number of vCPUs to same as host number of pCPUs.").
For instance, when running virt-v2v-in-place on my 12-core Xeon host
with SSD, with appliance being run with 8 vCPUs (the upper limit specified
in d2b64ecc67), and on the ~150GiB disk VM (physical size on the host),
I get the following results:
./in-place/virt-v2v-in-place -i libvirt fedora37-vm -v -x
Without this patch:
...
commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/sys -m -C -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/^M
libguestfs: trace: v2v: selinux_relabel = 0
libguestfs: trace: v2v: rm_f "/.autorelabel"
guestfsd: => selinux_relabel (0x1d3) took 17.94 secs
...
With this patch:
...
commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/sys -m -C -T 0 -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/^M
libguestfs: trace: v2v: selinux_relabel = 0
libguestfs: trace: v2v: rm_f "/.autorelabel"
guestfsd: => selinux_relabel (0x1d3) took 5.88 secs
...
So in my scenario it's getting 3 times faster.
[1] https://github.com/SELinuxProject/selinux/releases/tag/3.4
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit d0d8e6738477148a7b752348f9364a3b8faed67f)
---
daemon/selinux-relabel.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/daemon/selinux-relabel.c b/daemon/selinux-relabel.c
index 60a6f48a..cfc5a31d 100644
--- a/daemon/selinux-relabel.c
+++ b/daemon/selinux-relabel.c
@@ -73,6 +73,7 @@ do_selinux_relabel (const char *specfile, const char *path,
{
static int flag_m = -1;
static int flag_C = -1;
+ static int flag_T = -1;
const char *argv[MAX_ARGS];
CLEANUP_FREE char *s_dev = NULL, *s_proc = NULL, *s_selinux = NULL,
*s_sys = NULL, *s_specfile = NULL, *s_path = NULL;
@@ -131,6 +132,17 @@ do_selinux_relabel (const char *specfile, const char *path,
if (setfiles_has_option (&flag_C, 'C'))
ADD_ARG (argv, i, "-C");
+ /* If the appliance is being run with multiple vCPUs, running setfiles
+ * in multithreading mode might speeds up the process. Option "-T" was
+ * introduced in SELinux userspace v3.4, and we need to check whether it's
+ * supported. Passing "-T 0" creates as many threads as there're available
+ * vCPU cores.
+ * https://github.com/SELinuxProject/selinux/releases/tag/3.4
+ */
+ if (setfiles_has_option (&flag_T, 'T')) {
+ ADD_ARG (argv, i, "-T"); ADD_ARG (argv, i, "0");
+ }
+
/* Relabelling in a chroot. */
if (STRNEQ (sysroot, "/")) {
ADD_ARG (argv, i, "-r");

View File

@ -1,4 +1,4 @@
From 4dd1ef603e18728eb960cbed9bd8e8950bd2d371 Mon Sep 17 00:00:00 2001 From ab7e68dbeefe464734bd63a862a36f612f76d396 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 29 Jul 2013 14:47:56 +0100 Date: Mon, 29 Jul 2013 14:47:56 +0100
Subject: [PATCH] RHEL: Disable unsupported remote drive protocols Subject: [PATCH] RHEL: Disable unsupported remote drive protocols
@ -31,7 +31,7 @@ We hope to gradually add some of these back over the lifetime of RHEL.
8 files changed, 16 insertions(+), 348 deletions(-) 8 files changed, 16 insertions(+), 348 deletions(-)
diff --git a/docs/guestfs-testing.pod b/docs/guestfs-testing.pod diff --git a/docs/guestfs-testing.pod b/docs/guestfs-testing.pod
index 47f381a79..c7b449284 100644 index 47f381a7..c7b44928 100644
--- a/docs/guestfs-testing.pod --- a/docs/guestfs-testing.pod
+++ b/docs/guestfs-testing.pod +++ b/docs/guestfs-testing.pod
@@ -109,26 +109,6 @@ image. To exit, type C<exit>. @@ -109,26 +109,6 @@ image. To exit, type C<exit>.
@ -62,7 +62,7 @@ index 47f381a79..c7b449284 100644
Run L<virt-alignment-scan(1)> on guests or disk images: Run L<virt-alignment-scan(1)> on guests or disk images:
diff --git a/fish/guestfish.pod b/fish/guestfish.pod diff --git a/fish/guestfish.pod b/fish/guestfish.pod
index ccc0825b8..d36cac9da 100644 index ccc0825b..d36cac9d 100644
--- a/fish/guestfish.pod --- a/fish/guestfish.pod
+++ b/fish/guestfish.pod +++ b/fish/guestfish.pod
@@ -131,9 +131,9 @@ To list what is available do: @@ -131,9 +131,9 @@ To list what is available do:
@ -171,7 +171,7 @@ index ccc0825b8..d36cac9da 100644
In this case, the password is C<pass@word>. In this case, the password is C<pass@word>.
diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh diff --git a/fish/test-add-uri.sh b/fish/test-add-uri.sh
index 21d424984..ddabeb639 100755 index 21d42498..ddabeb63 100755
--- a/fish/test-add-uri.sh --- a/fish/test-add-uri.sh
+++ b/fish/test-add-uri.sh +++ b/fish/test-add-uri.sh
@@ -40,14 +40,6 @@ function fail () @@ -40,14 +40,6 @@ function fail ()
@ -220,7 +220,7 @@ index 21d424984..ddabeb639 100755
rm test-add-uri.out rm test-add-uri.out
rm test-add-uri.img rm test-add-uri.img
diff --git a/generator/actions_core.ml b/generator/actions_core.ml diff --git a/generator/actions_core.ml b/generator/actions_core.ml
index c8d9949ba..26c576c72 100644 index c8d9949b..26c576c7 100644
--- a/generator/actions_core.ml --- a/generator/actions_core.ml
+++ b/generator/actions_core.ml +++ b/generator/actions_core.ml
@@ -350,29 +350,6 @@ F<filename> is interpreted as a local file or device. @@ -350,29 +350,6 @@ F<filename> is interpreted as a local file or device.
@ -305,7 +305,7 @@ index c8d9949ba..26c576c72 100644
example if using the libvirt backend and if the libvirt backend is configured to example if using the libvirt backend and if the libvirt backend is configured to
start the qemu appliance as a special user such as C<qemu.qemu>. If in doubt, start the qemu appliance as a special user such as C<qemu.qemu>. If in doubt,
diff --git a/lib/drives.c b/lib/drives.c diff --git a/lib/drives.c b/lib/drives.c
index c5a208468..efb289254 100644 index c5a20846..efb28925 100644
--- a/lib/drives.c --- a/lib/drives.c
+++ b/lib/drives.c +++ b/lib/drives.c
@@ -166,6 +166,7 @@ create_drive_non_file (guestfs_h *g, @@ -166,6 +166,7 @@ create_drive_non_file (guestfs_h *g,
@ -373,7 +373,7 @@ index c5a208468..efb289254 100644
error (g, _("unknown protocol %s"), protocol); error (g, _("unknown protocol %s"), protocol);
drv = NULL; /*FALLTHROUGH*/ drv = NULL; /*FALLTHROUGH*/
diff --git a/lib/guestfs.pod b/lib/guestfs.pod diff --git a/lib/guestfs.pod b/lib/guestfs.pod
index c6c8cb168..866a46380 100644 index c6c8cb16..866a4638 100644
--- a/lib/guestfs.pod --- a/lib/guestfs.pod
+++ b/lib/guestfs.pod +++ b/lib/guestfs.pod
@@ -723,70 +723,6 @@ a qcow2 backing file specification, libvirt does not construct an @@ -723,70 +723,6 @@ a qcow2 backing file specification, libvirt does not construct an
@ -491,7 +491,7 @@ index c6c8cb168..866a46380 100644
Libguestfs has APIs for inspecting an unknown disk image to find out Libguestfs has APIs for inspecting an unknown disk image to find out
diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh
index d86a1ecd0..cf7d2a0c9 100755 index d86a1ecd..cf7d2a0c 100755
--- a/tests/disks/test-qemu-drive-libvirt.sh --- a/tests/disks/test-qemu-drive-libvirt.sh
+++ b/tests/disks/test-qemu-drive-libvirt.sh +++ b/tests/disks/test-qemu-drive-libvirt.sh
@@ -65,34 +65,6 @@ check_output @@ -65,34 +65,6 @@ check_output
@ -530,7 +530,7 @@ index d86a1ecd0..cf7d2a0c9 100755
$guestfish -d pool1 run ||: $guestfish -d pool1 run ||:
diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh
index 12937fb30..b3e4f9903 100755 index 12937fb3..b3e4f990 100755
--- a/tests/disks/test-qemu-drive.sh --- a/tests/disks/test-qemu-drive.sh
+++ b/tests/disks/test-qemu-drive.sh +++ b/tests/disks/test-qemu-drive.sh
@@ -62,45 +62,6 @@ check_output @@ -62,45 +62,6 @@ check_output
@ -604,6 +604,3 @@ index 12937fb30..b3e4f9903 100755
-check_output -check_output
-grep -sq -- '-drive file=ssh://rich@example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail -grep -sq -- '-drive file=ssh://rich@example.com/disk.img,' "$DEBUG_QEMU_FILE" || fail
-rm "$DEBUG_QEMU_FILE" -rm "$DEBUG_QEMU_FILE"
--
2.31.1

View File

@ -1,4 +1,4 @@
From edb7b889a7d1895561be29b6c2879b21c6b6ef1d Mon Sep 17 00:00:00 2001 From b74c6c8520773c2ef4a4d69b08b70e5ceeb06964 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Jul 2015 09:28:03 -0400 Date: Tue, 7 Jul 2015 09:28:03 -0400
Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for
@ -13,7 +13,7 @@ edits.
3 files changed, 19 insertions(+) 3 files changed, 19 insertions(+)
diff --git a/generator/c.ml b/generator/c.ml diff --git a/generator/c.ml b/generator/c.ml
index 447059b8a..0391dd3dd 100644 index 447059b8..0391dd3d 100644
--- a/generator/c.ml --- a/generator/c.ml
+++ b/generator/c.ml +++ b/generator/c.ml
@@ -1846,6 +1846,22 @@ and generate_client_actions actions () = @@ -1846,6 +1846,22 @@ and generate_client_actions actions () =
@ -40,7 +40,7 @@ index 447059b8a..0391dd3dd 100644
* as a progress bar hint. * as a progress bar hint.
*) *)
diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh 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 16debd12..1c13ddac 100755
--- a/test-data/phony-guests/make-windows-img.sh --- a/test-data/phony-guests/make-windows-img.sh
+++ b/test-data/phony-guests/make-windows-img.sh +++ b/test-data/phony-guests/make-windows-img.sh
@@ -37,6 +37,7 @@ fi @@ -37,6 +37,7 @@ fi
@ -52,7 +52,7 @@ index 16debd129..1c13ddac3 100755
run run
diff --git a/tests/charsets/test-charset-fidelity.c b/tests/charsets/test-charset-fidelity.c diff --git a/tests/charsets/test-charset-fidelity.c b/tests/charsets/test-charset-fidelity.c
index 105291dc3..5ca4f3b6d 100644 index 105291dc..5ca4f3b6 100644
--- a/tests/charsets/test-charset-fidelity.c --- a/tests/charsets/test-charset-fidelity.c
+++ b/tests/charsets/test-charset-fidelity.c +++ b/tests/charsets/test-charset-fidelity.c
@@ -96,6 +96,8 @@ main (int argc, char *argv[]) @@ -96,6 +96,8 @@ main (int argc, char *argv[])
@ -64,6 +64,3 @@ index 105291dc3..5ca4f3b6d 100644
if (guestfs_add_drive_scratch (g, 1024*1024*1024, -1) == -1) if (guestfs_add_drive_scratch (g, 1024*1024*1024, -1) == -1)
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
--
2.31.1

View File

@ -1,4 +1,4 @@
From e61cb8e18d283d78e71634653b5342511641bebb Mon Sep 17 00:00:00 2001 From e916ad54c31a725cbf08fb186756d9e968ff20b2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Feb 2023 13:20:36 +0000 Date: Tue, 7 Feb 2023 13:20:36 +0000
Subject: [PATCH] Remove virt-dib Subject: [PATCH] Remove virt-dib
@ -14,7 +14,7 @@ Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1910039
1 file changed, 30 deletions(-) 1 file changed, 30 deletions(-)
diff --git a/appliance/packagelist.in b/appliance/packagelist.in diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index 585d52ad3..20b08c470 100644 index 585d52ad..20b08c47 100644
--- a/appliance/packagelist.in --- a/appliance/packagelist.in
+++ b/appliance/packagelist.in +++ b/appliance/packagelist.in
@@ -110,7 +110,6 @@ ifelse(ARCHLINUX,1, @@ -110,7 +110,6 @@ ifelse(ARCHLINUX,1,
@ -61,6 +61,3 @@ index 585d52ad3..20b08c470 100644
dnl exFAT is not usually available in free software repos dnl exFAT is not usually available in free software repos
exfat-fuse exfat-fuse
exfat-utils exfat-utils
--
2.31.1

View File

@ -1,4 +1,4 @@
From 14679ced98c82fe61d97159375c46ffdc9a7502a Mon Sep 17 00:00:00 2001 From e712c4b81cbd2cf0e990d01cb4d1f54734e62de6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 9 Feb 2023 13:38:50 +0000 Date: Thu, 9 Feb 2023 13:38:50 +0000
Subject: [PATCH] lib: Choose q35 machine type for x86-64 Subject: [PATCH] lib: Choose q35 machine type for x86-64
@ -17,7 +17,7 @@ See-also: https://listman.redhat.com/archives/libguestfs/2023-February/030645.ht
1 file changed, 3 insertions(+) 1 file changed, 3 insertions(+)
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index 306f2a2e6..fb55e0261 100644 index 306f2a2e..fb55e026 100644
--- a/lib/guestfs-internal.h --- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h +++ b/lib/guestfs-internal.h
@@ -113,6 +113,9 @@ cleanup_mutex_unlock (pthread_mutex_t **ptr) @@ -113,6 +113,9 @@ cleanup_mutex_unlock (pthread_mutex_t **ptr)
@ -30,6 +30,3 @@ index 306f2a2e6..fb55e0261 100644
#ifdef __arm__ #ifdef __arm__
#define MACHINE_TYPE "virt" #define MACHINE_TYPE "virt"
#endif #endif
--
2.31.1

View File

@ -1,4 +1,4 @@
From 24458a2420f673da4378f8dd1ea8bfe2fbaa35e1 Mon Sep 17 00:00:00 2001 From 73061a7feafcc0a527d00f6e1e2dee3dc84bc044 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com> From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 2 Mar 2023 10:12:19 +0000 Date: Thu, 2 Mar 2023 10:12:19 +0000
Subject: [PATCH] RHEL: Revert "build: Remove bundled copy of ocaml-augeas" Subject: [PATCH] RHEL: Revert "build: Remove bundled copy of ocaml-augeas"
@ -34,7 +34,7 @@ This reverts commit fbf7fe87933ac24dd78362a16117c42e40da4c0f.
create mode 100644 bundled/ocaml-augeas/augeas.mli create mode 100644 bundled/ocaml-augeas/augeas.mli
diff --git a/.gitignore b/.gitignore diff --git a/.gitignore b/.gitignore
index 00e59fb37..ee5ea74dd 100644 index 00e59fb3..ee5ea74d 100644
--- a/.gitignore --- a/.gitignore
+++ b/.gitignore +++ b/.gitignore
@@ -61,6 +61,7 @@ Makefile.in @@ -61,6 +61,7 @@ Makefile.in
@ -46,7 +46,7 @@ index 00e59fb37..ee5ea74dd 100644
/config.cache /config.cache
/config.guess /config.guess
diff --git a/Makefile.am b/Makefile.am diff --git a/Makefile.am b/Makefile.am
index 593704407..e0a7f0844 100644 index 59370440..e0a7f084 100644
--- a/Makefile.am --- a/Makefile.am
+++ b/Makefile.am +++ b/Makefile.am
@@ -35,6 +35,7 @@ SUBDIRS += include lib docs examples @@ -35,6 +35,7 @@ SUBDIRS += include lib docs examples
@ -77,7 +77,7 @@ index 593704407..e0a7f0844 100644
grep -v -E '^perl/lib/Sys/Guestfs\.c$$' | \ grep -v -E '^perl/lib/Sys/Guestfs\.c$$' | \
diff --git a/bundled/ocaml-augeas/COPYING.LIB b/bundled/ocaml-augeas/COPYING.LIB diff --git a/bundled/ocaml-augeas/COPYING.LIB b/bundled/ocaml-augeas/COPYING.LIB
new file mode 100644 new file mode 100644
index 000000000..ba2be481c index 00000000..ba2be481
--- /dev/null --- /dev/null
+++ b/bundled/ocaml-augeas/COPYING.LIB +++ b/bundled/ocaml-augeas/COPYING.LIB
@@ -0,0 +1,515 @@ @@ -0,0 +1,515 @@
@ -598,7 +598,7 @@ index 000000000..ba2be481c
+ +
diff --git a/bundled/ocaml-augeas/Makefile.am b/bundled/ocaml-augeas/Makefile.am diff --git a/bundled/ocaml-augeas/Makefile.am b/bundled/ocaml-augeas/Makefile.am
new file mode 100644 new file mode 100644
index 000000000..b6122eab0 index 00000000..b6122eab
--- /dev/null --- /dev/null
+++ b/bundled/ocaml-augeas/Makefile.am +++ b/bundled/ocaml-augeas/Makefile.am
@@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
@ -686,7 +686,7 @@ index 000000000..b6122eab0
+-include .depend +-include .depend
diff --git a/bundled/ocaml-augeas/augeas-c.c b/bundled/ocaml-augeas/augeas-c.c diff --git a/bundled/ocaml-augeas/augeas-c.c b/bundled/ocaml-augeas/augeas-c.c
new file mode 100644 new file mode 100644
index 000000000..679bcb50b index 00000000..679bcb50
--- /dev/null --- /dev/null
+++ b/bundled/ocaml-augeas/augeas-c.c +++ b/bundled/ocaml-augeas/augeas-c.c
@@ -0,0 +1,579 @@ @@ -0,0 +1,579 @@
@ -1271,7 +1271,7 @@ index 000000000..679bcb50b
+} +}
diff --git a/bundled/ocaml-augeas/augeas.README b/bundled/ocaml-augeas/augeas.README diff --git a/bundled/ocaml-augeas/augeas.README b/bundled/ocaml-augeas/augeas.README
new file mode 100644 new file mode 100644
index 000000000..938dfd255 index 00000000..938dfd25
--- /dev/null --- /dev/null
+++ b/bundled/ocaml-augeas/augeas.README +++ b/bundled/ocaml-augeas/augeas.README
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
@ -1286,7 +1286,7 @@ index 000000000..938dfd255
\ No newline at end of file \ No newline at end of file
diff --git a/bundled/ocaml-augeas/augeas.ml b/bundled/ocaml-augeas/augeas.ml diff --git a/bundled/ocaml-augeas/augeas.ml b/bundled/ocaml-augeas/augeas.ml
new file mode 100644 new file mode 100644
index 000000000..aa5a18226 index 00000000..aa5a1822
--- /dev/null --- /dev/null
+++ b/bundled/ocaml-augeas/augeas.ml +++ b/bundled/ocaml-augeas/augeas.ml
@@ -0,0 +1,99 @@ @@ -0,0 +1,99 @@
@ -1391,7 +1391,7 @@ index 000000000..aa5a18226
+ Callback.register_exception "Augeas.Error" (Error (AugErrInternal, "", "", "", "")) + Callback.register_exception "Augeas.Error" (Error (AugErrInternal, "", "", "", ""))
diff --git a/bundled/ocaml-augeas/augeas.mli b/bundled/ocaml-augeas/augeas.mli diff --git a/bundled/ocaml-augeas/augeas.mli b/bundled/ocaml-augeas/augeas.mli
new file mode 100644 new file mode 100644
index 000000000..8cbeae188 index 00000000..8cbeae18
--- /dev/null --- /dev/null
+++ b/bundled/ocaml-augeas/augeas.mli +++ b/bundled/ocaml-augeas/augeas.mli
@@ -0,0 +1,164 @@ @@ -0,0 +1,164 @@
@ -1560,7 +1560,7 @@ index 000000000..8cbeae188
+ file to which [path] belongs, or [None] if [path] does not + file to which [path] belongs, or [None] if [path] does not
+ represent any file. *) + represent any file. *)
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 0db212978..d1397f63d 100644 index 0db21297..d1397f63 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -195,6 +195,7 @@ AC_CONFIG_FILES([run], @@ -195,6 +195,7 @@ AC_CONFIG_FILES([run],
@ -1572,7 +1572,7 @@ index 0db212978..d1397f63d 100644
common/edit/Makefile common/edit/Makefile
common/mlpcre/Makefile common/mlpcre/Makefile
diff --git a/daemon/Makefile.am b/daemon/Makefile.am diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index bb2e58d01..bd1920c61 100644 index bb2e58d0..bd1920c6 100644
--- a/daemon/Makefile.am --- a/daemon/Makefile.am
+++ b/daemon/Makefile.am +++ b/daemon/Makefile.am
@@ -215,9 +215,9 @@ guestfsd_SOURCES = \ @@ -215,9 +215,9 @@ guestfsd_SOURCES = \
@ -1613,7 +1613,7 @@ index bb2e58d01..bd1920c61 100644
daemon_utils_tests_DEPENDENCIES = \ daemon_utils_tests_DEPENDENCIES = \
diff --git a/docs/guestfs-building.pod b/docs/guestfs-building.pod diff --git a/docs/guestfs-building.pod b/docs/guestfs-building.pod
index 5a7fa40f5..b9bc885a0 100644 index 5a7fa40f..b9bc885a 100644
--- a/docs/guestfs-building.pod --- a/docs/guestfs-building.pod
+++ b/docs/guestfs-building.pod +++ b/docs/guestfs-building.pod
@@ -172,11 +172,6 @@ I<Required>. @@ -172,11 +172,6 @@ I<Required>.
@ -1629,7 +1629,7 @@ index 5a7fa40f5..b9bc885a0 100644
I<Required>. I<Required>.
diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod
index e1b47ec11..68cf82924 100644 index e1b47ec1..68cf8292 100644
--- a/docs/guestfs-hacking.pod --- a/docs/guestfs-hacking.pod
+++ b/docs/guestfs-hacking.pod +++ b/docs/guestfs-hacking.pod
@@ -71,6 +71,20 @@ Various build scripts used by autotools. @@ -71,6 +71,20 @@ Various build scripts used by autotools.
@ -1654,7 +1654,7 @@ index e1b47ec11..68cf82924 100644
The L<virt-cat(1)>, L<virt-filesystems(1)>, L<virt-log(1)>, The L<virt-cat(1)>, L<virt-filesystems(1)>, L<virt-log(1)>,
diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4 diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4
index 850207177..51072c1aa 100644 index 85020717..51072c1a 100644
--- a/m4/guestfs-ocaml.m4 --- a/m4/guestfs-ocaml.m4
+++ b/m4/guestfs-ocaml.m4 +++ b/m4/guestfs-ocaml.m4
@@ -132,14 +132,6 @@ AS_IF([test "x$have_Hivex_OPEN_UNSAFE" = "xno"],[ @@ -132,14 +132,6 @@ AS_IF([test "x$have_Hivex_OPEN_UNSAFE" = "xno"],[
@ -1673,7 +1673,7 @@ index 850207177..51072c1aa 100644
# should replace with regular tests one day). If used, oUnit >= 2 is # should replace with regular tests one day). If used, oUnit >= 2 is
# required. # required.
diff --git a/ocaml-dep.sh.in b/ocaml-dep.sh.in diff --git a/ocaml-dep.sh.in b/ocaml-dep.sh.in
index 385a1e6e2..c9e9e3e61 100755 index 385a1e6e..c9e9e3e6 100755
--- a/ocaml-dep.sh.in --- a/ocaml-dep.sh.in
+++ b/ocaml-dep.sh.in +++ b/ocaml-dep.sh.in
@@ -33,6 +33,7 @@ set -e @@ -33,6 +33,7 @@ set -e
@ -1684,6 +1684,3 @@ index 385a1e6e2..c9e9e3e61 100755
common/mlgettext common/mlgettext
common/mlpcre common/mlpcre
common/mlstdutils common/mlstdutils
--
2.31.1

View File

@ -3,8 +3,7 @@
set -e set -e
# Maintainer script to copy patches from the git repo to the current # Maintainer script to copy patches from the git repo to the current
# directory. It's normally only used downstream (ie. in RHEL). Use # directory. Use it like this:
# it like this:
# ./copy-patches.sh # ./copy-patches.sh
project=libguestfs project=libguestfs
@ -37,7 +36,12 @@ git rm -f [0-9]*.patch ||:
rm -f [0-9]*.patch rm -f [0-9]*.patch
# Get the patches. # Get the patches.
(cd $git_checkout; rm -f [0-9]*.patch; git -c core.abbrev=9 format-patch -O/dev/null -N --submodule=diff $tag) (
cd $git_checkout
rm -f [0-9]*.patch
git -c core.abbrev=8 format-patch -O/dev/null --subject-prefix=PATCH -N \
--submodule=diff --no-signature --patience $tag
)
mv $git_checkout/[0-9]*.patch . mv $git_checkout/[0-9]*.patch .
# Remove any not to be applied. # Remove any not to be applied.

View File

@ -48,7 +48,7 @@ Summary: Access and modify virtual machine disk images
Name: libguestfs Name: libguestfs
Epoch: 1 Epoch: 1
Version: 1.50.1 Version: 1.50.1
Release: 3%{?dist} Release: 4%{?dist}
License: LGPLv2+ License: LGPLv2+
# Build only for architectures that have a kernel # Build only for architectures that have a kernel
@ -86,11 +86,16 @@ Source8: copy-patches.sh
# https://github.com/libguestfs/libguestfs/commits/rhel-9.3 # https://github.com/libguestfs/libguestfs/commits/rhel-9.3
# Patches. # Patches.
Patch0001: 0001-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch #Patch0001: 0001-update-common-submodule.patch
Patch0002: 0002-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch Patch0002: 0002-update-common-submodule.patch
Patch0003: 0003-Remove-virt-dib.patch Patch0003: 0003-daemon-selinux-relabel-don-t-exclude-selinux-if-it-s.patch
Patch0004: 0004-lib-Choose-q35-machine-type-for-x86-64.patch Patch0004: 0004-daemon-selinux-relabel-search-for-invalid-option-in-.patch
Patch0005: 0005-RHEL-Revert-build-Remove-bundled-copy-of-ocaml-augea.patch Patch0005: 0005-daemon-selinux-relabel-run-setfiles-with-T-0-if-supp.patch
Patch0006: 0006-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch
Patch0007: 0007-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
Patch0008: 0008-Remove-virt-dib.patch
Patch0009: 0009-lib-Choose-q35-machine-type-for-x86-64.patch
Patch0010: 0010-RHEL-Revert-build-Remove-bundled-copy-of-ocaml-augea.patch
%if 0%{patches_touch_autotools} %if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool, gettext-devel BuildRequires: autoconf, automake, libtool, gettext-devel
@ -1094,18 +1099,13 @@ rm ocaml/html/.gitignore
%changelog %changelog
* Tue Mar 07 2023 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-3 * Thu May 04 2023 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-4
- Bump and rebuild because of RHEL 9.3 shipshow #2
* Tue Mar 07 2023 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-2
- Bump and rebuild because of RHEL 9.3 shipshow
rhbz#2168625
* Thu Mar 02 2023 Richard W.M. Jones <rjones@redhat.com> - 1:1.50.1-1
- Rebase libguestfs to 1.50.1 - Rebase libguestfs to 1.50.1
resolves: rhbz#2168625 resolves: rhbz#2168625
- Use q35 machine type for libguestfs appliance - Use q35 machine type for libguestfs appliance
resolves: rhbz#2168578 resolves: rhbz#2168578
- Run SELinux relabelling in parallel [for virt-v2v]
resolves: rhbz#2190276
* Fri Dec 02 2022 Richard W.M. Jones <rjones@redhat.com> - 1:1.48.4-4 * Fri Dec 02 2022 Richard W.M. Jones <rjones@redhat.com> - 1:1.48.4-4
- New API: guestfs_inspect_get_build_id - New API: guestfs_inspect_get_build_id