| fmt -w 75 | while read -r ; do eqawarn "$REPLY" ; done
fi
- local repo
local repo_location
local location
local potential_location
fi
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)"
+ for repo_location in ${PORTAGE_ECLASS_LOCATIONS[@]}; do
potential_location="${repo_location}/eclass/${1}.eclass"
if [[ -f ${potential_location} ]]; then
location="${potential_location}"
debug-print " eclass exists: ${location}"
+ break
fi
done
debug-print "inherit: $1 -> $location"
shopt -s globstar
fi
+# Convert quoted paths to array.
+eval "PORTAGE_ECLASS_LOCATIONS=(${PORTAGE_ECLASS_LOCATIONS})"
+
# Source the ebuild every time for FEATURES=noauto, so that ebuild
# modifications take effect immediately.
if ! has "$EBUILD_PHASE" clean cleanrm ; then
PORTAGE_BUILD_USER PORTAGE_BUNZIP2_COMMAND \
PORTAGE_BZIP2_COMMAND PORTAGE_COLORMAP PORTAGE_CONFIGROOT \
PORTAGE_DEBUG PORTAGE_DEPCACHEDIR PORTAGE_EBUILD_EXIT_FILE \
+ PORTAGE_ECLASS_LOCATIONS \
PORTAGE_GID PORTAGE_GRPNAME PORTAGE_INST_GID PORTAGE_INST_UID \
PORTAGE_INTERNAL_CALLER PORTAGE_IPC_DAEMON PORTAGE_IUSE PORTAGE_LOG_FILE \
PORTAGE_MUTABLE_FILTERED_VARS PORTAGE_OVERRIDE_EPREFIX \
return sys.__stdin__
return sys.stdin
+_shell_quote_re = re.compile(r"[\s><=*\\\"'$`]")
+
def _shell_quote(s):
"""
Quote a string in double-quotes and use backslashes to
escape any backslashes, double-quotes, dollar signs, or
backquotes in the string.
"""
+ if _shell_quote_re.search(s) is None:
+ return s
for letter in "\\\"$`":
if letter in s:
s = s.replace(letter, "\\" + letter)
-# Copyright 2005-2011 Gentoo Foundation
+# Copyright 2005-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Author(s): Nicholas Carpaski (carpaski@gentoo.org), Brian Harring (ferringb@gentoo.org)
+from __future__ import unicode_literals
+
__all__ = ["cache"]
import stat
from portage.exception import FileNotFound, PermissionDenied
from portage import os
from portage import checksum
+from portage import _shell_quote
if sys.hexversion >= 0x3000000:
long = int
self.eclasses = {} # {"Name": hashed_path}
self._eclass_locations = {}
+ self._eclass_locations_str = None
# screw with the porttree ordering, w/out having bash inherit match it, and I'll hurt you.
# ~harring
self.porttrees = self.porttrees + other.porttrees
self.eclasses.update(other.eclasses)
self._eclass_locations.update(other._eclass_locations)
+ self._eclass_locations_str = None
def update_eclasses(self):
self.eclasses = {}
ec_dict[x] = self.eclasses[x]
return ec_dict
+
+ @property
+ def eclass_locations_string(self):
+ if self._eclass_locations_str is None:
+ self._eclass_locations_str = " ".join(_shell_quote(x)
+ for x in reversed(self.porttrees))
+ return self._eclass_locations_str
"PORTAGE_GID", "PORTAGE_GRPNAME",
"PORTAGE_INTERNAL_CALLER",
"PORTAGE_INST_GID", "PORTAGE_INST_UID",
- "PORTAGE_IPC_DAEMON", "PORTAGE_IUSE",
+ "PORTAGE_IPC_DAEMON", "PORTAGE_IUSE", "PORTAGE_ECLASS_LOCATIONS",
"PORTAGE_LOG_FILE", "PORTAGE_OVERRIDE_EPREFIX", "PORTAGE_PIPE_FD",
"PORTAGE_PYM_PATH", "PORTAGE_PYTHON",
"PORTAGE_PYTHONPATH", "PORTAGE_QUIET",
new_ov = []
if portdir_overlay:
- shell_quote_re = re.compile(r"[\s\\\"'$`]")
for ov in portdir_overlay:
ov = normalize_path(ov)
if isdir_raise_eaccess(ov):
- if shell_quote_re.search(ov) is not None:
- ov = portage._shell_quote(ov)
- new_ov.append(ov)
+ new_ov.append(portage._shell_quote(ov))
else:
writemsg(_("!!! Invalid PORTDIR_OVERLAY"
" (not a dir): '%s'\n") % ov, noiselevel=-1)
if hasattr(mydbapi, 'repositories'):
repo = mydbapi.repositories.get_repo_for_location(mytree)
mysettings['PORTDIR'] = repo.eclass_db.porttrees[0]
+ mysettings['PORTAGE_ECLASS_LOCATIONS'] = repo.eclass_db.eclass_locations_string
mysettings['PORTAGE_REPOSITORIES'] = mydbapi.repositories.config_string()
mysettings.configdict["pkg"]["PORTAGE_REPO_NAME"] = repo.name