Parse layout.conf files in portage.repository.config.RepoConfig.__init__()
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sun, 18 Dec 2011 03:01:31 +0000 (04:01 +0100)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sun, 18 Dec 2011 03:01:31 +0000 (04:01 +0100)
instead of portage.repository.config.RepoConfigLoader.__init__().

pym/portage/repository/config.py

index 0222253e25f9028af371e744793715761b4779ca..1cc66ddd11307d2695083073a03918f8657f1dc0 100644 (file)
@@ -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():