def __init__(self, location, eclass_cache, cache=(), default_mirrors=None, override_repo_id=None, ignore_paludis_versioning=False, allow_missing_manifests=False, repo_config=None): """ :param location: on disk location of the tree :param cache: sequence of :obj:`pkgcore.cache.template.database` instances to use for storing metadata :param eclass_cache: If not None, :obj:`pkgcore.ebuild.eclass_cache` instance representing the eclasses available, if None, generates the eclass_cache itself :param default_mirrors: Either None, or sequence of mirrors to try fetching from first, then falling back to other uri :param override_repo_id: Either None, or string to force as the repository unique id :param ignore_paludis_versioning: If False, fail when -scm is encountred. if True, silently ignore -scm ebuilds. """ prototype.tree.__init__(self) if repo_config is None: repo_config = repo_objs.RepoConfig(location) self.config = repo_config self._repo_id = override_repo_id self.base = self.location = location try: if not stat.S_ISDIR(os.stat(self.base).st_mode): raise errors.InitializationError( "base not a dir: %s" % self.base) except OSError: raise_from(errors.InitializationError( "lstat failed on base %s" % (self.base,))) self.eclass_cache = eclass_cache self.licenses = repo_objs.Licenses(location) fp = pjoin(self.base, metadata_offset, "thirdpartymirrors") mirrors = {} try: for k, v in read_dict(fp, splitter=None).iteritems(): v = v.split() shuffle(v) mirrors[k] = v except EnvironmentError, ee: if ee.errno != errno.ENOENT: raise
def _read_mtime_cache(location): try: logger.debug("reading mtime cache at %r", (location,)) d = {} for k, v in read_dict(readlines_ascii(location, True), splitter=None, source_isiter=True).iteritems(): v = v.split() # mtime pkg1 fullver1 virtual1 pkg2 fullver2 virtual2... # if it's not the right length, skip this entry, # cache validation will update it. if (len(v) -1) % 3 == 0: d[k] = v return d except IOError, e: if e.errno != errno.ENOENT: raise logger.debug("failed reading mtime cache at %r", (location,)) return {}