On Friday, 2 November 2018 15:27:17 CET Richard W.M. Jones wrote:
We do this by defining DB_DUMP unconditionally and then testing the
special exit code given by the shell if the command is not found (see
http://www.tldp.org/LDP/abs/html/exitcodes.html).
Packagers may either:
(1) Provide db_dump as a build requirement, but make it a weak
dependency at runtime, or:
(2) Not provide db_dump at build time, but define DB_DUMP to its
expected path when configuring, eg:
DB_DUMP=/usr/bin/db_dump ./configure
which will then be compiled into the library and used if available at
runtime (or ignored as in case (1) if not available at runtime).
I still do think this approach (hardcoding paths at build time) is not
a correct idea. It might work for tools part of the same suite (say,
hardcode the path of virt-get-kernel in virt-builder), but it gets
messy for tools that you do not really control.
I originally posted a better solution for this:
https://www.redhat.com/archives/libguestfs/2017-February/msg00043.html
which apparently was rejected with doubtful reasons.
Yes, I still do think a proper runtime check, instead of wild
hardcoding is better, and it avoids the workaround proposed in form of
this patch.
--
Pino Toscano