From d1387f8f8a94e8dde53b6e5e4ac83087b013aa5d Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Thu, 12 Oct 2023 00:47:06 +0200 Subject: [PATCH] testing/libguestfs: rewrite aport and upgrade to 1.50.1 I removed all unnecessary dependencies and obsolete workarounds. --- testing/libguestfs/APKBUILD | 111 +++++++++---------- testing/libguestfs/fix-missing-error-h.patch | 46 ++++++++ testing/libguestfs/fix-missing-int64_t.patch | 22 ++++ testing/libguestfs/ocaml-m4.patch | 25 ----- 4 files changed, 120 insertions(+), 84 deletions(-) create mode 100644 testing/libguestfs/fix-missing-error-h.patch create mode 100644 testing/libguestfs/fix-missing-int64_t.patch delete mode 100644 testing/libguestfs/ocaml-m4.patch diff --git a/testing/libguestfs/APKBUILD b/testing/libguestfs/APKBUILD index d923f0ec0d2..471d3a399d1 100644 --- a/testing/libguestfs/APKBUILD +++ b/testing/libguestfs/APKBUILD @@ -1,91 +1,83 @@ -# Maintainer: Fathi Boudra +# Contributor: Fathi Boudra +# Maintainer: Jakub Jirutka pkgname=libguestfs -pkgver=1.44.1 +pkgver=1.50.1 pkgrel=0 pkgdesc="Access and modify virtual machine disk images" url="https://libguestfs.org/" -# only x86_64 is supported unless the qemu-system-x86_64 dependency can be parameterized with $arch -arch="x86_64" -# arch="all !s390x" # limited by libvirt-dev +# riscv64: blocked by ocaml +arch="all !riscv64" license="GPL-2.0-or-later" depends=" - cdrkit + cmd:mkisofs curl - gptfdisk qemu-img - qemu-system-x86_64 " makedepends=" acl-dev augeas-dev - autoconf - automake bash bison + cmd:xzcat + cmd:zstdcat coreutils - cpio file-dev flex fuse-dev gawk - gettext-dev gperf hivex-dev jansson-dev libcap-dev libconfig-dev - libselinux-dev - libselinux-utils libtirpc-dev - libtool - libvirt-dev libxml2-dev - libxml2-utils - ncurses-dev + musl-libintl ocaml ocaml-findlib - pcre-dev + pcre2-dev perl - psmisc python3-dev - qemu-system-aarch64 - qemu-system-arm - qemu-system-i386 - qemu-system-ppc64 - qemu-system-s390x - qemu-system-x86_64 readline-dev - xz - xz-dev " subpackages=" + $pkgname-static $pkgname-dev $pkgname-doc - $pkgname-lang + guestfs-tools py3-$pkgname:_py " -source="http://download.libguestfs.org/1.44-stable/libguestfs-$pkgver.tar.gz - https://raw.githubusercontent.com/alpinelinux/aports/3.9-stable/main/kbd/error.h - ocaml-m4.patch +source="https://download.libguestfs.org/${pkgver%.*}-stable/libguestfs-$pkgver.tar.gz + fix-missing-int64_t.patch + fix-missing-error-h.patch " -options="!check charset.alias" # Test suite does not support Alpine Linux at this moment +options="!check" # XXX: Test suite does not support Alpine Linux at this moment + +case "$CARCH" in + arm*) _qemu="qemu-system-arm";; + ppc64le) _qemu="qemu-system-ppc64";; + x86_64 | x86) _qemu="qemu-system-x86_64";; + *) _qemu="qemu-system-$CARCH";; +esac +depends="$depends $_qemu" prepare() { default_prepare - autoreconf -vif - # busybox gzip does not support --best sed -i 's/gzip --best/gzip -9/g' test-data/files/* - # musl lacks error.h - cp -a "$srcdir"/error.h "$builddir"/lib/ } build() { + # TODO: build and package appliance + # NOTE: libvirt is a huge dependency linked into libguestfs.so, + # so it cannot be easily split. PYTHON=/usr/bin/python3 ./configure \ --prefix=/usr \ --mandir=/usr/share/man \ --sysconfdir=/etc \ + --disable-nls \ + --enable-fuse \ --disable-probes \ --disable-daemon \ --disable-appliance \ @@ -98,35 +90,36 @@ build() { --disable-lua \ --disable-golang \ --disable-gobject \ - --without-java - # Building index-parse.c and index-scan.c by hand works around a race - # condition in the autotools cruft, where two other more copies of yacc - # race with each other, resulting in a corrupted file. - make -j1 -C builder index-parse.c - make -j1 -C builder index-scan.c - make V=1 INSTALLDIRS=vendor LTLIBINTL=-lintl + --disable-rust \ + --enable-vala=no \ + --with-readline \ + --without-java \ + --without-libvirt \ + --with-qemu="$_qemu" + make V=1 } -# FIXME test require supermin to create an appliance or a prebuilt binary appliance -# check() { -# cd "$builddir" -# wget http://download.libguestfs.org/binaries/appliance/appliance-1.38.0.tar.xz -O /tmp/appliance-1.38.0.tar.xz -# $(cd /tmp && tar xf appliance-1.38.0.tar.xz) -# export LIBGUESTFS_PATH=/tmp/appliance -# make quickcheck -# } - package() { - make V=1 INSTALLDIRS=vendor DESTDIR="$pkgdir" install - make V=1 INSTALLDIRS=vendor DESTDIR="$pkgdir" -C python install + make V=1 DESTDIR="$pkgdir" install +} + +tools() { + pkgdesc="$pkgdesc (CLI tools)" + depends="" + + amove etc + amove usr/bin } _py() { - pkgdesc="$pkgname - Python 3 bindings" + pkgdesc="Python 3 bindings for libguestfs" + depends="" amove usr/lib/python3* } -sha512sums="db6eab7350d9318a5ad5f968b24ed77ab411c9be3476b62b2b8448cf06db2462af1e3c9d8b02b54011d43651c281d74db7cb8023426a3f09667aa5b3597c7c33 libguestfs-1.44.1.tar.gz -c66f6b0d8c8b8d285c740bdbe7130dee272ac01cd5e73b35a58cedf1a77fe8d9e062631b804fb58014d8eb9861c8f28aed07bc022ef31662bcc61b5c85a21752 error.h -20c0e0abe7c30d55c9335a8579aac654603cf29d0074a2fbada3749529a5a121b30963ad6666d79eadab4126a73d59bcd2b01c3e118f927ac39f90681561249c ocaml-m4.patch" +sha512sums=" +237ef512a767a3d56f9705818ead6ebedcaf107d576acf844353730913ee4fc5f2b085bf7d647b693bf4760e986416ba71f628d7709fd859acf3b2a595f3ed10 libguestfs-1.50.1.tar.gz +9ca7a2ac8572553394d42eda0e02f8b694651288ce58f1f4c7569eaab81cd3295b0992dcd6452a42b4b284cec54a666fd277eafcee05d54d05b1e84560ac7b06 fix-missing-int64_t.patch +e4d0cac4ba856d871ca524ebeb4dedf25b3a956fe6a1ab4c93481eba03954fb684621c63085526fc1846b3bffd4cbe30dadfba2b92844d24b8ec277c0e84bf5c fix-missing-error-h.patch +" diff --git a/testing/libguestfs/fix-missing-error-h.patch b/testing/libguestfs/fix-missing-error-h.patch new file mode 100644 index 00000000000..7cdf3eaf8a3 --- /dev/null +++ b/testing/libguestfs/fix-missing-error-h.patch @@ -0,0 +1,46 @@ +From: Jakub Jirutka +Date: Thu, 12 Oct 2023 01:05:47 +0200 +Subject: [PATCH] Fix not found in libvirt-is-version.c + + libvirt-is-version.c:26:10: fatal error: error.h: No such file or directory + 26 | #include + | ^~~~~~~~~ + + libvirt-is-version.c:(.text+0x61): undefined reference to `error' + ld: libvirt_is_version-libvirt-is-version.o: in function `main': + libvirt-is-version.c:(.text.startup+0xa9): undefined reference to `error' + +--- a/lib/Makefile.am ++++ b/lib/Makefile.am +@@ -178,10 +178,12 @@ + + libvirt_is_version_LDADD = \ + $(LIBVIRT_LIBS) \ +- $(LTLIBINTL) ++ $(LTLIBINTL) \ ++ ../gnulib/lib/libgnu.la + + libvirt_is_version_CPPFLAGS = \ +- -DLOCALEBASEDIR=\""$(datadir)/locale"\" ++ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ ++ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib + + libvirt_is_version_CFLAGS = \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ +--- a/lib/Makefile.in ++++ b/lib/Makefile.in +@@ -1115,10 +1115,12 @@ + @HAVE_LIBVIRT_TRUE@libvirt_is_version_SOURCES = libvirt-is-version.c + @HAVE_LIBVIRT_TRUE@libvirt_is_version_LDADD = \ + @HAVE_LIBVIRT_TRUE@ $(LIBVIRT_LIBS) \ +-@HAVE_LIBVIRT_TRUE@ $(LTLIBINTL) ++@HAVE_LIBVIRT_TRUE@ $(LTLIBINTL) \ ++@HAVE_LIBVIRT_TRUE@ ../gnulib/lib/libgnu.la + + @HAVE_LIBVIRT_TRUE@libvirt_is_version_CPPFLAGS = \ +-@HAVE_LIBVIRT_TRUE@ -DLOCALEBASEDIR=\""$(datadir)/locale"\" ++@HAVE_LIBVIRT_TRUE@ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ ++@HAVE_LIBVIRT_TRUE@ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib + + @HAVE_LIBVIRT_TRUE@libvirt_is_version_CFLAGS = \ + @HAVE_LIBVIRT_TRUE@ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ diff --git a/testing/libguestfs/fix-missing-int64_t.patch b/testing/libguestfs/fix-missing-int64_t.patch new file mode 100644 index 00000000000..0ef8e7f4ef9 --- /dev/null +++ b/testing/libguestfs/fix-missing-int64_t.patch @@ -0,0 +1,22 @@ +From: Jakub Jirutka +Date: Thu, 12 Oct 2023 01:05:47 +0200 +Subject: [PATCH] Fix unknown type name 'int64_t' + + guestfs-utils.h:62:32: error: unknown type name 'int64_t' + 62 | extern int guestfs_int_is_reg (int64_t mode); + | ^~~~~~~ + guestfs-utils.h:40:1: note: 'int64_t' is defined in header ''; did you forget to '#include '? + 39 | #include "cleanups.h" + +++ |+#include + 40 | #include "guestfs-stringlists-utils.h" + +--- a/common/utils/guestfs-utils.h ++++ b/common/utils/guestfs-utils.h +@@ -34,6 +34,7 @@ + + #include + #include ++#include + + #include "guestfs-internal-all.h" + #include "cleanups.h" diff --git a/testing/libguestfs/ocaml-m4.patch b/testing/libguestfs/ocaml-m4.patch deleted file mode 100644 index 32f2f4fbfee..00000000000 --- a/testing/libguestfs/ocaml-m4.patch +++ /dev/null @@ -1,25 +0,0 @@ -guestfs-ocaml.m4: Check caml_alloc_initialized_string - -Always check, even if --disable-ocaml is selected - ---- - m4/guestfs-ocaml.m4 | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4 -index 18f95c2..bf07799 100644 ---- a/m4/guestfs-ocaml.m4 -+++ b/m4/guestfs-ocaml.m4 -@@ -214,8 +214,7 @@ AM_CONDITIONAL([HAVE_BYTES_COMPAT_ML], - [test "x$have_Bytes_module" = "xno"]) - - dnl Check if OCaml has caml_alloc_initialized_string (added 2017). --AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && \ -- test "x$enable_ocaml" = "xyes"],[ -+AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno"],[ - AC_MSG_CHECKING([for caml_alloc_initialized_string]) - cat >conftest.c <<'EOF' - #include --- -2.31.1 -