|
|
65aaff |
From 4807dacb577167b89cb5ffb1fa1a68ddf30b9319 Mon Sep 17 00:00:00 2001
|
|
|
65aaff |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
65aaff |
Date: Tue, 9 Aug 2022 18:39:30 +0100
|
|
|
65aaff |
Subject: [PATCH] daemon: Add zstd support to guestfs_file_architecture
|
|
|
65aaff |
|
|
|
65aaff |
This is required so we can determine the file architecture of
|
|
|
65aaff |
zstd-compressed Linux kernel modules as used by OpenSUSE and maybe
|
|
|
65aaff |
other distros in future.
|
|
|
65aaff |
|
|
|
65aaff |
Note that zstd becomes a required package, but it is widely available
|
|
|
65aaff |
in current Linux distros.
|
|
|
65aaff |
|
|
|
65aaff |
The package names come from https://pkgs.org/download/zstd and my own
|
|
|
65aaff |
research.
|
|
|
65aaff |
|
|
|
65aaff |
(cherry picked from commit 0e784824e82a88e522873fec5db1a11943d637ed)
|
|
|
65aaff |
---
|
|
|
65aaff |
.gitignore | 1 +
|
|
|
65aaff |
appliance/packagelist.in | 6 ++++++
|
|
|
65aaff |
daemon/filearch.ml | 1 +
|
|
|
65aaff |
docs/guestfs-building.pod | 4 ++++
|
|
|
65aaff |
generator/actions_core.ml | 2 ++
|
|
|
65aaff |
m4/guestfs-progs.m4 | 4 ++++
|
|
|
65aaff |
test-data/Makefile.am | 1 +
|
|
|
65aaff |
test-data/files/Makefile.am | 6 ++++++
|
|
|
65aaff |
8 files changed, 25 insertions(+)
|
|
|
65aaff |
|
|
|
65aaff |
diff --git a/.gitignore b/.gitignore
|
|
|
65aaff |
index 356c01fbd..ee5ea74dd 100644
|
|
|
65aaff |
--- a/.gitignore
|
|
|
65aaff |
+++ b/.gitignore
|
|
|
65aaff |
@@ -448,6 +448,7 @@ Makefile.in
|
|
|
65aaff |
/test-data/files/initrd-x86_64.img
|
|
|
65aaff |
/test-data/files/initrd-x86_64.img.gz
|
|
|
65aaff |
/test-data/files/lib-i586.so.xz
|
|
|
65aaff |
+/test-data/files/lib-i586.so.zst
|
|
|
65aaff |
/test-data/files/test-grep.txt.gz
|
|
|
65aaff |
/test-data/phony-guests/archlinux.img
|
|
|
65aaff |
/test-data/phony-guests/blank-*.img
|
|
|
65aaff |
diff --git a/appliance/packagelist.in b/appliance/packagelist.in
|
|
|
65aaff |
index 0b79edcdd..0fc11f6ae 100644
|
|
|
65aaff |
--- a/appliance/packagelist.in
|
|
|
65aaff |
+++ b/appliance/packagelist.in
|
|
|
65aaff |
@@ -48,6 +48,7 @@ ifelse(REDHAT,1,
|
|
|
65aaff |
vim-minimal
|
|
|
65aaff |
xz
|
|
|
65aaff |
zfs-fuse
|
|
|
65aaff |
+ zstd
|
|
|
65aaff |
)
|
|
|
65aaff |
|
|
|
65aaff |
ifelse(DEBIAN,1,
|
|
|
65aaff |
@@ -88,6 +89,7 @@ dnl iproute has been renamed to iproute2
|
|
|
65aaff |
vim-tiny
|
|
|
65aaff |
xz-utils
|
|
|
65aaff |
zfs-fuse
|
|
|
65aaff |
+ zstd
|
|
|
65aaff |
uuid-runtime
|
|
|
65aaff |
)
|
|
|
65aaff |
|
|
|
65aaff |
@@ -115,6 +117,7 @@ ifelse(ARCHLINUX,1,
|
|
|
65aaff |
systemd
|
|
|
65aaff |
vim
|
|
|
65aaff |
xz
|
|
|
65aaff |
+ zstd
|
|
|
65aaff |
)
|
|
|
65aaff |
|
|
|
65aaff |
ifelse(SUSE,1,
|
|
|
65aaff |
@@ -140,6 +143,7 @@ ifelse(SUSE,1,
|
|
|
65aaff |
systemd-sysvinit
|
|
|
65aaff |
vim
|
|
|
65aaff |
xz
|
|
|
65aaff |
+ zstd
|
|
|
65aaff |
)
|
|
|
65aaff |
|
|
|
65aaff |
ifelse(FRUGALWARE,1,
|
|
|
65aaff |
@@ -185,6 +189,7 @@ ifelse(MAGEIA,1,
|
|
|
65aaff |
systemd /* for /sbin/reboot and udevd */
|
|
|
65aaff |
vim-minimal
|
|
|
65aaff |
xz
|
|
|
65aaff |
+ zstd
|
|
|
65aaff |
)
|
|
|
65aaff |
|
|
|
65aaff |
ifelse(OPENMANDRIVA,1,
|
|
|
65aaff |
@@ -203,6 +208,7 @@ ifelse(OPENMANDRIVA,1,
|
|
|
65aaff |
systemd /* for /sbin/reboot and udevd */
|
|
|
65aaff |
vim-minimal
|
|
|
65aaff |
xz
|
|
|
65aaff |
+ zstd
|
|
|
65aaff |
)
|
|
|
65aaff |
|
|
|
65aaff |
include(guestfsd.deps)
|
|
|
65aaff |
diff --git a/daemon/filearch.ml b/daemon/filearch.ml
|
|
|
65aaff |
index 67a7339e0..4d7e912c0 100644
|
|
|
65aaff |
--- a/daemon/filearch.ml
|
|
|
65aaff |
+++ b/daemon/filearch.ml
|
|
|
65aaff |
@@ -106,6 +106,7 @@ and cpio_arch magic orig_path path =
|
|
|
65aaff |
if String.find magic "gzip" >= 0 then "zcat"
|
|
|
65aaff |
else if String.find magic "bzip2" >= 0 then "bzcat"
|
|
|
65aaff |
else if String.find magic "XZ compressed" >= 0 then "xzcat"
|
|
|
65aaff |
+ else if String.find magic "Zstandard compressed" >= 0 then "zstdcat"
|
|
|
65aaff |
else "cat" in
|
|
|
65aaff |
|
|
|
65aaff |
let tmpdir = Mkdtemp.temp_dir "filearch" in
|
|
|
65aaff |
diff --git a/docs/guestfs-building.pod b/docs/guestfs-building.pod
|
|
|
65aaff |
index b93a611a6..7a7240f78 100644
|
|
|
65aaff |
--- a/docs/guestfs-building.pod
|
|
|
65aaff |
+++ b/docs/guestfs-building.pod
|
|
|
65aaff |
@@ -172,6 +172,10 @@ I<Required>.
|
|
|
65aaff |
|
|
|
65aaff |
I<Required>.
|
|
|
65aaff |
|
|
|
65aaff |
+=item zstd
|
|
|
65aaff |
+
|
|
|
65aaff |
+I<Required>.
|
|
|
65aaff |
+
|
|
|
65aaff |
=item Jansson E<ge> 2.7
|
|
|
65aaff |
|
|
|
65aaff |
I<Required>.
|
|
|
65aaff |
diff --git a/generator/actions_core.ml b/generator/actions_core.ml
|
|
|
65aaff |
index 3c9b0a9b2..553e4ec3b 100644
|
|
|
65aaff |
--- a/generator/actions_core.ml
|
|
|
65aaff |
+++ b/generator/actions_core.ml
|
|
|
65aaff |
@@ -9373,6 +9373,8 @@ with large files, such as the resulting squashfs will be over 3GB big." };
|
|
|
65aaff |
[["file_architecture"; "/bin-x86_64-dynamic.gz"]], "x86_64"), [];
|
|
|
65aaff |
InitISOFS, Always, TestResultString (
|
|
|
65aaff |
[["file_architecture"; "/lib-i586.so.xz"]], "i386"), [];
|
|
|
65aaff |
+ InitISOFS, Always, TestResultString (
|
|
|
65aaff |
+ [["file_architecture"; "/lib-i586.so.zst"]], "i386"), [];
|
|
|
65aaff |
];
|
|
|
65aaff |
shortdesc = "detect the architecture of a binary file";
|
|
|
65aaff |
longdesc = "\
|
|
|
65aaff |
diff --git a/m4/guestfs-progs.m4 b/m4/guestfs-progs.m4
|
|
|
65aaff |
index cd8662e86..22fc61367 100644
|
|
|
65aaff |
--- a/m4/guestfs-progs.m4
|
|
|
65aaff |
+++ b/m4/guestfs-progs.m4
|
|
|
65aaff |
@@ -95,6 +95,10 @@ AC_PATH_PROGS([XZCAT],[xzcat],[no])
|
|
|
65aaff |
test "x$XZCAT" = "xno" && AC_MSG_ERROR([xzcat must be installed])
|
|
|
65aaff |
AC_DEFINE_UNQUOTED([XZCAT],["$XZCAT"],[Name of xzcat program.])
|
|
|
65aaff |
|
|
|
65aaff |
+dnl Check for zstdcat (required).
|
|
|
65aaff |
+AC_PATH_PROGS([ZSTDCAT],[zstdcat],[no])
|
|
|
65aaff |
+test "x$ZSTDCAT" = "xno" && AC_MSG_ERROR([zstdcat must be installed])
|
|
|
65aaff |
+
|
|
|
65aaff |
dnl (f)lex and bison for virt-builder (required).
|
|
|
65aaff |
dnl XXX Could be optional with some work.
|
|
|
65aaff |
AC_PROG_LEX
|
|
|
65aaff |
diff --git a/test-data/Makefile.am b/test-data/Makefile.am
|
|
|
65aaff |
index b603311a1..dbecd74b9 100644
|
|
|
65aaff |
--- a/test-data/Makefile.am
|
|
|
65aaff |
+++ b/test-data/Makefile.am
|
|
|
65aaff |
@@ -85,6 +85,7 @@ image_files = \
|
|
|
65aaff |
files/initrd-x86_64.img \
|
|
|
65aaff |
files/initrd-x86_64.img.gz \
|
|
|
65aaff |
files/lib-i586.so.xz \
|
|
|
65aaff |
+ files/lib-i586.so.zst \
|
|
|
65aaff |
files/test-grep.txt.gz
|
|
|
65aaff |
|
|
|
65aaff |
noinst_DATA = test.iso
|
|
|
65aaff |
diff --git a/test-data/files/Makefile.am b/test-data/files/Makefile.am
|
|
|
65aaff |
index a3d7288f9..06b0c6585 100644
|
|
|
65aaff |
--- a/test-data/files/Makefile.am
|
|
|
65aaff |
+++ b/test-data/files/Makefile.am
|
|
|
65aaff |
@@ -40,6 +40,7 @@ noinst_DATA = \
|
|
|
65aaff |
initrd-x86_64.img \
|
|
|
65aaff |
initrd-x86_64.img.gz \
|
|
|
65aaff |
lib-i586.so.xz \
|
|
|
65aaff |
+ lib-i586.so.zst \
|
|
|
65aaff |
test-grep.txt.gz
|
|
|
65aaff |
|
|
|
65aaff |
CLEANFILES += $(noinst_DATA)
|
|
|
65aaff |
@@ -116,3 +117,8 @@ lib-i586.so.xz: $(top_srcdir)/test-data/binaries/lib-i586.so
|
|
|
65aaff |
rm -f $@ $@-t
|
|
|
65aaff |
xz -c $< > $@-t
|
|
|
65aaff |
mv $@-t $@
|
|
|
65aaff |
+
|
|
|
65aaff |
+lib-i586.so.zst: $(top_srcdir)/test-data/binaries/lib-i586.so
|
|
|
65aaff |
+ rm -f $@ $@-t
|
|
|
65aaff |
+ zstd -c $< > $@-t
|
|
|
65aaff |
+ mv $@-t $@
|
|
|
65aaff |
--
|
|
|
65aaff |
2.31.1
|
|
|
65aaff |
|