from portage.cache.mappings import slot_dict_class
from portage.const import EBUILD_PHASES
from portage.dep import Atom, check_required_use, use_reduce, \
- paren_enclose, _slot_re, _slot_separator, _repo_separator, \
- _unknown_repo
-from portage.versions import _pkg_str
+ paren_enclose, _slot_re, _slot_separator, _repo_separator
+from portage.versions import _pkg_str, _unknown_repo
from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
from portage.exception import InvalidDependString
-from portage.repository.config import _gen_valid_repo
from _emerge.Task import Task
if sys.hexversion >= 0x3000000:
# Avoid an InvalidAtom exception when creating slot_atom.
# This package instance will be masked due to empty SLOT.
slot = '0'
- repo = _gen_valid_repo(self.metadata.get('repository', ''))
- if not repo:
- repo = self.UNKNOWN_REPO
- self.metadata['repository'] = repo
- self.cpv = _pkg_str(self.cpv, slot=slot, repo=repo)
+ self.cpv = _pkg_str(self.cpv, slot=slot,
+ repo=self.metadata.get('repository', ''))
self.cp = self.cpv.cp
+ # sync metadata with validated repo (may be UNKNOWN_REPO)
+ self.metadata['repository'] = self.cpv.repo
if (self.iuse.enabled or self.iuse.disabled) and \
not eapi_has_iuse_defaults(self.metadata["EAPI"]):
if not self.installed:
self._hash_key = Package._gen_hash_key(cpv=self.cpv,
installed=self.installed, onlydeps=self.onlydeps,
- operation=self.operation, repo_name=repo,
+ operation=self.operation, repo_name=self.cpv.repo,
root_config=self.root_config,
type_name=self.type_name)
self._hash_value = hash(self._hash_key)
from portage.exception import InvalidAtom, InvalidData, InvalidDependString
from portage.localization import _
from portage.versions import catpkgsplit, catsplit, \
- pkgcmp, vercmp, ververify, _cp, _cpv, _pkg_str
+ vercmp, ververify, _cp, _cpv, _pkg_str, _unknown_repo
import portage.cache.mappings
if sys.hexversion >= 0x3000000:
# stable keywords, make these warnings unconditional.
_internal_warnings = False
-_unknown_repo = "__unknown__"
-
def cpvequal(cpv1, cpv2):
"""
import portage
portage.proxy.lazyimport.lazyimport(globals(),
- 'portage.util:cmp_sort_key'
+ 'portage.repository.config:_gen_valid_repo',
+ 'portage.util:cmp_sort_key',
)
from portage import _unicode_decode
from portage.eapi import eapi_allows_dots_in_PN
from portage.exception import InvalidData
from portage.localization import _
+_unknown_repo = "__unknown__"
+
# \w is [a-zA-Z0-9_]
# 2.1.1 A category name may contain any of the characters [A-Za-z0-9+_.-].
if slot is not None:
self.__dict__['slot'] = slot
if repo is not None:
+ repo = _gen_valid_repo(repo)
+ if not repo:
+ repo = _unknown_repo
self.__dict__['repo'] = repo
def __setattr__(self, name, value):