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 (-14 / +35 lines)
Lines 97-104 qeerror() { qout eerror "${@}" ; } Link Here
97
# File Functions
97
# File Functions
98
# ---------------------------------------
98
# ---------------------------------------
99
99
100
# getfilevar accepts 2 vars as follows:
100
# getfilevar accepts 3 vars as follows, third is optional:
101
# getfilevar <VARIABLE> <CONFIGFILE>
101
# getfilevar <VARIABLE> <CONFIGFILE> [<KBUILD_OUTPUT>]
102
102
103
getfilevar() {
103
getfilevar() {
104
local	ERROR workingdir basefname basedname myARCH="${ARCH}"
104
local	ERROR workingdir basefname basedname myARCH="${ARCH}"
Lines 119-126 local ERROR workingdir basefname basedna Link Here
119
		unset ARCH
119
		unset ARCH
120
120
121
		cd "${basedname}"
121
		cd "${basedname}"
122
		echo -e "e:\\n\\t@echo \$(${1})\\ninclude ${basefname}" | \
122
		if [ -n "${3}" ]
123
			make M="${S}" ${BUILD_FIXES} -s -f - 2>/dev/null
123
		then
124
			echo -e "e:\\n\\t@echo \$(${1})\\ninclude ${basefname}" | \
125
				make M="${S}" O="${3}" ${BUILD_FIXES} -s -f - 2>/dev/null
126
		else
127
			echo -e "e:\\n\\t@echo \$(${1})\\ninclude ${basefname}" | \
128
				make M="${S}" ${BUILD_FIXES} -s -f - 2>/dev/null
129
		fi
124
		cd "${workingdir}"
130
		cd "${workingdir}"
125
131
126
		ARCH=${myARCH}
132
		ARCH=${myARCH}
Lines 227-232 get_version() { Link Here
227
	[ -h "${KERNEL_DIR}" ] && KV_DIR="$(readlink -f ${KERNEL_DIR})"
233
	[ -h "${KERNEL_DIR}" ] && KV_DIR="$(readlink -f ${KERNEL_DIR})"
228
	[ -d "${KERNEL_DIR}" ] && KV_DIR="${KERNEL_DIR}"
234
	[ -d "${KERNEL_DIR}" ] && KV_DIR="${KERNEL_DIR}"
229
235
236
	if [ -n "${KBUILD_OUTPUT}" ]
237
	then
238
		if [ ! -s "${KBUILD_OUTPUT}/Makefile" ]
239
		then
240
			qeerror "Could not find a Makefile in the kernel build directory."
241
			qeerror "Please ensure that ${KBUILD_OUTPUT} points to an initialized"
242
			qeerror "kernel output directory."
243
			return 1
244
		fi
245
		OUTPUT_DIR="$(getfilevar KERNELOUTPUT ${KBUILD_OUTPUT}/Makefile)"
246
		KV_DIR="$(getfilevar KERNELSRC ${KBUILD_OUTPUT}/Makefile)"
247
	elif [ -f "${KV_DIR}/Makefile" -a -n "$(getfilevar KERNELSRC ${KV_DIR}/Makefile)" ]
248
	then
249
		# We probably found KBUILD_OUTPUT instead of KERNEL_DIR ...
250
		OUTPUT_DIR="$(getfilevar KERNELOUTPUT ${KV_DIR}/Makefile)"
251
		KV_DIR="$(getfilevar KERNELSRC ${KV_DIR}/Makefile)"
252
		qeinfo "Found kernel output directory instead of source directory:"
253
		qeinfo "    ${KV_DIR}"
254
	fi
255
	unset KBUILD_OUTPUT
256
230
	if [ -z "${KV_DIR}" ]
257
	if [ -z "${KV_DIR}" ]
231
	then
258
	then
232
		qeerror "Unable to find kernel sources at ${KERNEL_DIR}"
259
		qeerror "Unable to find kernel sources at ${KERNEL_DIR}"
Lines 251-262 get_version() { Link Here
251
		return 1
278
		return 1
252
	fi
279
	fi
253
280
254
	# OK so now we know our sources directory, but they might be using
255
	# KBUILD_OUTPUT, and we need this for .config and localversions-*
256
	# so we better find it eh?
257
	# do we pass KBUILD_OUTPUT on the CLI?
258
	OUTPUT_DIR="${OUTPUT_DIR:-${KBUILD_OUTPUT}}"
259
260
	# And if we didn't pass it, we can take a nosey in the Makefile
281
	# And if we didn't pass it, we can take a nosey in the Makefile
261
	kbuild_output="$(getfilevar KBUILD_OUTPUT ${KV_DIR}/Makefile)"
282
	kbuild_output="$(getfilevar KBUILD_OUTPUT ${KV_DIR}/Makefile)"
262
	OUTPUT_DIR="${OUTPUT_DIR:-${kbuild_output}}"
283
	OUTPUT_DIR="${OUTPUT_DIR:-${kbuild_output}}"
Lines 264-273 get_version() { Link Here
264
	# And contrary to existing functions I feel we shouldn't trust the
285
	# And contrary to existing functions I feel we shouldn't trust the
265
	# directory name to find version information as this seems insane.
286
	# directory name to find version information as this seems insane.
266
	# so we parse ${KV_DIR}/Makefile
287
	# so we parse ${KV_DIR}/Makefile
267
	KV_MAJOR="$(getfilevar VERSION ${KV_DIR}/Makefile)"
288
	KV_MAJOR="$(getfilevar VERSION ${KV_DIR}/Makefile ${OUTPUT_DIR})"
268
	KV_MINOR="$(getfilevar PATCHLEVEL ${KV_DIR}/Makefile)"
289
	KV_MINOR="$(getfilevar PATCHLEVEL ${KV_DIR}/Makefile ${OUTPUT_DIR})"
269
	KV_PATCH="$(getfilevar SUBLEVEL ${KV_DIR}/Makefile)"
290
	KV_PATCH="$(getfilevar SUBLEVEL ${KV_DIR}/Makefile ${OUTPUT_DIR})"
270
	KV_EXTRA="$(getfilevar EXTRAVERSION ${KV_DIR}/Makefile)"
291
	KV_EXTRA="$(getfilevar EXTRAVERSION ${KV_DIR}/Makefile ${OUTPUT_DIR})"
271
292
272
	if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]
293
	if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]
273
	then
294
	then

Return to bug 87242