If one is building in a build [ch]root such as mock provides, one may
not have the kernel installed which corresponds to $(uname -r). In such
a case, also try to look for the kernel-devel in /usr/src/kernels/ and
just build for the latest one. Ideally there is only one installed in any case.
Test-Parameters: trivial
Signed-off-by: Brian J. Murrell <brian.murrell@intel.com>
Change-Id: I7704c6ce7078a507fd6b5f9178b07f750dc03789
Reviewed-on: https://review.whamcloud.com/28064
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
# Find paths for linux, handling kernel-source rpms
#
AC_DEFUN([LB_LINUX_PATH], [
-for DEFAULT_LINUX in /lib/modules/$(uname -r)/{source,build} /usr/src/linux; do
+for DEFAULT_LINUX in /lib/modules/$(uname -r)/{source,build} /usr/src/linux $(find /usr/src/kernels/ -maxdepth 1 -name @<:@0-9@:>@\* | xargs -r ls -d | tail -n 1); do
AS_IF([readlink -q -e $DEFAULT_LINUX >/dev/null], [break])
done
if test "$DEFAULT_LINUX" = "/lib/modules/$(uname -r)/source"; then