From 10246cd535f909dda8bd05de617c32d2b8a56b4a Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sun, 18 Dec 2011 04:01:31 +0100 Subject: [PATCH] Parse layout.conf files in portage.repository.config.RepoConfig.__init__() instead of portage.repository.config.RepoConfigLoader.__init__(). --- pym/portage/repository/config.py | 56 +++++++++++++++----------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 0222253e2..1cc66ddd1 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -125,6 +125,33 @@ class RepoConfig(object): self.portage1_profiles = True self.portage1_profiles_compat = False + # Parse layout.conf. + if self.location: + layout_filename = os.path.join(self.location, "metadata", "layout.conf") + layout_data = parse_layout_conf(self.location, self.name)[0] + + # layout.conf masters may be overridden here if we have a masters + # setting from the user's repos.conf + if self.masters is None: + self.masters = layout_data['masters'] + + if layout_data['aliases']: + aliases = self.aliases + if aliases is None: + aliases = () + # repos.conf aliases come after layout.conf aliases, giving + # them the ability to do incremental overrides + self.aliases = layout_data['aliases'] + tuple(aliases) + + for value in ('allow-missing-manifest', 'cache-formats', + 'create-manifest', 'disable-manifest', 'manifest-hashes', + 'sign-manifest', 'thin-manifest', 'update-changelog'): + setattr(self, value.lower().replace("-", "_"), layout_data[value]) + + self.portage1_profiles = any(x.startswith("portage-1") \ + for x in layout_data['profile-formats']) + self.portage1_profiles_compat = layout_data['profile-formats'] == ('portage-1-compat',) + def iter_pregenerated_caches(self, auxdbkeys, readonly=True, force=False): """ Reads layout.conf cache-formats from left to right and yields cache @@ -412,35 +439,6 @@ class RepoConfigLoader(object): for repo in prepos.values() if repo.location is not None and repo.missing_repo_name) - #Parse layout.conf and read masters key. - for repo in prepos.values(): - if not repo.location: - continue - layout_filename = os.path.join(repo.location, "metadata", "layout.conf") - layout_data, layout_errors = parse_layout_conf(repo.location, repo.name) - - # layout.conf masters may be overridden here if we have a masters - # setting from the user's repos.conf - if repo.masters is None: - repo.masters = layout_data['masters'] - - if layout_data['aliases']: - aliases = repo.aliases - if aliases is None: - aliases = () - # repos.conf aliases come after layout.conf aliases, giving - # them the ability to do incremental overrrides - repo.aliases = layout_data['aliases'] + tuple(aliases) - - for value in ('allow-missing-manifest', 'cache-formats', - 'create-manifest', 'disable-manifest', 'manifest-hashes', - 'sign-manifest', 'thin-manifest', 'update-changelog'): - setattr(repo, value.lower().replace("-", "_"), layout_data[value]) - - repo.portage1_profiles = any(x.startswith("portage-1") \ - for x in layout_data['profile-formats']) - repo.portage1_profiles_compat = layout_data['profile-formats'] == ('portage-1-compat',) - #Take aliases into account. new_prepos = {} for repo_name, repo in prepos.items(): -- 2.26.2