Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 567504

Summary: eutils.eclass, libtool.eclass: Improve eutils_elt_patch_dir(), libtool_elt_patch_dir()
Product: Gentoo Linux Reporter: Arfrever Frehtes Taifersar Arahesis <arfrever.fta>
Component: EclassesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED NEEDINFO    
Severity: enhancement    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---

Description Arfrever Frehtes Taifersar Arahesis 2015-12-03 22:44:54 UTC
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}.)
Comment 1 SpanKY gentoo-dev 2015-12-03 23:35:21 UTC
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.