On 1/28/26 18:11, Roman Bogorodskiy wrote:
> Do not hardcode "/usr/local/share" directory in the
> configuration file for the firmware and uboot paths.
> 
> Use meson's configure_file()/configuration_data()
> to substitute it with the "datadir" value.
> 
> Signed-off-by: Roman Bogorodskiy <[email protected]>
> ---
>  src/bhyve/{bhyve.conf => bhyve.conf.in} |  4 ++--
>  src/bhyve/meson.build                   | 13 +++++++++++--
>  2 files changed, 13 insertions(+), 4 deletions(-)
>  rename src/bhyve/{bhyve.conf => bhyve.conf.in} (87%)
> 
> diff --git a/src/bhyve/bhyve.conf b/src/bhyve/bhyve.conf.in
> similarity index 87%
> rename from src/bhyve/bhyve.conf
> rename to src/bhyve/bhyve.conf.in
> index a845937d87..5ed6a14db5 100644
> --- a/src/bhyve/bhyve.conf
> +++ b/src/bhyve/bhyve.conf.in
> @@ -4,12 +4,12 @@
>  
>  # Path to a directory with firmware files. By default it's pointing
>  # to the directory that sysutils/bhyve-firmware installs files into.
> -#firmware_dir = "/usr/local/share/uefi-firmware"
> +#firmware_dir = "@DATADIR@/uefi-firmware"
>  
>  # Path to the U-Boot loader for the arm64 guests.
>  # By default it's pointing to the loader installed
>  # by the sysutils/u-boot-bhyve-arm64 port
> -#uboot_path = "/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin"
> +#uboot_path = "@DATADIR@/u-boot/u-boot-bhyve-arm64/u-boot.bin"
>  
>  # Set timeout for the bhyveload(8) command. This might be necessary
>  # because in case of errors bhyveload(8) drops to an interactive
> diff --git a/src/bhyve/meson.build b/src/bhyve/meson.build
> index 11920d9c3e..564b7e5db2 100644
> --- a/src/bhyve/meson.build
> +++ b/src/bhyve/meson.build
> @@ -50,12 +50,21 @@ if conf.has('WITH_BHYVE')
>      ],
>    }
>  
> -  virt_conf_files += files('bhyve.conf')
> +  bhyve_conf_data = configuration_data({
> +    'DATADIR': datadir,
> +  })
> +  bhyve_conf = configure_file(
> +    input: 'bhyve.conf.in',
> +    output: 'bhyve.conf',
> +    configuration: bhyve_conf_data,
> +  )
> +
> +  virt_conf_files += bhyve_conf
>    virt_aug_files += files('libvirtd_bhyve.aug')
>    virt_test_aug_files += {
>      'name': 'test_libvirtd_bhyve.aug',
>      'aug': files('test_libvirtd_bhyve.aug.in'),
> -    'conf': files('bhyve.conf'),
> +    'conf': bhyve_conf,
>      'test_name': 'libvirtd_bhyve',
>      'test_srcdir': meson.current_source_dir(),
>      'test_builddir': meson.current_build_dir(),


This is a bit tricky. Because of the change made to bhyve.conf.in the
expected output for check-augeas-libvirtd_bhyve test changes:

libvirt.git/_build/src/test_libvirtd_bhyve.aug:8.2-11.35:exception
thrown in test
libvirt.git/_build/src/test_libvirtd_bhyve.aug:8.7-.34:exception:
Iterated lens matched less than it should
    Lens:
/home/zippy/tmp/libvirt.git/src/bhyve/libvirtd_bhyve.aug:36.13-.43:
      Last match:
/home/zippy/tmp/libvirt.git/src/bhyve/libvirtd_bhyve.aug:32.17-.31:
    Error encountered at 2:0 (42 characters into string)
    < "/usr/share/uefi-firmware"\n|=|uboot_path = "/usr/share/u-b>

    Tree generated so far:
    /firmware_dir = "/usr/share/uefi-firmware"

We'd need to make the test output also depend on @DATADIR@ expansion and
only after that it can be fed to scripts/augeas-gentest.py.
Alternatively, we can just live with the .conf not reflecting the
defaults loaded by the driver. BTW: I'm testing these on FreeBSD 15,
hence difference in our outputs.

Michal

Reply via email to