linux-info.eclass: Move get_version to require_configured_kernel
authorMichał Górny <mgorny@gentoo.org>
Thu, 8 Mar 2018 16:10:08 +0000 (17:10 +0100)
committerMichał Górny <mgorny@gentoo.org>
Mon, 9 Jul 2018 16:54:46 +0000 (18:54 +0200)
All require_configured_kernel calls in this eclass are followed
by a get_version call. Since even calling it proactively wouldn't hurt,
move it to require_configured_kernel. This saves us from having
to manually implement error handling for it everywhere.

eclass/linux-info.eclass

index 5adecb3a26968b0845e948895a5f09dfe46579f9..caeb9ec0705db0a852252c11ed3263269e55e690 100644 (file)
@@ -295,6 +295,7 @@ 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
 }
 
 # @FUNCTION: linux_chkconfig_present
@@ -646,7 +647,6 @@ linux-info_get_any_version() {
 check_kernel_built() {
        # if we haven't determined the version yet, we need to
        require_configured_kernel
-       get_version
 
        local versionh_path
        if kernel_is -ge 3 7; then
@@ -676,7 +676,6 @@ check_kernel_built() {
 check_modules_supported() {
        # if we haven't determined the version yet, we need too.
        require_configured_kernel
-       get_version
 
        if ! linux_chkconfig_builtin "MODULES"; then
                eerror "These sources do not support loading external modules."
@@ -831,7 +830,6 @@ check_extra_config() {
 check_zlibinflate() {
        # if we haven't determined the version yet, we need to
        require_configured_kernel
-       get_version
 
        # although I restructured this code - I really really really dont support it!