Support overriding repo-name from layout.conf.
authorMichał Górny <mgorny@gentoo.org>
Fri, 29 Mar 2013 09:23:47 +0000 (10:23 +0100)
committerZac Medico <zmedico@gentoo.org>
Fri, 29 Mar 2013 21:42:57 +0000 (14:42 -0700)
Consider this an undocumented and unsupported feature which will make my
life much easier. And decrease the amount of repo_name changes committed
by mistake. See bug #433561.

pym/portage/repository/config.py

index adeab188d2cad2165591400c0759d9597dd95c1b..969fce43ebb783339f6a6960991b38c78e495153 100644 (file)
@@ -180,6 +180,12 @@ class RepoConfig(object):
                                # them the ability to do incremental overrides
                                self.aliases = layout_data['aliases'] + tuple(aliases)
 
+                       if layout_data['repo-name']:
+                               # allow layout.conf to override repository name
+                               # useful when having two copies of the same repo enabled
+                               # to avoid modifying profiles/repo_name in one of them
+                               self.name = layout_data['repo-name']
+
                        for value in ('allow-missing-manifest',
                                'allow-provide-virtual', 'cache-formats',
                                'create-manifest', 'disable-manifest', 'manifest-hashes',
@@ -748,6 +754,8 @@ def parse_layout_conf(repo_location, repo_name=None):
        data['thin-manifest'] = layout_data.get('thin-manifests', 'false').lower() \
                == 'true'
 
+       data['repo-name'] = _gen_valid_repo(layout_data.get('repo-name', ''))
+
        manifest_policy = layout_data.get('use-manifests', 'strict').lower()
        data['allow-missing-manifest'] = manifest_policy != 'strict'
        data['create-manifest'] = manifest_policy != 'false'