Every time I try to install dev-util/perf-6.6 from binary packages it fails with the following error: ============================================================================ * Checking for suitable kernel configuration options ... * CONFIG_DEBUG_INFO: is not set when it should be. * CONFIG_DEBUG_INFO_BTF: is not set when it should be. /var/tmp/portage/dev-util/perf-6.6/temp/environment: line 1479: ERROR_HAVE_EBPF_JIT~BPF: invalid variable name * The ebuild phase 'setup' has exited unexpectedly. This type of behavior * is known to be triggered by things such as failed variable assignments * (bug #190128) or bad substitution errors (bug #200313). Normally, before * exiting, bash should have displayed an error message above. If bash did * not produce an error message above, it's possible that the ebuild has * called `exit` when it should have called `die` instead. This behavior * may also be triggered by a corrupt bash binary or a hardware problem * such as memory or cpu malfunction. If the problem is not reproducible or * it appears to occur randomly, then it is likely to be triggered by a * hardware problem. If you suspect a hardware problem then you should try * some basic hardware diagnostics such as memtest. Please do not report * this as a bug unless it is consistently reproducible and you are sure * that your bash binary and hardware are functioning properly. ============================================================================ The problem here is that pkg_setup() is run twice: once during building binary package and another time during installation. And this means the following code is running twice: if use bpf ; then CONFIG_CHECK+="~BPF ~BPF_EVENTS ~BPF_SYSCALL ~DEBUG_INFO_BTF ~HAVE_EBPF_JIT" fi On the second run this code results in ~HAVE_EBPF_JIT~BPF (without space in between) and this results in error: > /var/tmp/portage/dev-util/perf-6.6/temp/environment: line 1479: ERROR_HAVE_EBPF_JIT~BPF: invalid variable name To fix this issue CONFIG_CHECK needs to be defined as local variable: if use bpf ; then local CONFIG_CHECK+="~BPF ~BPF_EVENTS ~BPF_SYSCALL ~DEBUG_INFO_BTF ~HAVE_EBPF_JIT" fi It is possible to use space before ~BPF, but then for binary package CONFIG_CHECK will check for these configs twice. So making local is better.
Created attachment 881265 [details] build.log
Created attachment 881266 [details] environment.xz
Created attachment 881267 [details] emerge--info.txt
Created attachment 881268 [details, diff] perf-6.6.ebuild.patch
I think making CONFIG_CHECK a local variable is not the right solution, because the tests are supposed to be appended to the pre-existing global variable. Making it local will just skip those checks. I think the right fix is to change the condition of the if statement so it runs only once.
Well, I've checked. It is passed correctly. But do we need to have CONFIG_CHECK global in the first place? I think it's better to move variable to pkg_setup().
Created attachment 881366 [details, diff] perf-6.6.ebuild.patch
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=70d3e0e2fd20857968ba3ea7ddbf9292144b22ed commit 70d3e0e2fd20857968ba3ea7ddbf9292144b22ed Author: Guilherme Amadio <amadio@gentoo.org> AuthorDate: 2024-01-30 15:04:56 +0000 Commit: Guilherme Amadio <amadio@gentoo.org> CommitDate: 2024-01-30 15:25:34 +0000 dev-util/perf: fix bugs #917559 and #921197 Closes: https://bugs.gentoo.org/917559 Closes: https://bugs.gentoo.org/921197 Co-authored-by: Peter Volkov <peter.volkov@gmail.com> Signed-off-by: Guilherme Amadio <amadio@gentoo.org> dev-util/perf/files/perf-6.7-expr.patch | 24 ++++++++++++++++++++++++ dev-util/perf/perf-6.7.ebuild | 33 +++++++++++++++++---------------- 2 files changed, 41 insertions(+), 16 deletions(-)