[igt-dev] [PATCH i-g-t] man/build: Fix dependency handling

Ser, Simon simon.ser at intel.com
Fri May 24 06:46:01 UTC 2019


On Fri, 2019-05-24 at 08:28 +0300, Arkadiusz Hiler wrote:
> build_man is a 'feature' option, which means that we get an opaque
> object, so comparing it to 'yes' is always false.
> 
> It should have been 'if build_man.enabled()'.
> 
> But going even further we can prune the whole check, as rst2man is
> defined as follows:
> 
> rst2man = find_program('rst2man-3', 'rst2man', required : build_man)
> 
> From the patch overhauling those options:
> 
>     get_option() on a feature returns opaque object that can be passed as
>     a 'required' argument of a dependency. Auto is equivalent to 'required
>     : false', enabled is equivalent to 'required : true' and disabled
>     introduces new behavior forcing the dependency to be considered not
>     found.
> 
> This would cause the build to fail if build_man is enabled (aka
> 'required') and rst2man is not found. So...
> 
> if rst2man.found()
>   # rst2man found
>   # buildu buildu

:)

> else
>   # rst2man not found, but considered optional because
>   # we haven't erred out on find_program
>   if build_man.enabled() # cannot be, it's optional!
>     error('...')
>   endif
> endif
> 
> We can get rid of the whole else block here.
> 
> Cc: Antonio Argenziano <antonio.argenziano at intel.com>
> Cc: Petri Latvala <petri.latvala at intel.com>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>

LGTM

Reviewed-by: Simon Ser <simon.ser at intel.com>

> ---
>  man/meson.build | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/man/meson.build b/man/meson.build
> index 0f0a6dd4..2c1396af 100644
> --- a/man/meson.build
> +++ b/man/meson.build
> @@ -38,10 +38,6 @@ if rst2man.found()
>  				install : true,
>  				install_dir : join_paths(mandir, 'man1'))
>  	endforeach
> -	build_info += 'Build man pages: true'
> -else
> -	if build_man == 'yes'
> -		error('Cannot build man pages due to missing dependencies')
> -	endif
> -	build_info += 'Build man pages: false'
>  endif
> +
> +build_info += 'Build man pages: @0@'.format(rst2man.found())


More information about the igt-dev mailing list