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): |