X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=eclass%2Flinux-info.eclass;h=405ef5571e1c917b0927b8050be0d4b303296588;hb=e71e14791a2cdae1589b3cdde9acb52e20c89b39;hp=16740a3126fb7b8f3240a5d658503e9a72b5325d;hpb=0443366d4729a542d644464d0fca5a620c4dd95f;p=gentoo.git diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass index 16740a3126fb..405ef5571e1c 100644 --- a/eclass/linux-info.eclass +++ b/eclass/linux-info.eclass @@ -1,6 +1,5 @@ -# Copyright 1999-2016 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id$ # @ECLASS: linux-info.eclass # @MAINTAINER: @@ -107,13 +106,16 @@ # KBUILD_OUTPUT is used. This should be used for referencing .config. # And to ensure all the weirdness with crosscompile -inherit toolchain-funcs versionator +inherit toolchain-funcs +[[ ${EAPI:-0} == [0123456] ]] && inherit eapi7-ver EXPORT_FUNCTIONS pkg_setup +IUSE="kernel_linux" + # Overwritable environment Var's # --------------------------------------- -KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}" +KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}" # Bug fixes @@ -157,7 +159,7 @@ qeerror() { qout eerror "${@}" ; } # --------------------------------------- # @FUNCTION: getfilevar -# @USAGE: variable configfile +# @USAGE: # @RETURN: the value of the variable # @DESCRIPTION: # It detects the value of the variable defined in the file configfile. This is @@ -193,7 +195,7 @@ getfilevar() { } # @FUNCTION: getfilevar_noexec -# @USAGE: variable configfile +# @USAGE: # @RETURN: the value of the variable # @DESCRIPTION: # It detects the value of the variable defined in the file configfile. @@ -239,6 +241,10 @@ linux_config_qa_check() { ewarn "QA: You called $f before any linux_config_exists!" ewarn "QA: The return value of $f will NOT guaranteed later!" fi + + if ! use kernel_linux; then + die "$f called on non-Linux system, please fix the ebuild" + fi } # @FUNCTION: linux_config_src_exists @@ -247,7 +253,7 @@ linux_config_qa_check() { # It returns true if .config exists in a build directory otherwise false linux_config_src_exists() { export _LINUX_CONFIG_EXISTS_DONE=1 - [[ -n ${KV_OUT_DIR} && -s ${KV_OUT_DIR}/.config ]] + use kernel_linux && [[ -n ${KV_OUT_DIR} && -s ${KV_OUT_DIR}/.config ]] } # @FUNCTION: linux_config_bin_exists @@ -256,7 +262,7 @@ linux_config_src_exists() { # It returns true if .config exists in /proc, otherwise false linux_config_bin_exists() { export _LINUX_CONFIG_EXISTS_DONE=1 - [[ -s /proc/config.gz ]] + use kernel_linux && [[ -s /proc/config.gz ]] } # @FUNCTION: linux_config_exists @@ -289,6 +295,10 @@ linux_config_path() { # This function verifies that the current kernel is configured (it checks against the existence of .config) # otherwise it dies. require_configured_kernel() { + if ! use kernel_linux; then + die "${FUNCNAME}() called on non-Linux system, please fix the ebuild" + fi + if ! linux_config_src_exists; then qeerror "Could not find a usable .config in the kernel source directory." qeerror "Please ensure that ${KERNEL_DIR} points to a configured set of Linux sources." @@ -296,10 +306,11 @@ require_configured_kernel() { qeerror "it points to the necessary object directory so that it might find .config." die "Kernel not configured; no .config found in ${KV_OUT_DIR}" fi + get_version || die "Unable to determine configured kernel version" } # @FUNCTION: linux_chkconfig_present -# @USAGE: option +# @USAGE: