On Wed, 20 Jul 2022 at 18:08, Eric Blake <ebl...@redhat.com> wrote: > > On Wed, Jul 20, 2022 at 05:31:52PM +0100, Daniel P. Berrangé wrote: > > > > diff --git a/meson.build b/meson.build > > > > index 65a885ea69..d8ef24bacb 100644 > > > > --- a/meson.build > > > > +++ b/meson.build > > > > @@ -18,6 +18,8 @@ config_host = keyval.load(meson.current_build_dir() / > > > > 'config-host.mak') > > > > enable_modules = 'CONFIG_MODULES' in config_host > > > > enable_static = 'CONFIG_STATIC' in config_host > > > > > > > > +in_gitrepo = run_command('test', '-d', '.git', check: > > > > false).returncode() == 0 > > > > > > Should we use Meson's fs.is_dir() rather than running a shell? > > > (https://mesonbuild.com/Fs-module.html) > > > > Will investigate > > Probably not a good idea as-is; .git need not be a directory, but can > also be a symlink. So 'test -e .git' is the better check (see > scripts/qemu-version.sh); but if you can write an existence check in > meson (instead of a directory check), then go for it.
There is a fs.exists(), yes. I just suggested .is_dir() because the code as written here is doing a -d check, not a -e check. -- PMM