Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 87242 | Differences between
and this patch

Collapse All | Expand All

(-)linux-info.eclass.orig (-6 / +28 lines)
Lines 366-371 get_version() { Link Here
366
	[ -h "${KERNEL_DIR}" ] && KV_DIR="$(readlink -f ${KERNEL_DIR})"
366
	[ -h "${KERNEL_DIR}" ] && KV_DIR="$(readlink -f ${KERNEL_DIR})"
367
	[ -d "${KERNEL_DIR}" ] && KV_DIR="${KERNEL_DIR}"
367
	[ -d "${KERNEL_DIR}" ] && KV_DIR="${KERNEL_DIR}"
368
368
369
	if [ -n "${KBUILD_OUTPUT}" ]
370
	then
371
		if [ ! -s "${KBUILD_OUTPUT}/Makefile" ]
372
		then
373
			qeerror "Could not find a Makefile in the kernel build directory."
374
			qeerror "Please ensure that ${KBUILD_OUTPUT} points to an initialized"
375
			qeerror "kernel output directory."
376
			return 1
377
		fi
378
		local make_args="$(getfilevar MAKEARGS ${KBUILD_OUTPUT}/Makefile)"
379
		if [ -z "${make_args}" ]; then
380
			OUTPUT_DIR="$(getfilevar_noexec KERNELOUTPUT ${KBUILD_OUTPUT}/Makefile)"
381
			KV_DIR="$(getfilevar_noexec KERNELSRC ${KBUILD_OUTPUT}/Makefile)"
382
		else
383
			qeinfo "This KBUILD_OUTPUT makefile looks like 2.6.25 or more recent format"
384
			OUTPUT_DIR=$(echo ${make_args} | sed -r -e 's:^(.* )?O=([^ ]*)/\.( .*)?$:\2:')
385
			KV_DIR=$(echo ${make_args} | sed -r -e 's:^(.* )?-C ([^ ]*)/? .*$:\2:')
386
		fi
387
	elif [ -f "${KV_DIR}/Makefile" -a -n "$(getfilevar_noexec KERNELSRC ${KV_DIR}/Makefile)" ]
388
	then
389
		# We probably found KBUILD_OUTPUT instead of KERNEL_DIR ...
390
		OUTPUT_DIR="$(getfilevar_noexec KERNELOUTPUT ${KV_DIR}/Makefile)"
391
		KV_DIR="$(getfilevar_noexec KERNELSRC ${KV_DIR}/Makefile)"
392
		qeinfo "Found kernel output directory instead of source directory:"
393
		qeinfo "    ${KV_DIR}"
394
	fi
395
	unset KBUILD_OUTPUT
396
369
	if [ -z "${KV_DIR}" ]
397
	if [ -z "${KV_DIR}" ]
370
	then
398
	then
371
		qeerror "Unable to find kernel sources at ${KERNEL_DIR}"
399
		qeerror "Unable to find kernel sources at ${KERNEL_DIR}"
Lines 390-401 get_version() { Link Here
390
		return 1
418
		return 1
391
	fi
419
	fi
392
420
393
	# OK so now we know our sources directory, but they might be using
394
	# KBUILD_OUTPUT, and we need this for .config and localversions-*
395
	# so we better find it eh?
396
	# do we pass KBUILD_OUTPUT on the CLI?
397
	OUTPUT_DIR="${OUTPUT_DIR:-${KBUILD_OUTPUT}}"
398
399
	# And if we didn't pass it, we can take a nosey in the Makefile
421
	# And if we didn't pass it, we can take a nosey in the Makefile
400
	kbuild_output="$(getfilevar_noexec KBUILD_OUTPUT ${KV_DIR}/Makefile)"
422
	kbuild_output="$(getfilevar_noexec KBUILD_OUTPUT ${KV_DIR}/Makefile)"
401
	OUTPUT_DIR="${OUTPUT_DIR:-${kbuild_output}}"
423
	OUTPUT_DIR="${OUTPUT_DIR:-${kbuild_output}}"

Return to bug 87242