def all_funtoo_repos(config): dict_out = {} conf_in = ConfigParser() repo_path = join_path(config.root_path, "/etc/portage/repos.conf") try: conf_in.read(map(lambda x: repo_path + "/" + x, os.listdir(repo_path))) except configparser.Error as e: Output.error("Parse error in /etc/portage/repos.conf: %s" % e.message) raise e for repo_name in conf_in.sections(): if repo_name == "DEFAULT": continue if "location" not in conf_in[repo_name]: Output.warning("No location specified for '%s' repository in %s" % (repo_name, repo_path)) dict_out[repo_name] = { "has_profiles": os.path.exists( join_path( config.root_path, conf_in[repo_name]["location"] + "/profiles/profiles.ego.desc")), "config": conf_in[repo_name] } return dict_out
def __init__(self, catalog, master_repo_name, config, funtoo_repos): self.master_catalog = catalog self.master_repo_name = master_repo_name self.funtoo_repos = funtoo_repos self.config = config self.root_parent_dir = join_path(self.config.root_path, '/etc/portage/make.profile') self.parent_map = defaultdict(None) # put variable definitions above this line ^^ self.reload()
def all_funtoo_repos(config): dict_out = {} conf_in = ConfigParser() repo_path = join_path(config.root_path, "/etc/portage/repos.conf") try: conf_in.read(map(lambda x: repo_path + "/" + x, os.listdir(repo_path))) except configparser.Error as e: Output.error("Parse error in /etc/portage/repos.conf: %s" % e.message) raise e for repo_name in conf_in.sections(): if repo_name == "DEFAULT": continue if "location" not in conf_in[repo_name]: Output.warning("No location specified for '%s' repository in %s" % (repo_name, repo_path)) dict_out[repo_name] = { "has_profiles": os.path.exists(join_path(config.root_path, conf_in[repo_name]["location"] + "/profiles/profiles.ego.desc")), "config": conf_in[repo_name] } return dict_out
def list(self, key, arch=None): """ Yields available profiles of a particular ProfileType. For example, given a ProfileType of mix-in, this method may yield: "gnome", "foobar", "mymixin". :param key: A ProfileType specifying the ProfileType to list. :param arch: An arch must be specified in order to also list ``subarch`` and arch-specific mix-ins. :return: generator """ if not arch and self.arch: arch = self.arch dirlist = [] if arch is not None: if key == ProfileType.SUBARCH: dirlist = [ self.json_info[str(ProfileType.ARCH)] + "/" + arch + "/subarch" ] elif key == ProfileType.MIX_IN: dirlist = [ self.json_info[str(ProfileType.MIX_IN)] + "/" + arch + "/mix-ins" ] if str(key) in self.json_info: dirlist += [self.json_info[str(key)]] # For now, disable defining new arches in overlays. This prevents extra arches from being displayed when # sub-arches are defined. if self.repo_name != "core-kit" and key == ProfileType.ARCH: return for dirname in dirlist: p = join_path(self.config.root_path, self.profile_root + "/" + dirname) try: for profile_root in os.listdir(p): if os.path.isdir(p + "/" + profile_root): self.directory_map[key][ profile_root] = dirname + "/" + profile_root if self.repo_name != "core-kit": yield self.repo_name + ":" + profile_root else: yield profile_root except OSError as e: if e.errno not in (errno.ENOTDIR, errno.ENOENT, errno.ESTALE): raise continue
def list(self, key, arch=None): """ Yields available profiles of a particular ProfileType. For example, given a ProfileType of mix-in, this method may yield: "gnome", "foobar", "mymixin". :param key: A ProfileType specifying the ProfileType to list. :param arch: An arch must be specified in order to also list ``subarch`` and arch-specific mix-ins. :return: generator """ if not arch and self.arch: arch = self.arch dirlist = [] if arch is not None: if key == ProfileType.SUBARCH: dirlist = [self.json_info[str(ProfileType.ARCH)] + "/" + arch + "/subarch"] elif key == ProfileType.MIX_IN: dirlist = [self.json_info[str(ProfileType.MIX_IN)] + "/" + arch + "/mix-ins"] if str(key) in self.json_info: dirlist += [self.json_info[str(key)]] # For now, disable defining new arches in overlays. This prevents extra arches from being displayed when # sub-arches are defined. if self.repo_name != "core-kit" and key == ProfileType.ARCH: return for dirname in dirlist: p = join_path(self.config.root_path, self.profile_root + "/" + dirname) try: for profile_root in os.listdir(p): if os.path.isdir(p + "/" + profile_root): self.directory_map[key][profile_root] = dirname + "/" + profile_root if self.repo_name != "core-kit": yield self.repo_name + ":" + profile_root else: yield profile_root except OSError as e: if e.errno not in (errno.ENOTDIR, errno.ENOENT, errno.ESTALE): raise continue