From 87b6bfd357831758b1e4c592deaa1d6bb2f7672e Mon Sep 17 00:00:00 2001 From: wk333 <13474090681@163.com> Date: Tue, 19 Apr 2022 15:56:08 +0800 Subject: [PATCH] Fix build error --- ...it-backing-format-for-all-backing-di.patch | 145 ++++++++++++++++++ Fix-defaut-function-compare-error.patch | 28 ++++ Fix-verbose-error.patch | 39 +++++ fix-not-striped.patch | 37 +++++ libguestfs.spec | 20 ++- 5 files changed, 263 insertions(+), 6 deletions(-) create mode 100644 0001-tests-Use-explicit-backing-format-for-all-backing-di.patch create mode 100644 Fix-defaut-function-compare-error.patch create mode 100644 Fix-verbose-error.patch create mode 100644 fix-not-striped.patch diff --git a/0001-tests-Use-explicit-backing-format-for-all-backing-di.patch b/0001-tests-Use-explicit-backing-format-for-all-backing-di.patch new file mode 100644 index 0000000..e9c4565 --- /dev/null +++ b/0001-tests-Use-explicit-backing-format-for-all-backing-di.patch @@ -0,0 +1,145 @@ +From 815eab8a66ba6ae5bea7445abb0fa8b54e01e158 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 6 Feb 2020 15:47:54 +0000 +Subject: [PATCH] tests: Use explicit backing format for all backing disks. + +Libvirt 6.0 now requires that every disk in the backing chain has an +explicit backing format. For example this will be rejected by +libvirt: + + qemu-img create -f qcow2 -b backing-disk disk.qcow2 + +with the error: + + Original error from libvirt: Requested operation is not valid: + format of backing image 'backing-disk' of image 'disk.qcow2' was not + specified in the image metadata (See + https://libvirt.org/kbase/backing_chains.html for troubleshooting) + [code=55 int1=-1] + +Instead you have to use the -F option to specify the format, eg: + + qemu-img create -f qcow2 -b backing-disk -F raw disk.qcow2 +--- + customize/test-virt-customize.sh | 2 +- + test-data/blank-disks/Makefile.am | 2 +- + tests/relative-paths/test-relative-paths.sh | 30 ++++++++++----------- + 3 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/customize/test-virt-customize.sh b/customize/test-virt-customize.sh +index 0c5231b4e..7817e67d4 100755 +--- a/customize/test-virt-customize.sh ++++ b/customize/test-virt-customize.sh +@@ -27,7 +27,7 @@ f=$top_builddir/test-data/phony-guests/fedora.img + fq=test-virt-customize-img.qcow + out=test-virt-customize.out + rm -f $fq $out +-qemu-img create -f qcow2 -b $f $fq ++qemu-img create -f qcow2 -b $f -F raw $fq + + # Add --no-network so UML works. + $VG virt-customize --format qcow2 -a $fq --no-network \ +diff --git a/test-data/blank-disks/Makefile.am b/test-data/blank-disks/Makefile.am +index da5692da3..6dd42bc1f 100644 +--- a/test-data/blank-disks/Makefile.am ++++ b/test-data/blank-disks/Makefile.am +@@ -50,4 +50,4 @@ blank-disk-1M.qcow2: + qemu-img create -f qcow2 -o preallocation=metadata $@ 1M + + blank-disk-with-backing.qcow2: blank-disk-1M.raw +- qemu-img create -f qcow2 -b $^ $@ ++ qemu-img create -f qcow2 -b $^ -F raw $@ +diff --git a/tests/relative-paths/test-relative-paths.sh b/tests/relative-paths/test-relative-paths.sh +index 379225903..ed9aa80d8 100755 +--- a/tests/relative-paths/test-relative-paths.sh ++++ b/tests/relative-paths/test-relative-paths.sh +@@ -36,63 +36,63 @@ mkdir -p dir1/dir2 + # Regular overlay files. + + qemu-img create -f qcow2 backing1 10M +-qemu-img create -f qcow2 -b $(pwd)/backing1 overlay1 ++qemu-img create -f qcow2 -b $(pwd)/backing1 -F qcow2 overlay1 + + qemu-img create -f qcow2 backing2 10M +-qemu-img create -f qcow2 -b backing2 overlay2 ++qemu-img create -f qcow2 -b backing2 -F qcow2 overlay2 + + qemu-img create -f qcow2 backing3 10M +-qemu-img create -f qcow2 -b ./backing3 overlay3 ++qemu-img create -f qcow2 -b ./backing3 -F qcow2 overlay3 + + qemu-img create -f qcow2 backing4 10M +-qemu-img create -f qcow2 -b ../../tests/relative-paths/backing4 overlay4 ++qemu-img create -f qcow2 -b ../../tests/relative-paths/backing4 -F qcow2 overlay4 + + qemu-img create -f qcow2 backing5 10M + pushd dir1 +-qemu-img create -f qcow2 -b ../backing5 overlay5 ++qemu-img create -f qcow2 -b ../backing5 -F qcow2 overlay5 + popd + + qemu-img create -f qcow2 backing6 10M + pushd dir1/dir2 +-qemu-img create -f qcow2 -b ../../backing6 overlay6 ++qemu-img create -f qcow2 -b ../../backing6 -F qcow2 overlay6 + popd + + qemu-img create -f qcow2 dir1/backing7 10M +-qemu-img create -f qcow2 -b dir1/backing7 overlay7 ++qemu-img create -f qcow2 -b dir1/backing7 -F qcow2 overlay7 + + qemu-img create -f qcow2 dir1/dir2/backing8 10M +-qemu-img create -f qcow2 -b dir1/dir2/backing8 overlay8 ++qemu-img create -f qcow2 -b dir1/dir2/backing8 -F qcow2 overlay8 + + qemu-img create -f qcow2 dir1/dir2/backing9 10M + pushd dir1 +-qemu-img create -f qcow2 -b dir2/backing9 overlay9 ++qemu-img create -f qcow2 -b dir2/backing9 -F qcow2 overlay9 + popd + + qemu-img create -f qcow2 dir1/backing10 10M + pushd dir1/dir2 +-qemu-img create -f qcow2 -b ../backing10 overlay10 ++qemu-img create -f qcow2 -b ../backing10 -F qcow2 overlay10 + popd + + qemu-img create -f qcow2 dir1/backing11 10M + pushd dir1 +-qemu-img create -f qcow2 -b backing11 overlay11 ++qemu-img create -f qcow2 -b backing11 -F qcow2 overlay11 + popd + + # Symbolic links. + + qemu-img create -f qcow2 backing12 10M +-qemu-img create -f qcow2 -b backing12 overlay12 ++qemu-img create -f qcow2 -b backing12 -F qcow2 overlay12 + ln -s overlay12 link12 + + qemu-img create -f qcow2 dir1/backing13 10M + pushd dir1 +-qemu-img create -f qcow2 -b backing13 overlay13 ++qemu-img create -f qcow2 -b backing13 -F qcow2 overlay13 + popd + ln -s dir1/overlay13 link13 + + qemu-img create -f qcow2 dir1/dir2/backing14 10M + pushd dir1 +-qemu-img create -f qcow2 -b dir2/backing14 overlay14 ++qemu-img create -f qcow2 -b dir2/backing14 -F qcow2 overlay14 + popd + pushd dir1/dir2 + ln -s ../overlay14 link14 +@@ -100,7 +100,7 @@ popd + + qemu-img create -f qcow2 dir1/backing15 10M + pushd dir1/dir2 +-qemu-img create -f qcow2 -b ../backing15 overlay15 ++qemu-img create -f qcow2 -b ../backing15 -F qcow2 overlay15 + popd + pushd dir1 + ln -s dir2/overlay15 link15 +-- +2.27.0 + diff --git a/Fix-defaut-function-compare-error.patch b/Fix-defaut-function-compare-error.patch new file mode 100644 index 0000000..ad54c9b --- /dev/null +++ b/Fix-defaut-function-compare-error.patch @@ -0,0 +1,28 @@ +From cc4ecbe236914f9b391ecf3815008547472632f8 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 2 Mar 2021 10:39:15 +0000 +Subject: [PATCH] mlstdutils/std_utils.ml: Fix for OCaml 4.12. + +We were using a default function from somewhere called "compare" +instead of the actual function (Pervasives.compare / Stdlib.compare). +Since the wrong default function was used it had a different type from +what we expected: +File "std_utils.ml", line 312, characters 36-37: +312 | | (y, y') :: _ when cmp x y = 0 -> y' + +Error: This expression has type int but an expression was expected of type + 'weak1 list -> int + +diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml +index 70156d1..3cacf36 100644 +--- a/common/mlstdutils/std_utils.ml ++++ b/common/mlstdutils/std_utils.ml +@@ -305,7 +305,7 @@ module List = struct + | x::xs, y::ys, z::zs -> (x, y, z) :: combine3 xs ys zs + | _ -> invalid_arg "combine3" + +- let rec assoc_lbl ?(cmp = compare) ~default x = function ++ let rec assoc_lbl ?(cmp = Pervasives.compare) ~default x = function + | [] -> default + | (y, y') :: _ when cmp x y = 0 -> y' + | _ :: ys -> assoc_lbl ~cmp ~default x ys diff --git a/Fix-verbose-error.patch b/Fix-verbose-error.patch new file mode 100644 index 0000000..846a464 --- /dev/null +++ b/Fix-verbose-error.patch @@ -0,0 +1,39 @@ +From 1941593585574849dd72c458535cd80b4d858266 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Fri, 10 Dec 2021 10:20:34 +0000 +Subject: [PATCH] Disable OCaml warning 6 completely + +Warning 6 "labels-omitted" is not useful. It's fine to omit labels on +positional arguments. + +Example: + + File "perl_edit.ml", line 30, characters 2-13: + 30 | c_edit_file (verbose ()) g (Guestfs.c_pointer g) file expr + ^^^^^^^^^^^ + Warning 6 [labels-omitted]: label verbose was omitted in the application of this function. + +The function is specified as: + + external c_edit_file : verbose:bool -> Guestfs.t -> int64 -> string -> string -> unit + +The complaint is that the verbose: label has been omitted from the +first argument when the function is called, but IMO this is a +stylistic thing, not a bug. + +(cherry picked from +guestfs-tools commit 577f7aee4b1c720f4c4826115b49a0c3870b149e) + +diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4 +index 3c504ce..5604574 100644 +--- a/m4/guestfs-ocaml.m4 ++++ b/m4/guestfs-ocaml.m4 +@@ -222,7 +222,7 @@ AS_IF([test "x$have_Hivex_OPEN_UNSAFE" = "xno"],[ + AC_SUBST([HIVEX_OPEN_UNSAFE_FLAG]) + + dnl Flags we want to pass to every OCaml compiler call. +-OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX+52-3" ++OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX+52-3 -w -6" + AC_SUBST([OCAML_WARN_ERROR]) + OCAML_FLAGS="-g -annot $safe_string_option" + AC_SUBST([OCAML_FLAGS]) diff --git a/fix-not-striped.patch b/fix-not-striped.patch new file mode 100644 index 0000000..9c9b9d3 --- /dev/null +++ b/fix-not-striped.patch @@ -0,0 +1,37 @@ +From 77c67d0e597f5408c3d005ef624ef3d417271e0e Mon Sep 17 00:00:00 2001 +From: sunguoshuai +Date: Thu, 9 Sep 2021 21:34:40 +0800 +Subject: [PATCH] fix not striped + +--- + appliance/Makefile.am | 1 + + p2v/Makefile.am | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/appliance/Makefile.am b/appliance/Makefile.am +index fc424b1..3f74636 100644 +--- a/appliance/Makefile.am ++++ b/appliance/Makefile.am +@@ -92,6 +92,7 @@ supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfs_shadow.aug + mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc tmp-d/usr/share/guestfs + ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd + ln $(srcdir)/guestfs_shadow.aug tmp-d/usr/share/guestfs/guestfs_shadow.aug ++ strip tmp-d/usr/sbin/guestfsd + ( cd tmp-d && tar zcf - * ) > $@-t + rm -r tmp-d + mv $@-t $@ +diff --git a/p2v/Makefile.am b/p2v/Makefile.am +index 92e2c50..a101d22 100644 +--- a/p2v/Makefile.am ++++ b/p2v/Makefile.am +@@ -75,6 +75,7 @@ virtp2vlib_DATA = virt-p2v.xz + + virt-p2v.xz: virt-p2v + rm -f $@ $@-t ++ strip $< + xz --best --keep --stdout $< > $@-t + mv $@-t $@ + +-- +2.30.0 + diff --git a/libguestfs.spec b/libguestfs.spec index fee4e4b..37f1978 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -4,7 +4,7 @@ Name: libguestfs Version: 1.40.2 -Release: 15 +Release: 16 Epoch: 1 Summary: A set of tools for accessing and modifying virtual machine (VM) disk images License: LGPLv2+ @@ -15,6 +15,13 @@ Source2: yum.conf.in Patch0000: 0001-libguestfs-PYTHON_LIBS-is-not-set-in-Python-3.8.patch Patch0001: 0002-fts-remove-NOSTAT_LEAF_OPTIMIZATION.patch Patch0002: 0003-port-to-php-8.0.0.patch +Patch0003: fix-not-striped.patch +# https://github.com/libguestfs/libguestfs-common/commit/cc4ecbe236914f9b391ecf3815008547472632f8 +Patch0004: Fix-defaut-function-compare-error.patch +# https://github.com/libguestfs/libguestfs/commit/1941593585574849dd72c458535cd80b4d858266 +Patch0005: Fix-verbose-error.patch +# https://github.com/libguestfs/libguestfs/commit/815eab8a66ba6ae5bea7445abb0fa8b54e01e158 +Patch0006: 0001-tests-Use-explicit-backing-format-for-all-backing-di.patch BuildRequires: gcc-c++, rpcgen, libtirpc-devel, supermin-devel >= 5.1.18, hivex-devel >= 1.2.7-7, ocaml-hivex-devel, perl(Pod::Simple), perl(Pod::Man) BuildRequires: /usr/bin/pod2text, po4a, augeas-devel >= 1.7.0, readline-devel, genisoimage, libxml2-devel, createrepo, glibc-static, libselinux-utils @@ -29,7 +36,7 @@ BuildRequires: jpackage-utils, php-devel, gobject-introspection-devel, gjs, acl, BuildRequires: bzip2, coreutils, cpio, cryptsetup, debootstrap, dhclient, diffutils, dosfstools, e2fsprogs, file, findutils, gawk, gdisk, gfs2-utils BuildRequires: grep, gzip, hivex, iproute, iputils, jfsutils, kernel, kmod, kpartx, less, libcap, libldm, libselinux, libxml2, lsof, lsscsi, lvm2, strace BuildRequires: openssh-clients, parted, pciutils, pcre, policycoreutils, procps, psmisc, qemu-img, reiserfs-utils, rsync, scrub, sed, sleuthkit, squashfs-tools -BuildRequires: systemd, tar, udev, util-linux, vim-minimal, which, xfsprogs, yajl, zerofree, hfsplus-tools, ntfs-3g, ntfsprogs gettext-devel +BuildRequires: systemd, tar, udev, util-linux, vim-minimal, which, xfsprogs, yajl, zerofree, hfsplus-tools, ntfs-3g, ntfsprogs gettext-devel binutils %ifarch x86_64 BuildRequires: syslinux syslinux-extlinux %endif @@ -219,10 +226,8 @@ fi %make_build -C builder index-parse.c \ %make_build V=1 INSTALLDIRS=vendor -( %{localconfigure} %{localmake} -)& cd ../%{name}-%{version}-python3 export PYTHON=%{__python3} @@ -374,10 +379,13 @@ install -m 0644 utils/boot-benchmark/boot-benchmark.1 $RPM_BUILD_ROOT%{_mandir}/ %exclude %{_mandir}/man1/virt-tar.1* %changelog -* Wed 13 Oct 2021 wuzhen - 1:1.40.2-15 +* Tue Apr 19 2022 wangkai - 1:1.40.2-16 +- Fix build error + +* Wed Oct 13 2021 wuzhen - 1:1.40.2-15 - Compile two packages in parallel -* Tue 20 Jul 2021 sunguoshuai - 1:1.40.2-14 +* Tue Jul 20 2021 sunguoshuai - 1:1.40.2-14 - No /var/cache/yum in build environment and add test incase no cached rpms. * Mon Mar 22 2021 lingsheng - 1:1.40.2-14 -- Gitee