Commit Graph

272 Commits

Author SHA1 Message Date
Richard W.M. Jones
d428c6fee8 build: Remove Vala bindings
They depend on gobject introspection which was removed in previous
commits.

Updates: commit 955ea8882b
2026-02-11 14:06:14 +00:00
Richard W.M. Jones
7e2170e9e0 build: Remove m4/introspection.m4
Updates: commit 955ea8882b
2026-02-11 14:06:14 +00:00
Cole Robinson
955ea8882b Remove deprecated GObject bindings
These were marked as deprecated in a57f6b8e2. Time to remove them

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2026-02-10 14:29:55 -05:00
Cole Robinson
12acfa7de3 build: replace AM_GNU_GETTEXT with simpler LIBINTL check
This reverts "m4: Add junk required to make 'AM_GNU_GETTEXT' work"
commit b9f75ca5b8

And replaces AM_GNU_GETTEXT call with a simpler LIBINTL check
(recommended by claude).

For linux builds on glibc it doesn't appear we need anything
from autotools here, since libintl.h is always available.

For some other cases like macos I think this new minimal check
covers us in the common case.

There are definitely more obscure corner cases that gettext
m4 magic covers but I suspect none of them really matter for
any platforms libguestfs already functions on.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-29 09:58:28 -04:00
Richard W.M. Jones
48bad58024 lib/launch-libvirt.c: Assume libvirt >= 9.0.0 and passt support
Libvirt 9.0.0 was released in January 2023, and it seems safe to
assume that if you're enabling the non-default backend, you can at
least use a new version of libvirt.

If you're using new libvirt, might as well also assume passt is
available.
2025-09-29 16:49:03 +01:00
Richard W.M. Jones
32bc8bcd1d docs: Remove mention of liblzma as a dependency
This is used by virt-builder, which is not part of libguestfs.
2025-06-11 14:02:36 +01:00
Richard W.M. Jones
b9f75ca5b8 m4: Add junk required to make 'AM_GNU_GETTEXT' work
Run gettextize, revert most of its changes, but add the m4/* files
that might be required.

This is a short term fix.  A better / longer-term fix is described by
Dan here:

https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/2AZNWQQ6CBRFZCAADVYQHU5UN5J2JT2F/
2025-05-19 16:17:32 +01:00
Richard W.M. Jones
0423f2cec3 build: Only require augeas and hivex if also building the daemon
These libraries are only needed if building the daemon (so not if
using ./configure --disable-daemon).  Move the tests so we only check
for these libraries if the daemon is enabled in the build.

The daemon also requires ocaml-augeas (it uses both the augeas C
library directly and the OCaml bindings for augeas, for reasons).
However that test is already disabled if the daemon is not being
built.

Reported-by: Mohamed Akram
Fixes: commit dfa9dee775
Fixes: commit 8a723ca62e
Fixes: commit 228d49bb84
Fixes: https://github.com/libguestfs/libguestfs/issues/184
2025-04-22 12:31:15 +01:00
Richard W.M. Jones
2b2be31af0 build: Remove test for libmagic
libmagic (part of the "file" command) was required in earlier versions
of libguestfs, but this requirement was effectively removed in
commit b48da89dd6 ("daemon: Reimplement ‘file_architecture’ API in
OCaml") back in 2017.  Or to be more precise, we now use the "file"
command inside the daemon, which may or may not use libmagic but we
no longer link to the library directly.

Reported-by: Mohamed Akram
Fixes: commit b48da89dd6
Related: https://github.com/libguestfs/libguestfs/issues/184
2025-04-22 12:14:04 +01:00
Richard W.M. Jones
632937d8fb m4: Stop autoconf whinging about AC_PROG_CC_STDC being obsolete
I tried using 'autoupdate' but it failed completely to do the right
thing.
2025-04-22 11:47:58 +01:00
Richard W.M. Jones
85c8445e1e build: Remove use of oUnit
This added no value over just running ordinary tests.  This also
removes a complicated OCaml dependency.
2025-03-22 12:41:39 +00:00
Richard W.M. Jones
090ea7656e build: Remove detection of lex and yacc
These are not required by libguestfs.  They were used by virt-builder,
but that tool has now been moved to a separate project
(guestfs-tools).

Fixes: commit 733d2182b6
2025-03-22 10:51:21 +00:00
denisecheng
0c70675aae support TencentOS
Signed-off-by: denisecheng <denisecheng@tencent.com>
Fixes: https://github.com/libguestfs/libguestfs/pull/172
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2025-03-03 14:22:37 +00:00
Richard W.M. Jones
72cfaff5c5 Update copyright dates for 2025
Automated using this command:

perl -pi.bak -e 's/(20[012][0-9])-20[12][01234]/$1-2025/g' `git ls-files`
2025-02-16 17:00:46 +00:00
Richard W.M. Jones
48d3264573 po-docs: Use po4a-updatepo
As far as I can tell using po4a-gettextize was wrong here.  The right
subtool for combining multiple documents into a .pot is po4a-updatepo,
so use that one instead.
2025-01-08 12:04:26 +00:00
Richard W.M. Jones
996dd8774f build: Move baseline OCaml to 4.08
OCaml 4.08.0 was released on 2019-06-14, over 5 years ago.  By
requiring a slightly later OCaml version, we can drop more
compatibility code which was only used by older versions.

Consistent with qemu & libvirt, this drops support for compiling
upstream libguestfs on RHEL 8 (ocaml-4.07.0-4.el8.x86_64).

Qemu policy:
https://www.qemu.org/docs/master/about/build-platforms.html

Libvirt policy:
https://libvirt.org/platforms.html

Update the common submodule, pulling in:

  Richard W.M. Jones (4):
      qemuopts: Add ability to add raw, unquoted output to qemu scripts
      qemuopts: Fix missing break statement
      mlstdutils: Remove Option module
      Remove test for caml_alloc_initialized_string
2024-11-21 14:30:44 +00:00
Richard W.M. Jones
9255abee02 build: Remove Jansson dependency
After previous changes, this library is no longer used.  We have
switched to json-c, for better compatibility with libvirt.

(cherry picked from
guestfs-tools commit e6dcf7e3a7e9170978e57ce6df1b34f92fac5ae3)
2024-10-22 16:44:53 +01:00
Richard W.M. Jones
53872a0a1a build: Add new dependency on json-c
This will eventually replace Jansson for all JSON parsing.  However
this commit simply introduces the new dependency in the configure
script and documents it.

I chose json-c 0.14 as the baseline since that is the version in RHEL 9.
Probably earlier versions would work.
2024-10-22 11:01:25 +01:00
Richard W.M. Jones
e37768d889 build: Assume __attribute__((cleanup)) always works
All recent compilers support this (except MS compilers which we don't
care about).  Assume it is supported.  We test it in ./configure and
hard fail if it doesn't work.

We still define HAVE_ATTRIBUTE_CLEANUP but you can now assume it is
always defined and don't have to check it.
2024-10-18 21:55:21 +01:00
Wang Guoquan
1d8924c343 libguestfs: Support openEuler
openEuler is simliar to CentOS, but the ID is not lower-case string,
as below:

    NAME="openEuler"
    VERSION="24.03 (LTS)"
    ID="openEuler"
    VERSION_ID="24.03"
    PRETTY_NAME="openEuler 24.03 (LTS)"
    ANSI_COLOR="0;31"

Signed-off-by: Wang Guoquan <wangguoquan03@foxmail.com>
2024-09-10 11:33:20 +01:00
Antonio Caggiano
bbc58ed8fb ocaml: INSTALL_OCAMLLIB Makefile parameter
Add INSTALL_OCAMLLIB parameter for allowing ocaml install to a user
defined path. If not defined, fallback to `ocamlc -where`.

Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
2024-08-13 14:00:42 +01:00
Antonio Caggiano
e17d794d11 configure: Use -map in script flags on darwin.
-M is not a valid flag for MacOS ld.

Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
2024-08-12 14:05:01 +01:00
Richard W.M. Jones
f8cbd71400 daemon: Find -lcamlstr{nat,byt} and -lunix{nat,byt}, and require -lzstd
OCaml 5.1 changes the names of these libraries for some reason.

Also in OCaml 5.1, if using those libraries you must link with -lzstd.
Since zstd was already described as "required" (although we only used
it in the appliance), there is no official change to the requirements,
but I have added a configure time check for the library.

Thanks: Jerry James <loganjerry@gmail.com>
2023-10-06 11:23:52 +01:00
cunshunxia
188c5f7d93 support OpencloudOS
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Fixes: https://github.com/libguestfs/libguestfs/pull/125
2023-09-19 11:02:23 +01:00
Richard W.M. Jones
3cb094083e Replace Pervasives.* with Stdlib.*
Since OCaml 4.07 (released 2018-07-10) the always-loaded standard
library module has been called Stdlib.  The old Pervasives module was
finally removed in OCaml 5.

$ perl -pi.bak -e 's/Pervasives\./Stdlib./g' -- `git ls-files`

OCaml >= 4.07 is now required.

Also update the common submodule with:

  commit d61cd820b49e403848d15c5deaccbf8dd7045370
  Author: Jürgen Hötzel
  Date:   Sat May 20 18:16:40 2023 +0200

    Add support for OCaml 5.0
2023-05-22 16:42:31 +01:00
Richard W.M. Jones
e2c7bddf10 Update copyright dates for 2023
Run this command across the source:

  perl -pi.bak -e 's/(20[012][0-9])-20[12][012]/$1-2023/g' `git ls-files`

and remove changes to po{,-docs}/*.po{,t} (these will be regenerated
later when we run 'make dist').
2023-02-07 10:50:48 +00:00
Richard W.M. Jones
fbf7fe8793 build: Remove bundled copy of ocaml-augeas
This is now an external dependency.
2023-01-19 23:00:23 +00:00
Andrey Drobyshev
188aa9947f m4/guestfs-appliance.m4: add VIRTUOZZO to RedHat-based distros
This allows to detect VzLinux guest.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
2022-12-09 19:01:00 +00:00
Richard W.M. Jones
26940f64a7 build: Replace Python distutils by sysconfig
This module has been deprecated in Python >= 3.10
(https://peps.python.org/pep-0632/).  Replace distutils.sysconfig with
sysconfig which is not quite a drop-in replacement.

This fix is incomplete as we still reference distutils in
python/setup.py.in.  However that is only used for PIP-style
distributions (make -C python sdist) which we don't really use or
recommend.

Thanks: Miro Hrončok
See-also: https://peps.python.org/pep-0632/
See-also: https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/N6ITYHLRWIDNYNXGPYG2ZHF3ZLQWZN7L/
2022-10-24 17:11:31 +01:00
Richard W.M. Jones
8d50637741 gnulib: Copy in error(3) replacement from gnulib
This is available under a compatible license (LGPLv2+).
2022-08-16 16:00:09 +01:00
Richard W.M. Jones
ef947a9d3b gnulib: Use system getprogname on macOS 2022-08-16 15:37:52 +01:00
Richard W.M. Jones
908e41e556 gnulib: Copy in pipe2 and accept4 replacements from gnulib
These are shipped under a compatible license (LGPLv2+ or LGPLv3+).
2022-08-16 15:37:52 +01:00
Richard W.M. Jones
b018b35bd4 lib: Remove dtrace/systemtap probes
These were added in libguestfs 1.14, but never really used.  Only a
handful of probes were available.  When I was benchmarking libguestfs
in 2016 I didn't even use these probes because better/simpler
techniques were available.
2022-08-16 15:35:17 +01:00
Richard W.M. Jones
df5805df63 configure: Use AC_FUNC_STRERROR_R
Update common submodule to include modified strerror_r replacement
2022-08-16 14:15:11 +01:00
Richard W.M. Jones
6c0e5d7f8f protocol: Replace missing xdr_uint64_t on macOS
The macOS rpcgen actually generates calls to xdr_uint64_t but doesn't
define them.  Despite this we can just use xdr_int64_t instead since
it's just byte swapping.
2022-08-16 14:03:59 +01:00
Richard W.M. Jones
c51d1cfe9a m4: Check for GNU realpath program
It is a dependency of the ocaml-dep.sh script, required for all builds.
2022-08-16 13:45:14 +01:00
Richard W.M. Jones
be60075b16 m4: Don't check for DISTRO with --disable-appliance
It is only used when building the appliance and for nothing else.
2022-08-16 13:40:15 +01:00
Richard W.M. Jones
0b3c6cc0c0 daemon: Remove remaining uses of custom printf %Q and %R
We have traditionally used custom printf formatters %Q and %R, where
%Q replaces the argument with a shell-quoted string, and %R replaces
the argument with a sysroot-prefixed shell-quoted string.  They are
actually pretty useful, but unfortunately only supported by glibc.

We only used them in about a dozen places in the daemon (much code
having been replaced by OCaml which does not need them).

In every remaining case we were constructing a command using code like
this:

  asprintf_nowarn (&cmd,
         "cd %Q && find -print0 | %s -0 -o -H %s --quiet", ...);

We can replace this with:

  char *cmd;
  size_t cmd_size;
  fp = open_memstream (&cmd, &cmd_size);
  fprintf (fp, "cd ");
  shell_quote (dir, fp);
  fprintf (fp, " && find -print0 | %s -0 -o -H %s --quiet", ...);
  fclose (fp);
2022-08-16 10:39:01 +01:00
Richard W.M. Jones
0e784824e8 daemon: Add zstd support to guestfs_file_architecture
This is required so we can determine the file architecture of
zstd-compressed Linux kernel modules as used by OpenSUSE and maybe
other distros in future.

Note that zstd becomes a required package, but it is widely available
in current Linux distros.

The package names come from https://pkgs.org/download/zstd and my own
research.
2022-08-09 19:04:41 +01:00
Richard W.M. Jones
adfaf25a12 m4: Fix ./configure --disable-ocaml
OCaml is required to compile libguestfs, however we should still be
able to disable the OCaml bindings.  This didn't work because using
--disable-ocaml caused various configure tests to be skipped which are
required to compile the daemon.  In particular the check for
caml_alloc_initialized_string, resulting in this error:

pcre-c.c:47:1: error: static declaration of ‘caml_alloc_initialized_string’ follows non-static declaration
 caml_alloc_initialized_string (mlsize_t len, const char *p)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Also OCaml gettext is not required by libguestfs.  There are no *.ml
files used by libguestfs which require translation.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2108425
Fixes: https://bugs.gentoo.org/820053
Fixes: commit 733d2182b6
2022-07-20 10:11:09 +01:00
Richard W.M. Jones
7afbf5ee44 build: Pick first field in ID_LIKE
CentOS Stream has:

ID_LIKE="rhel fedora"

which confused the existing script.  If there are multiple "likes"
arbitrarily pick the first one in the list.

Fixes: commit 63b722b6c0
2022-05-26 14:11:01 +01:00
Richard W.M. Jones
63b722b6c0 build: When parsing distro from /etc/os-release, try $ID_LIKE first
The current code for working out the distro uses the ID entry from
/etc/os-release, and then we map those strings into a smaller set of
values (basically, what package manager to use).  However it was
suggested that we should try ID_LIKE first so that distros which act
like other distros would work.  On an Arch Linux 32 system:

ID=arch32
ID_LIKE=arch

See-also: https://github.com/libguestfs/libguestfs/issues/81
Thanks: S D Rausty
2022-05-22 18:36:11 +01:00
Neil Hanlon
a3487ef4c5 build: Add ROCKY to REDHAT distros list 2022-05-16 09:48:05 +01:00
Richard W.M. Jones
f9babf8c04 m4: Add support for Artix
Fixes: https://github.com/libguestfs/libguestfs/issues/81
2022-04-29 15:16:25 +01:00
Richard W.M. Jones
0a2d43988f build: No longer check for ocamldep -one-line and -all options
These were added to ocamldep in Jan 2012, over 10 years ago.  They
were not present in RHEL 6, but we don't care about that now.

(cherry picked from virt-v2v commit f6108bbd661d3e922d07b47f00daa901ab846e59)
2022-04-28 15:38:56 +01:00
Richard W.M. Jones
1941593585 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)
2021-12-10 10:30:17 +00:00
Richard W.M. Jones
0d05a229f3 customize: Suppress OCaml warning
In OCaml 4.13:

File "perl_edit.ml", line 30, characters 2-13:
30 |   c_edit_file (verbose ()) g (Guestfs.c_pointer g) file expr
       ^^^^^^^^^^^
Error (warning 6 [labels-omitted]): label verbose was omitted in the application of this function.

(cherry picked from
guestfs-tools commit a4930f5fad82e5358d565b8cf3610970e9646259)
2021-12-10 10:30:11 +00:00
Richard W.M. Jones
60e9232f4e Move minimum OCaml version to 4.04.
Synchronize with common module which also requires 4.04.

Small adjustment to use of List.sort_uniq because the signature
changed slightly.
2021-11-09 10:21:30 +00:00
Richard W.M. Jones
b536c61a6d m4: Remove test for OCaml Bytes module 2021-11-09 10:07:00 +00:00
Laszlo Ersek
f34bd6b12f build, docs: spell out minimum version (4.0.0) for the (optional) Yara lib
Commit e597fc5317 ("daemon/yara: fix undefined behavior due to Yara 4.0
API changes", 2021-10-12) prevents the daemon from using such a Yara
version that precedes 4.0.0.

If only yara < 4 is found, treat the library as absent, rather than
attempting and failing to compile the yara module of the daemon. Note the
version requirement in the documentation too.

Suggested-by: Eric Blake <eblake@redhat.com>
Suggested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211013133611.21599-4-lersek@redhat.com>
Acked-by: Eric Blake <eblake@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
2021-10-14 19:45:07 +02:00