1 |
According to PMS, a deprecated profile warning is not inherited. Since |
2 |
the current profile node may have been inherited by a user profile |
3 |
node, the deprecation warning may be relevant even if it is not a |
4 |
top-level profile node. Therefore, consider the deprecated warning |
5 |
to be irrelevant when the current profile node belongs to the same |
6 |
repo as the previous profile node. |
7 |
|
8 |
Bug: https://bugs.gentoo.org/753497 |
9 |
Signed-off-by: Zac Medico <zmedico@g.o> |
10 |
--- |
11 |
.../ebuild/_config/LocationsManager.py | 30 ++++++++++++++----- |
12 |
.../ebuild/deprecated_profile_check.py | 9 +++--- |
13 |
2 files changed, 27 insertions(+), 12 deletions(-) |
14 |
|
15 |
diff --git a/lib/portage/package/ebuild/_config/LocationsManager.py b/lib/portage/package/ebuild/_config/LocationsManager.py |
16 |
index b90b9227c..28740b355 100644 |
17 |
--- a/lib/portage/package/ebuild/_config/LocationsManager.py |
18 |
+++ b/lib/portage/package/ebuild/_config/LocationsManager.py |
19 |
@@ -30,7 +30,9 @@ _PORTAGE1_DIRECTORIES = frozenset([ |
20 |
|
21 |
_profile_node = collections.namedtuple('_profile_node', |
22 |
('location', 'portage1_directories', 'user_config', |
23 |
- 'profile_formats', 'eapi', 'allow_build_id')) |
24 |
+ 'profile_formats', 'eapi', 'allow_build_id', |
25 |
+ 'show_deprecated_warning', |
26 |
+)) |
27 |
|
28 |
_allow_parent_colon = frozenset( |
29 |
["portage-2"]) |
30 |
@@ -132,7 +134,7 @@ class LocationsManager: |
31 |
if self.profile_path: |
32 |
try: |
33 |
self._addProfile(os.path.realpath(self.profile_path), |
34 |
- repositories, known_repos) |
35 |
+ repositories, known_repos, ()) |
36 |
except ParseError as e: |
37 |
if not portage._sync_mode: |
38 |
writemsg(_("!!! Unable to parse profile: '%s'\n") % self.profile_path, noiselevel=-1) |
39 |
@@ -154,7 +156,9 @@ class LocationsManager: |
40 |
('profile-bashrcs', 'profile-set'), |
41 |
read_corresponding_eapi_file( |
42 |
custom_prof + os.sep, default=None), |
43 |
- True)) |
44 |
+ True, |
45 |
+ show_deprecated_warning=False, |
46 |
+ )) |
47 |
del custom_prof |
48 |
|
49 |
self.profiles = tuple(self.profiles) |
50 |
@@ -167,7 +171,7 @@ class LocationsManager: |
51 |
noiselevel=-1) |
52 |
raise DirectoryNotFound(var) |
53 |
|
54 |
- def _addProfile(self, currentPath, repositories, known_repos): |
55 |
+ def _addProfile(self, currentPath, repositories, known_repos, previous_repos): |
56 |
current_abs_path = os.path.abspath(currentPath) |
57 |
allow_directories = True |
58 |
allow_parent_colon = True |
59 |
@@ -176,8 +180,8 @@ class LocationsManager: |
60 |
current_formats = () |
61 |
eapi = None |
62 |
|
63 |
- intersecting_repos = [x for x in known_repos |
64 |
- if current_abs_path.startswith(x[0])] |
65 |
+ intersecting_repos = tuple(x for x in known_repos |
66 |
+ if current_abs_path.startswith(x[0])) |
67 |
if intersecting_repos: |
68 |
# Handle nested repositories. The longest path |
69 |
# will be the correct one. |
70 |
@@ -214,6 +218,14 @@ class LocationsManager: |
71 |
for x in layout_data['profile-formats']) |
72 |
current_formats = tuple(layout_data['profile-formats']) |
73 |
|
74 |
+ # According to PMS, a deprecated profile warning is not inherited. Since |
75 |
+ # the current profile node may have been inherited by a user profile |
76 |
+ # node, the deprecation warning may be relevant even if it is not a |
77 |
+ # top-level profile node. Therefore, consider the deprecated warning |
78 |
+ # to be irrelevant when the current profile node belongs to the same |
79 |
+ # repo as the previous profile node. |
80 |
+ show_deprecated_warning = (not previous_repos or |
81 |
+ tuple(x[0] for x in previous_repos) != tuple(x[0] for x in intersecting_repos)) |
82 |
|
83 |
if compat_mode: |
84 |
offenders = _PORTAGE1_DIRECTORIES.intersection(os.listdir(currentPath)) |
85 |
@@ -256,7 +268,7 @@ class LocationsManager: |
86 |
parentPath = os.path.realpath(parentPath) |
87 |
|
88 |
if exists_raise_eaccess(parentPath): |
89 |
- self._addProfile(parentPath, repositories, known_repos) |
90 |
+ self._addProfile(parentPath, repositories, known_repos, intersecting_repos) |
91 |
else: |
92 |
raise ParseError( |
93 |
_("Parent '%s' not found: '%s'") % \ |
94 |
@@ -265,7 +277,9 @@ class LocationsManager: |
95 |
self.profiles.append(currentPath) |
96 |
self.profiles_complex.append( |
97 |
_profile_node(currentPath, allow_directories, False, |
98 |
- current_formats, eapi, 'build-id' in current_formats)) |
99 |
+ current_formats, eapi, 'build-id' in current_formats, |
100 |
+ show_deprecated_warning=show_deprecated_warning, |
101 |
+ )) |
102 |
|
103 |
def _expand_parent_colon(self, parentsFile, parentPath, |
104 |
repo_loc, repositories): |
105 |
diff --git a/lib/portage/package/ebuild/deprecated_profile_check.py b/lib/portage/package/ebuild/deprecated_profile_check.py |
106 |
index e93ece2ac..ac4f00f63 100644 |
107 |
--- a/lib/portage/package/ebuild/deprecated_profile_check.py |
108 |
+++ b/lib/portage/package/ebuild/deprecated_profile_check.py |
109 |
@@ -19,10 +19,11 @@ def deprecated_profile_check(settings=None): |
110 |
if settings is not None: |
111 |
config_root = settings["PORTAGE_CONFIGROOT"] |
112 |
eprefix = settings["EPREFIX"] |
113 |
- for x in reversed(settings.profiles): |
114 |
- deprecated_profile_file = os.path.join(x, "deprecated") |
115 |
- if os.access(deprecated_profile_file, os.R_OK): |
116 |
- break |
117 |
+ for x in reversed(settings._locations_manager.profiles_complex): |
118 |
+ if x.show_deprecated_warning: |
119 |
+ deprecated_profile_file = os.path.join(x.location, "deprecated") |
120 |
+ if os.access(deprecated_profile_file, os.R_OK): |
121 |
+ break |
122 |
else: |
123 |
deprecated_profile_file = None |
124 |
|
125 |
-- |
126 |
2.26.2 |