Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 414961 | Differences between
and this patch

Collapse All | Expand All

(-)a/pym/portage/package/ebuild/_config/LocationsManager.py (-3 / +16 lines)
Lines 28-33 _PORTAGE1_DIRECTORIES = frozenset([ Link Here
28
_profile_node = collections.namedtuple('_profile_node',
28
_profile_node = collections.namedtuple('_profile_node',
29
	'location portage1_directories')
29
	'location portage1_directories')
30
30
31
_allow_directories = frozenset(
32
	["portage-1-compat", "portage-1", "portage-2"])
33
34
_allow_parent_colon = frozenset(
35
	["portage-2"])
36
31
class LocationsManager(object):
37
class LocationsManager(object):
32
38
33
	def __init__(self, config_root=None, eprefix=None, config_profile_path=None, local_config=True, \
39
	def __init__(self, config_root=None, eprefix=None, config_profile_path=None, local_config=True, \
Lines 114-119 class LocationsManager(object): Link Here
114
	def _addProfile(self, currentPath, known_repos):
120
	def _addProfile(self, currentPath, known_repos):
115
		current_abs_path = os.path.abspath(currentPath)
121
		current_abs_path = os.path.abspath(currentPath)
116
		allow_directories = True
122
		allow_directories = True
123
		allow_parent_colon = False
117
		repo_loc = None
124
		repo_loc = None
118
		compat_mode = False
125
		compat_mode = False
119
		intersecting_repos = [x for x in known_repos if current_abs_path.startswith(x[0])]
126
		intersecting_repos = [x for x in known_repos if current_abs_path.startswith(x[0])]
Lines 121-129 class LocationsManager(object): Link Here
121
			# protect against nested repositories.  Insane configuration, but the longest
128
			# protect against nested repositories.  Insane configuration, but the longest
122
			# path will be the correct one.
129
			# path will be the correct one.
123
			repo_loc, layout_data = max(intersecting_repos, key=lambda x:len(x[0]))
130
			repo_loc, layout_data = max(intersecting_repos, key=lambda x:len(x[0]))
124
			allow_directories = any(x.startswith("portage-1")
131
			allow_directories = any(x in _allow_directories
125
				for x in layout_data['profile-formats'])
132
				for x in layout_data['profile-formats'])
126
			compat_mode = layout_data['profile-formats'] == ('portage-1-compat',)
133
			compat_mode = layout_data['profile-formats'] == ('portage-1-compat',)
134
			allow_parent_colon = any(x in _allow_parent_colon
135
				for x in layout_data['profile-formats'])
127
136
128
		if compat_mode:
137
		if compat_mode:
129
			offenders = _PORTAGE1_DIRECTORIES.intersection(os.listdir(currentPath))
138
			offenders = _PORTAGE1_DIRECTORIES.intersection(os.listdir(currentPath))
Lines 165-172 class LocationsManager(object): Link Here
165
					_("Empty parent file: '%s'") % parentsFile)
174
					_("Empty parent file: '%s'") % parentsFile)
166
			for parentPath in parents:
175
			for parentPath in parents:
167
				abs_parent = parentPath[:1] == os.sep
176
				abs_parent = parentPath[:1] == os.sep
168
				parentPath = normalize_path(os.path.join(
177
				if allow_parent_colon and parentPath[:1] == ":":
169
					currentPath, parentPath))
178
					parentPath = normalize_path(os.path.join(
179
						repo_loc, 'profiles', parentPath[1:]))
180
				else:
181
					parentPath = normalize_path(os.path.join(
182
						currentPath, parentPath))
170
183
171
				if abs_parent or repo_loc is None or \
184
				if abs_parent or repo_loc is None or \
172
					not parentPath.startswith(repo_loc):
185
					not parentPath.startswith(repo_loc):
(-)a/pym/portage/repository/config.py (-3 / +5 lines)
Lines 27-32 from portage import _unicode_encode Link Here
27
from portage import _encodings
27
from portage import _encodings
28
from portage import manifest
28
from portage import manifest
29
29
30
_profile_formats = frozenset(
31
	['pms', 'portage-1', 'portage-2'])
32
30
_repo_name_sub_re = re.compile(r'[^\w-]')
33
_repo_name_sub_re = re.compile(r'[^\w-]')
31
34
32
def _gen_valid_repo(name):
35
def _gen_valid_repo(name):
Lines 760-766 def parse_layout_conf(repo_location, repo_name=None): Link Here
760
			raw_formats = ('portage-1-compat',)
763
			raw_formats = ('portage-1-compat',)
761
	else:
764
	else:
762
		raw_formats = set(raw_formats.split())
765
		raw_formats = set(raw_formats.split())
763
		unknown = raw_formats.difference(['pms', 'portage-1'])
766
		unknown = raw_formats.difference(_profile_formats)
764
		if unknown:
767
		if unknown:
765
			repo_name = _get_repo_name(repo_location, cached=repo_name)
768
			repo_name = _get_repo_name(repo_location, cached=repo_name)
766
			warnings.warn((_("Repository named '%(repo_name)s' has unsupported "
769
			warnings.warn((_("Repository named '%(repo_name)s' has unsupported "
Lines 770-776 def parse_layout_conf(repo_location, repo_name=None): Link Here
770
				layout_filename=layout_filename,
773
				layout_filename=layout_filename,
771
				unknown_fmts=" ".join(unknown))),
774
				unknown_fmts=" ".join(unknown))),
772
				DeprecationWarning)
775
				DeprecationWarning)
773
		raw_formats = tuple(raw_formats.intersection(['pms', 'portage-1']))
776
		raw_formats = tuple(raw_formats.intersection(_profile_formats))
774
	data['profile-formats'] = raw_formats
777
	data['profile-formats'] = raw_formats
775
778
776
	return data, layout_errors
779
	return data, layout_errors
777
- 

Return to bug 414961