The call to detect_arch() results in a call to KV_to_int() down the call stack. This call is completely useless in the global scope during ebuild sourcing and future versions of portage will die on this behavior. Please migrate them to pkg_setup() or a similar phase.
Example output of Portage: * ERROR: sys-kernel/gentoo-sources-4.6.2::gentoo failed (depend phase): * KV_to_int() calls are not allowed in global scope * * Call stack: * ebuild.sh, line 606: Called source '/var/db/repositories/gentoo/sys-kernel/gentoo-sources/gentoo-sources-4.6.2.ebuild' * gentoo-sources-4.6.2.ebuild, line 14: Called detect_arch * kernel-2.eclass, line 1220: Called tc-arch-kernel * toolchain-funcs.eclass, line 550: Called tc-ninja_magic_to_arch 'kern' * toolchain-funcs.eclass, line 532: Called KV_to_int '4.6.2-gentoo' * ebuild.sh, line 78: Called die * The specific snippet of code: * eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in global scope\"; }" kernel-2.eclass: detect_arch() { # This function sets ARCH_URI and ARCH_PATCH # with the neccessary info for the arch sepecific compatibility # patchsets. ... # ARCH_URI is the URI for all the ${ARCH}_URI patches # ARCH_PATCH is ARCH_URI broken into files for UNIPATCH ARCH_URI is used in SRC_URI, which must be set in global scope. So detect_arch() or tc-ninja_magic_to_arch() should be improved.
*** Bug 586470 has been marked as a duplicate of this bug. ***
*** Bug 586472 has been marked as a duplicate of this bug. ***
*** Bug 586476 has been marked as a duplicate of this bug. ***
*** Bug 586478 has been marked as a duplicate of this bug. ***
*** Bug 586480 has been marked as a duplicate of this bug. ***
there's no value in filing bugs against every package. this is how all the ebuilds work with this eclass, so we'll simply fix them all together at the same time.
*** Bug 587000 has been marked as a duplicate of this bug. ***
With newer app-portage/repoman it is now impossible to work in any directory with an ebuild that inherits kernel-2.eclass.
Now, the real fun fact is that those functions got in the ban only because previously they were replaced by 'return 1' in global scope. I'd say KV_to_int() did not deserve that... but that also means it actually did not work as expected in global scope for a long time...
commit 81c226e451be564a545696f93fc5880ebc160812 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: Mon Jun 27 07:52:14 2016 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: Mon Jun 27 07:58:14 2016 toolchain-funcs.eclass: tc-ninja_magic_to_arch, remove old KV support Remove the support for old kernel versions that are no longer used in Gentoo, and rely on KV_to_int() function. This functions is provided by Portage but not listed in PMS. Furthermore, for a long time Portage replaced it with 'return 1' in global scope, so they did not really work as expected anyway. This should fix the immediate issue. As ulm pointed out, we no longer have <2.6.24 sources in-tree, so this shouldn't do any harm. Originally I wanted to use versionator.eclass for this but due to some careless developer it is impossible without inherit loops. However, we really need to put more effort into this. All Portage KV_* uses need to be removed and banned. Also we need to look for any other possible Portage functions, and possible leftovers of old global $KV variable.