sys-power/powertop doesn't find kernel .config Reproducible: Always Steps to Reproduce: 1. emerge powertop Actual Results: Ebuild says: "unable to find kernel config, all checks disabled" Expected Results: Should find kernel .config Reason is that linux-info_pkg_setup is called after linux_config_exists, while it must be called before to work. BTW, powertop 2.3 is available and has no ebuild yet.
version bumped as requested.
The proper way to check the kernel config for options is to first check if a config exists, and then to check it for options if it does exist. if linux-info fails to find your kernel config in both /proc/config.gz and /usr/src/linux/.config AND IT ACTUALLY EXISTS in one of those places please file a bug on linux-info.eclass. In the vastly more likely possibility that your system is not configured properly please ensure that your config is available via either /proc/config.gz or /usr/src/linux/.config
http://devmanual.gentoo.org/eclass-reference/linux-info.eclass/index.html says: | Before using any of the config-handling functions in this eclass, you must | ensure that one of the following functions has been called (in order of | preference), otherwise you will get bugs like #364041): | linux-info_pkg_setup linux-info_get_any_version get_version | get_running_version And in fact linux_config_exists() returns false unless /proc/config.gz exists if none of these functions has been called before to set up $KV_OUT_DIR. Error handling should be done in linux-info_pkg_setup(); there's no need to do that in the ebuild. However, the way linux-info.eclass works isn't very intuitive. Perhaps linux_config_exists should be changed to automatically set up $KV_OUT_DIR. The mentioned bug #364041 has been reintroduced in 2.20.0 just 3 weeks after it has been fixed in 2.19.0, and probably there are more ebuilds out there that just silently fail to check the kernel .config if /proc/config.gz doesn't exist. For reference, my kernel sources are indeed at a non-standard location. I have them in /var/src and /usr/src is a symlink to /var/src (my /var is a separate partition to keep volatile files out of the root file system). But linux-info.eclass has no problems to find them if it is used as documented.
I've moved the requested command to the top of pkg_setup. As long as it doesn't break catalyst builds it stays. I suspect the requested change is fine but due to other current breakage in the tree I can't test this change in catalyst. + 07 Apr 2013; Rick Farina <zerochaos@gentoo.org> powertop-2.3.ebuild, + powertop-9999.ebuild: + moving linux-info_pkg_setup in the hopes that it fixes bug 464792
The move won't work; linux-info_pkg_setup must be called after setting of the env vars too. AIUI, the way it is supposed to work would be: pkg_setup() { CONFIG_CHECK=" ~X86_MSR ~DEBUG_FS ~PERF_EVENTS ~TRACEPOINTS ~NO_HZ ~HIGH_RES_TIMERS ~HPET_TIMER ~CPU_FREQ_STAT ~CPU_FREQ_GOV_ONDEMAND ~USB_SUSPEND ~FTRACE ~BLK_DEV_IO_TRACE ~TIMER_STATS ~EVENT_POWER_TRACING_DEPRECATED ~TRACING " ERROR_KERNEL_X86_MSR="X86_MSR is not enabled in the kernel, you almost certainly need it" ERROR_KERNEL_DEBUG_FS="DEBUG_FS is not enabled in the kernel, you almost certainly need it" ERROR_KERNEL_PERF_EVENTS="PERF_EVENTS should be enabled in the kernel for full powertop function" ERROR_KERNEL_TRACEPOINTS="TRACEPOINTS should be enabled in the kernel for full powertop function" ERROR_KERNEL_NO_HZ="NO_HZ should be enabled in the kernel for full powertop function" ERROR_KERNEL_HIGH_RES_TIMERS="HIGH_RES_TIMERS should be enabled in the kernel for full powertop function" ERROR_KERNEL_HPET_TIMER="HPET_TIMER should be enabled in the kernel for full powertop function" ERROR_KERNEL_CPU_FREQ_STAT="CPU_FREQ_STAT should be enabled in the kernel for full powertop function" ERROR_KERNEL_CPU_FREQ_GOV_ONDEMAND="CPU_FREQ_GOV_ONDEMAND should be enabled in the kernel for full powertop function" ERROR_KERNEL_USB_SUSPEND="USB_SUSPEND should be enabled in the kernel for full powertop function" ERROR_KERNEL_FTRACE="FTRACE needs to be turned on to enable BLK_DEV_IO_TRACE" ERROR_KERNEL_BLK_DEV_IO_TRACE="BLK_DEV_IO_TRACE needs to be turned on to enable TIMER_STATS, TRACING and EVENT_POWER_TRACING_DEPRECATED" ERROR_KERNEL_TIMER_STATS="TIMER_STATS should be enabled in the kernel for full powertop function" ERROR_KERNEL_EVENT_POWER_TRACING_DEPRECATED="EVENT_POWER_TRACING_DEPRECATED should be enabled in the kernel for full powertop function" ERROR_KERNEL_TRACING="TRACING should be enabled in the kernel for full powertop function" linux-info_pkg_setup if linux_config_exists; then if kernel_is -lt 3 7 0; then linux_chkconfig_present SND_HDA_INTEL && CONFIG_CHECK+="~SND_HDA_POWER_SAVE" linux_chkconfig_present SND_HDA_INTEL && ERROR_KERNEL_SND_HDA_POWER_SAVE="SND_HDA_POWER_SAVE should be enabled in the kernel for full powertop function" fi fi } linux-info_pkg_setup works without conditionals, but linux_chkconfig_present should only be called if linux_config_exists() is true. With the above code I get * Determining the location of the kernel source code * Found kernel source directory: * /usr/src/linux * Found sources for kernel version: * 3.8.6-gentoo-v0 * Checking for suitable kernel configuration options... [ ok ] If I remove /usr/src, then linux-info.eclass outputs: * Determining the location of the kernel source code * Unable to find kernel sources at /usr/src/linux * Please make sure that /usr/src/linux points at your running kernel, * (or the kernel you wish to build against). * Alternatively, set the KERNEL_DIR environment variable to the kernel sources location * Unable to calculate Linux Kernel version for build, attempting to use running version * Unable to check for the following kernel config options due * to absence of any configured kernel sources or compiled * config: * - X86_MSR * - DEBUG_FS * - PERF_EVENTS * - TRACEPOINTS * - NO_HZ * - HIGH_RES_TIMERS * - HPET_TIMER * - CPU_FREQ_STAT * - CPU_FREQ_GOV_ONDEMAND * - USB_SUSPEND * - FTRACE * - BLK_DEV_IO_TRACE * - TIMER_STATS * - EVENT_POWER_TRACING_DEPRECATED * - TRACING * You're on your own to make sure they are set if needed.
Er, the "if kernel_is -lt 3 7 0" clause still won't work. Must be something like if linux_config_exists; then if kernel_is -lt 3 7 0; then if linux_chkconfig_present SND_HDA_INTEL; then CONFIG_CHECK="~SND_HDA_POWER_SAVE" ERROR_KERNEL_SND_HDA_POWER_SAVE="SND_HDA_POWER_SAVE should be enabled in the kernel for full powertop function" check_extra_config fi fi fi
how about an ebuild patch?
Created attachment 344754 [details, diff] Patch against powertop-2.3.ebuild rv. 1.2
linux-info_pkg_setup if linux_config_exists; then if kernel_is -lt 3 7 0; then if linux_chkconfig_present SND_HDA_INTEL; then CONFIG_CHECK="~SND_HDA_POWER_SAVE" ERROR_KERNEL_SND_HDA_POWER_SAVE="SND_HDA_POWER_SAVE should be enabled in the kernel for full powertop function" fi fi check_extra_config fi that doesn't really paste well but at any point I think the check_extra_config should happen no matter what, in your version it only happened for kernel lt 3.7.0 and snd_hda_intel is set... commiting now, please to let me know if you agree.
check_extra_config will be called at least once because linux-info_pkg_setup calls it if CONFIG_CHECK is set. That is documented: "and then check if the kernel is configured to support the options specified in CONFIG_CHECK (if not null)"
(In reply to comment #10) > check_extra_config will be called at least once because linux-info_pkg_setup > calls it if CONFIG_CHECK is set. That is documented: > > "and then check if the kernel is configured to support the options specified > in CONFIG_CHECK (if not null)" got confused between your changes and my changes, yes, you are right. Thanks for the help, dealing with all the changes to the config checks has been like 99% of my work with powertop.