[libvirt PATCH 27/31] src: unify virFileActivateDirOverride()

Pavel Hrdina phrdina at redhat.com
Fri Jul 10 10:03:59 UTC 2020

On Thu, Jul 09, 2020 at 04:21:32PM +0100, Daniel P. Berrangé wrote:
> On Thu, Jul 02, 2020 at 02:25:25PM +0200, Pavel Hrdina wrote:
> > We have two functions to set that we want to override directory where to
> > look for libvirt files, one checks the binary name and the other one
> > checks env variable.
> > 
> > This patch removes the binary name check to simplify code by using only
> > the env variable.
> > 
> > This change will be required for Meson introduction where the binary
> > name doesn't have any prefix by default.
> This means that we won't be able to run  "./src/libvirtd" directly from
> the build dir - we'll *always* have to use  "./run ./src/libvirtd" to
> get the env var set IIUC.
> Instead of checking the binary name, can we check for existance of a
> known valid build file in the directory we're running the binary from.
> eg look for "Makefile" or "ninja.build" or something like that.

This will not work, with autotools we are running from:


where there are no Makefile or any other autotools related files, but
that's not an issue as I will drop this patch for now. We actually have
to fix it only for Meson.

However, with Meson it will not work as well because the ninja.build
file is only in the top-level build directory.

My idea is to canonicalize PWD/argv0 and check if it matches
abs_build_dir as prefix.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200710/af401f59/attachment-0001.sig>

More information about the libvir-list mailing list