summaryrefslogtreecommitdiffstats
path: root/pym/portage/repository/config.py
diff options
context:
space:
mode:
authorBrian Harring <ferringb@chromium.org>2011-10-24 22:40:16 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-25 14:36:42 -0700
commita34ac493d13ba5ad20b07f25f4e4f054e303eecb (patch)
tree7545491d4cd39a3f38bfeaa3e15b39732d02ecc3 /pym/portage/repository/config.py
parent9d4459dfea72717c0565b0cfe39fa3a87a57ad9d (diff)
downloadportage-a34ac493d13ba5ad20b07f25f4e4f054e303eecb.tar.gz
portage-a34ac493d13ba5ad20b07f25f4e4f054e303eecb.tar.bz2
portage-a34ac493d13ba5ad20b07f25f4e4f054e303eecb.zip
layout.conf: add profile-format awareness
Note the portage-1-compat mode; this isn't settable externally, is purely an internal mode for tracking if a repository is in portage-1 compat mode, rather than explicit portage-1 mode. This compat mode will be removed once portage becomes strict.
Diffstat (limited to 'pym/portage/repository/config.py')
-rw-r--r--pym/portage/repository/config.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index fe2bd3310..377ba4733 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -48,7 +48,8 @@ class RepoConfig(object):
'eclass_overrides', 'eclass_locations', 'format', 'location',
'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name',
'name', 'priority', 'sign_manifest', 'sync', 'thin_manifest',
- 'update_changelog', 'user_location')
+ 'update_changelog', 'user_location', 'portage1_profiles',
+ 'portage1_profiles_compat')
def __init__(self, name, repo_opts):
"""Build a RepoConfig with options in repo_opts
@@ -128,6 +129,8 @@ class RepoConfig(object):
self.manifest_hashes = None
self.update_changelog = False
self.cache_format = None
+ self.portage1_profiles = True
+ self.portage1_profiles_compat = False
def get_pregenerated_cache(self, auxdbkeys, readonly=True, force=False):
format = self.cache_format
@@ -380,6 +383,10 @@ class RepoConfigLoader(object):
'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():
@@ -639,4 +646,18 @@ def parse_layout_conf(repo_location, repo_name=None):
data['update-changelog'] = layout_data.get('update-changelog', 'false').lower() \
== 'false'
+ raw_formats = layout_data.get('profile-formats')
+ if raw_formats is None:
+ raw_formats = ('portage-1-compat',)
+ else:
+ raw_formats = set(raw_formats.split())
+ unknown = raw_formats.difference(['pms', 'portage-1'])
+ warnings.warn((_("Repository named '%(repo_name)s' has unsupported "
+ "profiles in use ('profile-format' setting in '%(layout_filename)s;"
+ " please upgrade portage.") %
+ dict(repo_name=repo_name, layout_filename=layout_filename)),
+ DeprecationWarning)
+ raw_formats = tuple(raw_formats.intersection(['pms', 'portage-1']))
+ data['profile-formats'] = raw_formats
+
return data, layout_errors