The comments above eutils_elt_patch_dir() and libtool_elt_patch_dir() are partially incorrect. Value of ECLASSDIR does not depend on which eclasses are in current repository or inherited from master repositories. The actual algorithm for values of PORTDIR and ECLASSDIR in ebuild environment in EAPIs in which these variables are set in ebuild environment is: PORTDIR is location of first element from this list: master repositories of current repository + [current repository] ECLASSDIR is ${PORTDIR}/eclass (${ECLASSDIR} can refer to nonexistent directory.) The comments and analysis of the code of eutils_elt_patch_dir() and libtool_elt_patch_dir() suggest that the code should be rather: _EUTILS_ECLASSDIR_LOCAL=${BASH_SOURCE[0]%/*} eutils_elt_patch_dir() { local d="${_EUTILS_ECLASSDIR_LOCAL}/ELT-patches" if [[ ! -d ${d} ]] ; then d="${ECLASSDIR}/ELT-patches" fi if [[ ! -d ${d} ]] ; then die "ELT-patches cannot be found" fi echo "${d}" } Similarly for libtool_elt_patch_dir(). (Neither current code nor suggested code work in situation in which ELT-patches is located only in repository different than repository with eutils.eclass / libtool.eclass and different than first master repository. Support for this edge case would require something like master_repositories() and repository_path() functions, which are not available in EAPI={0,1,2,3,4,5,6}.)
the current code works and is based on real world testing. do you have a use case where it is not working ? if not, i'd prefer to just leave the code alone.