class UseManager(object):
- def __init__(self, repositories, profiles, abs_user_config, user_config=True):
+ def __init__(self, repositories, profiles, abs_user_config, is_stable,
+ user_config=True):
# file variable
#--------------------------------
# repositories
#--------------------------------
# puse
+ self._user_config = user_config
+ self._is_stable = is_stable
self._repo_usemask_dict = self._parse_repository_files_to_dict_of_tuples("use.mask", repositories)
self._repo_usestablemask_dict = \
self._parse_repository_files_to_dict_of_tuples("use.stable.mask",
ret[repo.name] = file_dict
return ret
+ def _isStable(self, pkg):
+ if self._user_config:
+ try:
+ return pkg.stable
+ except AttributeError:
+ # KEYWORDS is unavailable (prior to "depend" phase)
+ return False
+
+ try:
+ pkg._metadata
+ except AttributeError:
+ # KEYWORDS is unavailable (prior to "depend" phase)
+ return False
+
+ # Since repoman uses different config instances for
+ # different profiles, we have to be careful to do the
+ # stable check against the correct profile here.
+ return self._is_stable(pkg)
+
def getUseMask(self, pkg=None):
if pkg is None:
return frozenset(stack_lists(
pkg = _pkg_str(remove_slot(pkg), slot=slot, repo=repo)
cp = pkg.cp
- try:
- stable = pkg.stable
- except AttributeError:
- # KEYWORDS is unavailable (prior to "depend" phase)
- stable = False
+ stable = self._isStable(pkg)
usemask = []
pkg = _pkg_str(remove_slot(pkg), slot=slot, repo=repo)
cp = pkg.cp
- try:
- stable = pkg.stable
- except AttributeError:
- # KEYWORDS is unavailable (prior to "depend" phase)
- stable = False
+ stable = self._isStable(pkg)
useforce = []
self._repo_make_defaults[repo.name] = d
#Read all USE related files from profiles and optionally from user config.
- self._use_manager = UseManager(self.repositories, profiles_complex, abs_user_config, user_config=local_config)
+ self._use_manager = UseManager(self.repositories, profiles_complex,
+ abs_user_config, self._isStable, user_config=local_config)
#Initialize all USE related variables we track ourselves.
self.usemask = self._use_manager.getUseMask()
self.useforce = self._use_manager.getUseForce()
settings = self._settings
except AttributeError:
raise AttributeError('stable')
+ if not settings.local_config:
+ # Since repoman uses different config instances for
+ # different profiles, our local instance does not
+ # refer to the correct profile.
+ raise AssertionError('invalid context')
stable = settings._isStable(self)
- if settings.local_config:
- # For repoman, don't cache this value, since
- # it needs to be re-computed for each profile.
- self.__dict__['_stable'] = stable
+ self.__dict__['_stable'] = stable
return stable
def pkgsplit(mypkg, silent=1, eapi=None):