# this purpose because doebuild makes many changes to the config
# instance that is passed in.
self.doebuild_settings = config(clone=self.mysettings)
-
- porttree_root = os.path.realpath(porttree_root)
- self.porttree_root = porttree_root
-
self.depcachedir = os.path.realpath(self.mysettings.depcachedir)
if os.environ.get("SANDBOX_ON") == "1":
os.environ["SANDBOX_WRITE"] = \
":".join(filter(None, sandbox_write))
+ porttrees = [os.path.realpath(porttree_root)]
+ porttrees.extend(os.path.realpath(x) for x in \
+ self.mysettings.get('PORTDIR_OVERLAY', '').split())
+ treemap = {}
+ repository_map = {}
+ self.treemap = treemap
+ self._repository_map = repository_map
+ identically_named_paths = set()
+ for path in porttrees:
+ if path in repository_map:
+ continue
+ repo_name_path = os.path.join(path, REPO_NAME_LOC)
+ try:
+ repo_name = open(repo_name_path, 'r').readline().strip()
+ except EnvironmentError:
+ # warn about missing repo_name at some other time, since we
+ # don't want to see a warning every time the portage module is
+ # imported.
+ pass
+ else:
+ identically_named_path = treemap.get(repo_name)
+ if identically_named_path is not None:
+ # The earlier one is discarded.
+ del repository_map[identically_named_path]
+ identically_named_paths.add(identically_named_path)
+ if identically_named_path == porttrees[0]:
+ # Found another repo with the same name as
+ # $PORTDIR, so update porttrees[0] to match.
+ porttrees[0] = path
+ treemap[repo_name] = path
+ repository_map[path] = repo_name
+
+ # Ensure that each repo_name is unique. Later paths override
+ # earlier ones that correspond to the same name.
+ porttrees = [x for x in porttrees if x not in identically_named_paths]
+
+ self.porttrees = porttrees
+ porttree_root = porttrees[0]
+ self.porttree_root = porttree_root
+
self.eclassdb = eclass_cache.cache(porttree_root)
# This is used as sanity check for aux_get(). If there is no
self.xcache = {}
self.frozen = 0
- self.porttrees = [self.porttree_root] + \
- [os.path.realpath(t) for t in self.mysettings["PORTDIR_OVERLAY"].split()]
- self.treemap = {}
- self._repository_map = {}
- for path in self.porttrees:
- repo_name_path = os.path.join(path, REPO_NAME_LOC)
- try:
- repo_name = open(repo_name_path, 'r').readline().strip()
- self.treemap[repo_name] = path
- self._repository_map[path] = repo_name
- except (OSError,IOError):
- # warn about missing repo_name at some other time, since we
- # don't want to see a warning every time the portage module is
- # imported.
- pass
-
self._repo_info = {}
eclass_dbs = {porttree_root : self.eclassdb}
local_repo_configs = self.mysettings._local_repo_configs