Stop using PORTDIR_OVERLAY in bash part of Portage.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tue, 16 Jul 2013 17:50:59 +0000 (19:50 +0200)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tue, 16 Jul 2013 17:50:59 +0000 (19:50 +0200)
bin/ebuild.sh
bin/isolated-functions.sh
bin/phase-functions.sh
pym/portage/package/ebuild/doebuild.py

index cb5fca733a0d177bf62bc3e18850987787a791f3..fc7fd9e098374642a4e50e35f1b9eaaa4de2c897 100755 (executable)
@@ -207,8 +207,10 @@ inherit() {
                        | fmt -w 75 | while read -r ; do eqawarn "$REPLY" ; done
        fi
 
+       local repo
+       local repo_location
        local location
-       local olocation
+       local potential_location
        local x
 
        # These variables must be restored before returning.
@@ -222,8 +224,8 @@ inherit() {
        local B_PDEPEND
        local B_HDEPEND
        while [ "$1" ]; do
-               location="${ECLASSDIR}/${1}.eclass"
-               olocation=""
+               location=""
+               potential_location=""
 
                export ECLASS="$1"
                __export_funcs_var=__export_functions_$ECLASS_DEPTH
@@ -244,24 +246,16 @@ inherit() {
                        fi
                fi
 
-               # any future resolution code goes here
-               if [ -n "$PORTDIR_OVERLAY" ]; then
-                       local overlay
-                       for overlay in ${PORTDIR_OVERLAY}; do
-                               olocation="${overlay}/eclass/${1}.eclass"
-                               if [ -e "$olocation" ]; then
-                                       location="${olocation}"
-                                       debug-print "  eclass exists: ${location}"
-                               fi
-                       done
-               fi
+               for repo in $(__repo_key ${PORTAGE_REPO_NAME} masters) ${PORTAGE_REPO_NAME} $(__repo_key ${PORTAGE_REPO_NAME} eclass-overrides); do
+                       repo_location="$(__repo_key ${repo} location)"
+                       potential_location="${repo_location}/eclass/${1}.eclass"
+                       if [[ -f ${potential_location} ]]; then
+                               location="${potential_location}"
+                               debug-print "  eclass exists: ${location}"
+                       fi
+               done
                debug-print "inherit: $1 -> $location"
-               [ ! -e "$location" ] && die "${1}.eclass could not be found by inherit()"
-
-               if [ "${location}" == "${olocation}" ] && \
-                       ! has "${location}" ${EBUILD_OVERLAY_ECLASSES} ; then
-                               EBUILD_OVERLAY_ECLASSES="${EBUILD_OVERLAY_ECLASSES} ${location}"
-               fi
+               [[ -z ${location} ]] && die "${1}.eclass could not be found by inherit()"
 
                #We need to back up the values of *DEPEND to B_*DEPEND
                #(if set).. and then restore them after the inherit call.
index 1f8a27ebb40c08468c7084b1ddf7f9b0937f18be..61ed8b7723c0e8c2eb95f2479b7bc468f28a1979 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/eapi.sh"
@@ -176,13 +176,6 @@ die() {
        fi
        eerror "If you need support, post the output of \`emerge --info '=$CATEGORY/$PF'\`,"
        eerror "the complete build log and the output of \`emerge -pqv '=$CATEGORY/$PF'\`."
-       if [[ -n ${EBUILD_OVERLAY_ECLASSES} ]] ; then
-               eerror "This ebuild used the following eclasses from overlays:"
-               local x
-               for x in ${EBUILD_OVERLAY_ECLASSES} ; do
-                       eerror "  ${x}"
-               done
-       fi
        if [ "${EMERGE_FROM}" != "binary" ] && \
                ! has ${EBUILD_PHASE} prerm postrm && \
                [ "${EBUILD#${PORTDIR}/}" == "${EBUILD}" ] ; then
@@ -482,4 +475,20 @@ has() {
        return 1
 }
 
+__repo_key() {
+       local appropriate_section=0 exit_status=1 line saved_extglob_shopt=$(shopt -p extglob)
+       shopt -s extglob
+       while read line; do
+               [[ ${appropriate_section} == 0 && ${line} == "[$1]" ]] && appropriate_section=1 && continue
+               [[ ${appropriate_section} == 1 && ${line} == "["*"]" ]] && appropriate_section=0 && continue
+               if [[ ${appropriate_section} == 1 && ${line} == $2*( )=* ]]; then
+                       echo "${line##$2*( )=*( )}"
+                       exit_status=0
+                       break
+               fi
+       done <<< "${PORTAGE_REPOSITORIES}"
+       eval "${saved_extglob_shopt}"
+       return ${exit_status}
+}
+
 true
index f67879ef21307e7393ba86ffdb3dbcfafa9c5870..dc4da6a4e4d1541e0d8131344acffec98e0bc702 100644 (file)
@@ -29,7 +29,7 @@ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
        PORTAGE_SAVED_READONLY_VARS PORTAGE_SIGPIPE_STATUS \
        PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \
        PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTAGE_XATTR_EXCLUDE \
-       PORTDIR PORTDIR_OVERLAY \
+       PORTDIR \
        PROFILE_PATHS REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \
        __PORTAGE_HELPER __PORTAGE_TEST_HARDLINK_LOCKS"
 
index 7ffe66b8821862585f9c8873a7ed7a4b256b1bfc..9db600ead6b6806f344744ec8ade69a7a834fbc1 100644 (file)
@@ -305,11 +305,11 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
        if hasattr(mydbapi, 'repositories'):
                repo = mydbapi.repositories.get_repo_for_location(mytree)
                mysettings['PORTDIR'] = repo.eclass_db.porttrees[0]
-               mysettings['PORTDIR_OVERLAY'] = ' '.join(repo.eclass_db.porttrees[1:])
                mysettings['PORTAGE_REPOSITORIES'] = mydbapi.repositories.config_string()
                mysettings.configdict["pkg"]["PORTAGE_REPO_NAME"] = repo.name
 
        mysettings["PORTDIR"] = os.path.realpath(mysettings["PORTDIR"])
+       mysettings.pop("PORTDIR_OVERLAY", None)
        mysettings["DISTDIR"] = os.path.realpath(mysettings["DISTDIR"])
        mysettings["RPMDIR"]  = os.path.realpath(mysettings["RPMDIR"])