def get_repo(uri): parts = urlparse.urlparse(uri, "file", allow_fragments=0) path = urllib.url2pathname(parts[2]) try: return repo.Repository(root=path) except cfg.ConfigError as e: raise repo.RepositoryError(_("The specified " "repository's configuration data is not " "valid:\n{0}").format(e))
def get_repo(uri): if uri in repo_cache: return repo_cache[uri] parts = urlparse.urlparse(uri, "file", allow_fragments=0) path = urllib.url2pathname(parts[2]) scfg = config.SvrConfig(path, None, None) scfg.set_read_only() try: scfg.init_dirs() except (config.SvrConfigError, EnvironmentError), e: raise repo.RepositoryError(_("An error occurred while " "trying to initialize the repository directory " "structures:\n%s") % e)
scfg = config.SvrConfig(path, None, None) scfg.set_read_only() try: scfg.init_dirs() except (config.SvrConfigError, EnvironmentError), e: raise repo.RepositoryError(_("An error occurred while " "trying to initialize the repository directory " "structures:\n%s") % e) scfg.acquire_in_flight() try: scfg.acquire_catalog() except catalog.CatalogPermissionsException, e: raise repo.RepositoryError(str(e)) try: repo_cache[uri] = repo.Repository(scfg) except rc.InvalidAttributeValueError, e: raise repo.RepositoryError(_("The specified repository's " "configuration data is not valid:\n%s") % e) return repo_cache[uri] def fetch_manifest(src_uri, pfmri): """Return the manifest data for package-fmri 'fmri' from the repository at 'src_uri'.""" if src_uri.startswith("file://"): try: