1 |
commit: 328a87e50b0559517ca4b6c016617afc5ac7a2f4 |
2 |
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Feb 19 01:46:16 2022 +0000 |
4 |
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 2 04:22:53 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=328a87e5 |
7 |
|
8 |
Eliminate now-dead code from EAPIs 4-python and 5-progress |
9 |
|
10 |
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org> |
11 |
|
12 |
bin/eapi.sh | 32 ---- |
13 |
bin/ebuild.sh | 9 -- |
14 |
bin/phase-helpers.sh | 166 --------------------- |
15 |
bin/save-ebuild-env.sh | 7 - |
16 |
lib/_emerge/EbuildMetadataPhase.py | 17 --- |
17 |
lib/_emerge/Package.py | 15 +- |
18 |
lib/portage/dep/__init__.py | 138 ++++------------- |
19 |
lib/portage/eapi.py | 26 ---- |
20 |
lib/portage/package/ebuild/_config/UseManager.py | 3 +- |
21 |
.../package/ebuild/_config/unpack_dependencies.py | 55 ------- |
22 |
lib/portage/package/ebuild/config.py | 8 - |
23 |
lib/portage/package/ebuild/doebuild.py | 9 -- |
24 |
lib/portage/tests/resolver/ResolverPlayground.py | 1 - |
25 |
lib/portage/versions.py | 66 ++------ |
26 |
14 files changed, 45 insertions(+), 507 deletions(-) |
27 |
|
28 |
diff --git a/bin/eapi.sh b/bin/eapi.sh |
29 |
index b6d2e07f1..a39513b1c 100644 |
30 |
--- a/bin/eapi.sh |
31 |
+++ b/bin/eapi.sh |
32 |
@@ -144,34 +144,6 @@ ___eapi_has_useq() { |
33 |
[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-slot-abi|5|6|7)$ ]] |
34 |
} |
35 |
|
36 |
-___eapi_has_master_repositories() { |
37 |
- [[ ${1-${EAPI-0}} =~ ^$ ]] |
38 |
-} |
39 |
- |
40 |
-___eapi_has_repository_path() { |
41 |
- [[ ${1-${EAPI-0}} =~ ^$ ]] |
42 |
-} |
43 |
- |
44 |
-___eapi_has_available_eclasses() { |
45 |
- [[ ${1-${EAPI-0}} =~ ^$ ]] |
46 |
-} |
47 |
- |
48 |
-___eapi_has_eclass_path() { |
49 |
- [[ ${1-${EAPI-0}} =~ ^$ ]] |
50 |
-} |
51 |
- |
52 |
-___eapi_has_license_path() { |
53 |
- [[ ${1-${EAPI-0}} =~ ^$ ]] |
54 |
-} |
55 |
- |
56 |
-___eapi_has_package_manager_build_user() { |
57 |
- [[ ${1-${EAPI-0}} =~ ^$ ]] |
58 |
-} |
59 |
- |
60 |
-___eapi_has_package_manager_build_group() { |
61 |
- [[ ${1-${EAPI-0}} =~ ^$ ]] |
62 |
-} |
63 |
- |
64 |
# HELPERS BEHAVIOR |
65 |
|
66 |
___eapi_best_version_and_has_version_support_--host-root() { |
67 |
@@ -296,10 +268,6 @@ ___eapi_enables_failglob_in_global_scope() { |
68 |
[[ ! ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-slot-abi|5)$ ]] |
69 |
} |
70 |
|
71 |
-___eapi_enables_globstar() { |
72 |
- [[ ${1-${EAPI-0}} =~ ^$ ]] |
73 |
-} |
74 |
- |
75 |
___eapi_bash_3_2() { |
76 |
[[ ${1-${EAPI-0}} =~ ^(0|1|2|3|4|4-slot-abi|5)$ ]] |
77 |
} |
78 |
|
79 |
diff --git a/bin/ebuild.sh b/bin/ebuild.sh |
80 |
index 5b0b79585..628d7eb80 100755 |
81 |
--- a/bin/ebuild.sh |
82 |
+++ b/bin/ebuild.sh |
83 |
@@ -73,11 +73,6 @@ else |
84 |
# These functions die because calls to them during the "depend" phase |
85 |
# are considered to be severe QA violations. |
86 |
funcs+=" best_version has_version portageq" |
87 |
- ___eapi_has_master_repositories && funcs+=" master_repositories" |
88 |
- ___eapi_has_repository_path && funcs+=" repository_path" |
89 |
- ___eapi_has_available_eclasses && funcs+=" available_eclasses" |
90 |
- ___eapi_has_eclass_path && funcs+=" eclass_path" |
91 |
- ___eapi_has_license_path && funcs+=" license_path" |
92 |
for x in ${funcs} ; do |
93 |
eval "${x}() { die \"\${FUNCNAME}() calls are not allowed in global scope\"; }" |
94 |
done |
95 |
@@ -573,10 +568,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm depend && \ |
96 |
[[ -n $EAPI ]] || EAPI=0 |
97 |
fi |
98 |
|
99 |
-if ___eapi_enables_globstar; then |
100 |
- shopt -s globstar |
101 |
-fi |
102 |
- |
103 |
# Convert quoted paths to array. |
104 |
eval "PORTAGE_ECLASS_LOCATIONS=(${PORTAGE_ECLASS_LOCATIONS})" |
105 |
|
106 |
|
107 |
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh |
108 |
index a6aaa7926..0a3bc5cb7 100644 |
109 |
--- a/bin/phase-helpers.sh |
110 |
+++ b/bin/phase-helpers.sh |
111 |
@@ -1210,169 +1210,3 @@ if ___eapi_has_in_iuse; then |
112 |
has "${use}" "${liuse[@]#[+-]}" |
113 |
} |
114 |
fi |
115 |
- |
116 |
-if ___eapi_has_master_repositories; then |
117 |
- master_repositories() { |
118 |
- local output repository=$1 retval |
119 |
- shift |
120 |
- [[ $# -gt 0 ]] && die "${FUNCNAME[0]}: unused argument(s): $*" |
121 |
- |
122 |
- if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then |
123 |
- "${PORTAGE_BIN_PATH}/ebuild-ipc" master_repositories "${EROOT}" "${repository}" |
124 |
- else |
125 |
- output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" master_repositories "${EROOT}" "${repository}") |
126 |
- fi |
127 |
- retval=$? |
128 |
- [[ -n ${output} ]] && echo "${output}" |
129 |
- case "${retval}" in |
130 |
- 0|1) |
131 |
- return ${retval} |
132 |
- ;; |
133 |
- 2) |
134 |
- die "${FUNCNAME[0]}: invalid repository: ${repository}" |
135 |
- ;; |
136 |
- *) |
137 |
- if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then |
138 |
- die "${FUNCNAME[0]}: unexpected ebuild-ipc exit code: ${retval}" |
139 |
- else |
140 |
- die "${FUNCNAME[0]}: unexpected portageq exit code: ${retval}" |
141 |
- fi |
142 |
- ;; |
143 |
- esac |
144 |
- } |
145 |
-fi |
146 |
- |
147 |
-if ___eapi_has_repository_path; then |
148 |
- repository_path() { |
149 |
- local output repository=$1 retval |
150 |
- shift |
151 |
- [[ $# -gt 0 ]] && die "${FUNCNAME[0]}: unused argument(s): $*" |
152 |
- |
153 |
- if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then |
154 |
- "${PORTAGE_BIN_PATH}/ebuild-ipc" repository_path "${EROOT}" "${repository}" |
155 |
- else |
156 |
- output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" get_repo_path "${EROOT}" "${repository}") |
157 |
- fi |
158 |
- retval=$? |
159 |
- [[ -n ${output} ]] && echo "${output}" |
160 |
- case "${retval}" in |
161 |
- 0|1) |
162 |
- return ${retval} |
163 |
- ;; |
164 |
- 2) |
165 |
- die "${FUNCNAME[0]}: invalid repository: ${repository}" |
166 |
- ;; |
167 |
- *) |
168 |
- if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then |
169 |
- die "${FUNCNAME[0]}: unexpected ebuild-ipc exit code: ${retval}" |
170 |
- else |
171 |
- die "${FUNCNAME[0]}: unexpected portageq exit code: ${retval}" |
172 |
- fi |
173 |
- ;; |
174 |
- esac |
175 |
- } |
176 |
-fi |
177 |
- |
178 |
-if ___eapi_has_available_eclasses; then |
179 |
- available_eclasses() { |
180 |
- local output repository=${PORTAGE_REPO_NAME} retval |
181 |
- [[ $# -gt 0 ]] && die "${FUNCNAME[0]}: unused argument(s): $*" |
182 |
- |
183 |
- if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then |
184 |
- "${PORTAGE_BIN_PATH}/ebuild-ipc" available_eclasses "${EROOT}" "${repository}" |
185 |
- else |
186 |
- output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" available_eclasses "${EROOT}" "${repository}") |
187 |
- fi |
188 |
- retval=$? |
189 |
- [[ -n ${output} ]] && echo "${output}" |
190 |
- case "${retval}" in |
191 |
- 0|1) |
192 |
- return ${retval} |
193 |
- ;; |
194 |
- 2) |
195 |
- die "${FUNCNAME[0]}: invalid repository: ${repository}" |
196 |
- ;; |
197 |
- *) |
198 |
- if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then |
199 |
- die "${FUNCNAME[0]}: unexpected ebuild-ipc exit code: ${retval}" |
200 |
- else |
201 |
- die "${FUNCNAME[0]}: unexpected portageq exit code: ${retval}" |
202 |
- fi |
203 |
- ;; |
204 |
- esac |
205 |
- } |
206 |
-fi |
207 |
- |
208 |
-if ___eapi_has_eclass_path; then |
209 |
- eclass_path() { |
210 |
- local eclass=$1 output repository=${PORTAGE_REPO_NAME} retval |
211 |
- shift |
212 |
- [[ $# -gt 0 ]] && die "${FUNCNAME[0]}: unused argument(s): $*" |
213 |
- |
214 |
- if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then |
215 |
- "${PORTAGE_BIN_PATH}/ebuild-ipc" eclass_path "${EROOT}" "${repository}" "${eclass}" |
216 |
- else |
217 |
- output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" eclass_path "${EROOT}" "${repository}" "${eclass}") |
218 |
- fi |
219 |
- retval=$? |
220 |
- [[ -n ${output} ]] && echo "${output}" |
221 |
- case "${retval}" in |
222 |
- 0|1) |
223 |
- return ${retval} |
224 |
- ;; |
225 |
- 2) |
226 |
- die "${FUNCNAME[0]}: invalid repository: ${repository}" |
227 |
- ;; |
228 |
- *) |
229 |
- if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then |
230 |
- die "${FUNCNAME[0]}: unexpected ebuild-ipc exit code: ${retval}" |
231 |
- else |
232 |
- die "${FUNCNAME[0]}: unexpected portageq exit code: ${retval}" |
233 |
- fi |
234 |
- ;; |
235 |
- esac |
236 |
- } |
237 |
-fi |
238 |
- |
239 |
-if ___eapi_has_license_path; then |
240 |
- license_path() { |
241 |
- local license=$1 output repository=${PORTAGE_REPO_NAME} retval |
242 |
- shift |
243 |
- [[ $# -gt 0 ]] && die "${FUNCNAME[0]}: unused argument(s): $*" |
244 |
- |
245 |
- if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then |
246 |
- "${PORTAGE_BIN_PATH}/ebuild-ipc" license_path "${EROOT}" "${repository}" "${license}" |
247 |
- else |
248 |
- output=$("${PORTAGE_BIN_PATH}/ebuild-helpers/portageq" license_path "${EROOT}" "${repository}" "${license}") |
249 |
- fi |
250 |
- retval=$? |
251 |
- [[ -n ${output} ]] && echo "${output}" |
252 |
- case "${retval}" in |
253 |
- 0|1) |
254 |
- return ${retval} |
255 |
- ;; |
256 |
- 2) |
257 |
- die "${FUNCNAME[0]}: invalid repository: ${repository}" |
258 |
- ;; |
259 |
- *) |
260 |
- if [[ -n ${PORTAGE_IPC_DAEMON} ]]; then |
261 |
- die "${FUNCNAME[0]}: unexpected ebuild-ipc exit code: ${retval}" |
262 |
- else |
263 |
- die "${FUNCNAME[0]}: unexpected portageq exit code: ${retval}" |
264 |
- fi |
265 |
- ;; |
266 |
- esac |
267 |
- } |
268 |
-fi |
269 |
- |
270 |
-if ___eapi_has_package_manager_build_user; then |
271 |
- package_manager_build_user() { |
272 |
- echo "${PORTAGE_BUILD_USER}" |
273 |
- } |
274 |
-fi |
275 |
- |
276 |
-if ___eapi_has_package_manager_build_group; then |
277 |
- package_manager_build_group() { |
278 |
- echo "${PORTAGE_BUILD_GROUP}" |
279 |
- } |
280 |
-fi |
281 |
|
282 |
diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh |
283 |
index 98808814b..17e4b1b3e 100644 |
284 |
--- a/bin/save-ebuild-env.sh |
285 |
+++ b/bin/save-ebuild-env.sh |
286 |
@@ -81,13 +81,6 @@ __save_ebuild_env() { |
287 |
${QA_INTERCEPTORS} |
288 |
|
289 |
___eapi_has_usex && unset -f usex |
290 |
- ___eapi_has_master_repositories && unset -f master_repositories |
291 |
- ___eapi_has_repository_path && unset -f repository_path |
292 |
- ___eapi_has_available_eclasses && unset -f available_eclasses |
293 |
- ___eapi_has_eclass_path && unset -f eclass_path |
294 |
- ___eapi_has_license_path && unset -f license_path |
295 |
- ___eapi_has_package_manager_build_user && unset -f package_manager_build_user |
296 |
- ___eapi_has_package_manager_build_group && unset -f package_manager_build_group |
297 |
|
298 |
# Clear out the triple underscore namespace as it is reserved by the PM. |
299 |
unset -f $(compgen -A function ___) |
300 |
|
301 |
diff --git a/lib/_emerge/EbuildMetadataPhase.py b/lib/_emerge/EbuildMetadataPhase.py |
302 |
index e85b3f707..4b6add973 100644 |
303 |
--- a/lib/_emerge/EbuildMetadataPhase.py |
304 |
+++ b/lib/_emerge/EbuildMetadataPhase.py |
305 |
@@ -14,8 +14,6 @@ from portage import os |
306 |
from portage import _encodings |
307 |
from portage import _unicode_decode |
308 |
from portage import _unicode_encode |
309 |
-from portage.dep import extract_unpack_dependencies |
310 |
-from portage.eapi import eapi_has_automatic_unpack_dependencies |
311 |
|
312 |
import fcntl |
313 |
import io |
314 |
@@ -216,21 +214,6 @@ class EbuildMetadataPhase(SubProcess): |
315 |
metadata["_eclasses_"] = {} |
316 |
metadata.pop("INHERITED", None) |
317 |
|
318 |
- if eapi_has_automatic_unpack_dependencies(metadata["EAPI"]): |
319 |
- repo = self.portdb.repositories.get_name_for_location( |
320 |
- self.repo_path |
321 |
- ) |
322 |
- unpackers = self.settings.unpack_dependencies.get(repo, {}).get( |
323 |
- metadata["EAPI"], {} |
324 |
- ) |
325 |
- unpack_dependencies = extract_unpack_dependencies( |
326 |
- metadata["SRC_URI"], unpackers |
327 |
- ) |
328 |
- if unpack_dependencies: |
329 |
- metadata["DEPEND"] += ( |
330 |
- " " if metadata["DEPEND"] else "" |
331 |
- ) + unpack_dependencies |
332 |
- |
333 |
# If called by egencache, this cache write is |
334 |
# undesirable when metadata-transfer is disabled. |
335 |
if self.write_auxdb is not False: |
336 |
|
337 |
diff --git a/lib/_emerge/Package.py b/lib/_emerge/Package.py |
338 |
index cc2cb07e1..7c4997aab 100644 |
339 |
--- a/lib/_emerge/Package.py |
340 |
+++ b/lib/_emerge/Package.py |
341 |
@@ -17,7 +17,7 @@ from portage.dep import ( |
342 |
) |
343 |
from portage.dep.soname.parse import parse_soname_deps |
344 |
from portage.versions import _pkg_str, _unknown_repo |
345 |
-from portage.eapi import _get_eapi_attrs, eapi_has_use_aliases |
346 |
+from portage.eapi import _get_eapi_attrs |
347 |
from portage.exception import InvalidData, InvalidDependString |
348 |
from portage.localization import _ |
349 |
from _emerge.Task import Task |
350 |
@@ -628,9 +628,6 @@ class Package(Task): |
351 |
self._expand_hidden = None |
352 |
self._force = None |
353 |
self._mask = None |
354 |
- if eapi_has_use_aliases(pkg.eapi): |
355 |
- for enabled_flag in enabled_flags: |
356 |
- enabled_flags.extend(pkg.iuse.alias_mapping.get(enabled_flag, [])) |
357 |
self.enabled = frozenset(enabled_flags) |
358 |
if pkg.built: |
359 |
# Use IUSE to validate USE settings for built packages, |
360 |
@@ -756,25 +753,15 @@ class Package(Task): |
361 |
enabled_aliases = [] |
362 |
disabled_aliases = [] |
363 |
other_aliases = [] |
364 |
- aliases_supported = eapi_has_use_aliases(eapi) |
365 |
self.alias_mapping = {} |
366 |
for x in tokens: |
367 |
prefix = x[:1] |
368 |
if prefix == "+": |
369 |
enabled.append(x[1:]) |
370 |
- if aliases_supported: |
371 |
- self.alias_mapping[x[1:]] = aliases.get(x[1:], []) |
372 |
- enabled_aliases.extend(self.alias_mapping[x[1:]]) |
373 |
elif prefix == "-": |
374 |
disabled.append(x[1:]) |
375 |
- if aliases_supported: |
376 |
- self.alias_mapping[x[1:]] = aliases.get(x[1:], []) |
377 |
- disabled_aliases.extend(self.alias_mapping[x[1:]]) |
378 |
else: |
379 |
other.append(x) |
380 |
- if aliases_supported: |
381 |
- self.alias_mapping[x] = aliases.get(x, []) |
382 |
- other_aliases.extend(self.alias_mapping[x]) |
383 |
self.enabled = frozenset(chain(enabled, enabled_aliases)) |
384 |
self.disabled = frozenset(chain(disabled, disabled_aliases)) |
385 |
self.all = frozenset(chain(enabled, disabled, other)) |
386 |
|
387 |
diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py |
388 |
index 13c0f4ef7..5ebf95e89 100644 |
389 |
--- a/lib/portage/dep/__init__.py |
390 |
+++ b/lib/portage/dep/__init__.py |
391 |
@@ -106,23 +106,18 @@ def _match_slot(atom, pkg): |
392 |
return False |
393 |
|
394 |
|
395 |
-_atom_re_cache = {} |
396 |
+_atom_re = None |
397 |
|
398 |
|
399 |
def _get_atom_re(eapi_attrs): |
400 |
- cache_key = eapi_attrs.dots_in_PN |
401 |
- atom_re = _atom_re_cache.get(cache_key) |
402 |
- if atom_re is not None: |
403 |
- return atom_re |
404 |
- |
405 |
- if eapi_attrs.dots_in_PN: |
406 |
- cp_re = _cp["dots_allowed_in_PN"] |
407 |
- cpv_re = _cpv["dots_allowed_in_PN"] |
408 |
- else: |
409 |
- cp_re = _cp["dots_disallowed_in_PN"] |
410 |
- cpv_re = _cpv["dots_disallowed_in_PN"] |
411 |
+ global _atom_re |
412 |
+ if _atom_re is not None: |
413 |
+ return _atom_re |
414 |
+ |
415 |
+ cp_re = _cp |
416 |
+ cpv_re = _cpv |
417 |
|
418 |
- atom_re = re.compile( |
419 |
+ _atom_re = re.compile( |
420 |
"^(?P<without_use>(?:" |
421 |
+ "(?P<op>" |
422 |
+ _op |
423 |
@@ -144,26 +139,20 @@ def _get_atom_re(eapi_attrs): |
424 |
+ ")?$", |
425 |
re.VERBOSE | re.UNICODE, |
426 |
) |
427 |
+ return _atom_re |
428 |
|
429 |
- _atom_re_cache[cache_key] = atom_re |
430 |
- return atom_re |
431 |
|
432 |
- |
433 |
-_atom_wildcard_re_cache = {} |
434 |
+_atom_wildcard_re = None |
435 |
|
436 |
|
437 |
def _get_atom_wildcard_re(eapi_attrs): |
438 |
- cache_key = eapi_attrs.dots_in_PN |
439 |
- atom_re = _atom_wildcard_re_cache.get(cache_key) |
440 |
- if atom_re is not None: |
441 |
- return atom_re |
442 |
+ global _atom_wildcard_re |
443 |
+ if _atom_wildcard_re is not None: |
444 |
+ return _atom_wildcard_re |
445 |
|
446 |
- if eapi_attrs.dots_in_PN: |
447 |
- pkg_re = r"[\w+*][\w+.*-]*?" |
448 |
- else: |
449 |
- pkg_re = r"[\w+*][\w+*-]*?" |
450 |
+ pkg_re = r"[\w+*][\w+*-]*?" |
451 |
|
452 |
- atom_re = re.compile( |
453 |
+ _atom_wildcard_re = re.compile( |
454 |
r"((?P<simple>(" |
455 |
+ _extended_cat |
456 |
+ r")/(" |
457 |
@@ -185,12 +174,10 @@ def _get_atom_wildcard_re(eapi_attrs): |
458 |
+ r"))?$", |
459 |
re.UNICODE, |
460 |
) |
461 |
+ return _atom_wildcard_re |
462 |
|
463 |
- _atom_wildcard_re_cache[cache_key] = atom_re |
464 |
- return atom_re |
465 |
|
466 |
- |
467 |
-_usedep_re_cache = {} |
468 |
+_usedep_re = None |
469 |
|
470 |
|
471 |
def _get_usedep_re(eapi_attrs): |
472 |
@@ -201,27 +188,19 @@ def _get_usedep_re(eapi_attrs): |
473 |
@return: A regular expression object that matches valid USE deps for the |
474 |
given eapi. |
475 |
""" |
476 |
- cache_key = eapi_attrs.dots_in_use_flags |
477 |
- usedep_re = _usedep_re_cache.get(cache_key) |
478 |
- if usedep_re is not None: |
479 |
- return usedep_re |
480 |
- |
481 |
- if eapi_attrs.dots_in_use_flags: |
482 |
- _flag_re = r"[A-Za-z0-9][A-Za-z0-9+_@.-]*" |
483 |
- else: |
484 |
- _flag_re = r"[A-Za-z0-9][A-Za-z0-9+_@-]*" |
485 |
+ global _usedep_re |
486 |
+ if _usedep_re is not None: |
487 |
+ return _usedep_re |
488 |
|
489 |
- usedep_re = re.compile( |
490 |
+ _usedep_re = re.compile( |
491 |
r"^(?P<prefix>[!-]?)(?P<flag>" |
492 |
- + _flag_re |
493 |
+ + r"[A-Za-z0-9][A-Za-z0-9+_@-]*" |
494 |
+ r")(?P<default>(\(\+\)|\(\-\))?)(?P<suffix>[?=]?)$" |
495 |
) |
496 |
+ return _usedep_re |
497 |
|
498 |
- _usedep_re_cache[cache_key] = usedep_re |
499 |
- return usedep_re |
500 |
|
501 |
- |
502 |
-_useflag_re_cache = {} |
503 |
+_useflag_re = None |
504 |
|
505 |
|
506 |
def _get_useflag_re(eapi): |
507 |
@@ -234,21 +213,12 @@ def _get_useflag_re(eapi): |
508 |
@return: A regular expression object that matches valid USE flags for the |
509 |
given eapi. |
510 |
""" |
511 |
- eapi_attrs = _get_eapi_attrs(eapi) |
512 |
- cache_key = eapi_attrs.dots_in_use_flags |
513 |
- useflag_re = _useflag_re_cache.get(cache_key) |
514 |
- if useflag_re is not None: |
515 |
- return useflag_re |
516 |
- |
517 |
- if eapi_attrs.dots_in_use_flags: |
518 |
- flag_re = r"[A-Za-z0-9][A-Za-z0-9+_@.-]*" |
519 |
- else: |
520 |
- flag_re = r"[A-Za-z0-9][A-Za-z0-9+_@-]*" |
521 |
- |
522 |
- useflag_re = re.compile(r"^" + flag_re + r"$") |
523 |
+ global _useflag_re |
524 |
+ if _useflag_re is not None: |
525 |
+ return _useflag_re |
526 |
|
527 |
- _useflag_re_cache[cache_key] = useflag_re |
528 |
- return useflag_re |
529 |
+ _useflag_re = re.compile(r"^[A-Za-z0-9][A-Za-z0-9+_@-]*$") |
530 |
+ return _useflag_re |
531 |
|
532 |
|
533 |
def cpvequal(cpv1, cpv2): |
534 |
@@ -3229,53 +3199,3 @@ def extract_affecting_use(mystr, atom, eapi=None): |
535 |
raise InvalidDependString(_("malformed syntax: '%s'") % mystr) |
536 |
|
537 |
return affecting_use |
538 |
- |
539 |
- |
540 |
-def extract_unpack_dependencies(src_uri, unpackers): |
541 |
- """ |
542 |
- Return unpack dependencies string for given SRC_URI string. |
543 |
- |
544 |
- @param src_uri: SRC_URI string |
545 |
- @type src_uri: String |
546 |
- @param unpackers: Dictionary mapping archive suffixes to dependency strings |
547 |
- @type unpackers: Dictionary |
548 |
- @rtype: String |
549 |
- @return: Dependency string specifying packages required to unpack archives. |
550 |
- """ |
551 |
- src_uri = src_uri.split() |
552 |
- |
553 |
- depend = [] |
554 |
- for i in range(len(src_uri)): |
555 |
- if src_uri[i][-1] == "?" or src_uri[i] in ("(", ")"): |
556 |
- depend.append(src_uri[i]) |
557 |
- elif (i + 1 < len(src_uri) and src_uri[i + 1] == "->") or src_uri[i] == "->": |
558 |
- continue |
559 |
- else: |
560 |
- for suffix in sorted(unpackers, key=lambda x: len(x), reverse=True): |
561 |
- suffix = suffix.lower() |
562 |
- if src_uri[i].lower().endswith(suffix): |
563 |
- depend.append(unpackers[suffix]) |
564 |
- break |
565 |
- |
566 |
- while True: |
567 |
- cleaned_depend = depend[:] |
568 |
- for i in range(len(cleaned_depend)): |
569 |
- if cleaned_depend[i] is None: |
570 |
- continue |
571 |
- elif cleaned_depend[i] == "(" and cleaned_depend[i + 1] == ")": |
572 |
- cleaned_depend[i] = None |
573 |
- cleaned_depend[i + 1] = None |
574 |
- elif ( |
575 |
- cleaned_depend[i][-1] == "?" |
576 |
- and cleaned_depend[i + 1] == "(" |
577 |
- and cleaned_depend[i + 2] == ")" |
578 |
- ): |
579 |
- cleaned_depend[i] = None |
580 |
- cleaned_depend[i + 1] = None |
581 |
- cleaned_depend[i + 2] = None |
582 |
- if depend == cleaned_depend: |
583 |
- break |
584 |
- else: |
585 |
- depend = [x for x in cleaned_depend if x is not None] |
586 |
- |
587 |
- return " ".join(depend) |
588 |
|
589 |
diff --git a/lib/portage/eapi.py b/lib/portage/eapi.py |
590 |
index 2987c54da..e3c951453 100644 |
591 |
--- a/lib/portage/eapi.py |
592 |
+++ b/lib/portage/eapi.py |
593 |
@@ -77,10 +77,6 @@ def eapi_exports_ECLASSDIR(eapi: str) -> bool: |
594 |
return _get_eapi_attrs(eapi).exports_ECLASSDIR |
595 |
|
596 |
|
597 |
-def eapi_exports_REPOSITORY(eapi: str) -> bool: |
598 |
- return False |
599 |
- |
600 |
- |
601 |
def eapi_has_pkg_pretend(eapi: str) -> bool: |
602 |
return eapi not in ("0", "1", "2", "3") |
603 |
|
604 |
@@ -113,14 +109,6 @@ def eapi_has_repo_deps(eapi: str) -> bool: |
605 |
return _get_eapi_attrs(eapi).repo_deps |
606 |
|
607 |
|
608 |
-def eapi_allows_dots_in_PN(eapi: str) -> bool: |
609 |
- return _get_eapi_attrs(eapi).dots_in_PN |
610 |
- |
611 |
- |
612 |
-def eapi_allows_dots_in_use_flags(eapi: str) -> bool: |
613 |
- return _get_eapi_attrs(eapi).dots_in_use_flags |
614 |
- |
615 |
- |
616 |
def eapi_supports_stable_use_forcing_and_masking(eapi: str) -> bool: |
617 |
return eapi not in ("0", "1", "2", "3", "4", "4-slot-abi") |
618 |
|
619 |
@@ -129,14 +117,6 @@ def eapi_allows_directories_on_profile_level_and_repository_level(eapi: str) -> |
620 |
return eapi not in ("0", "1", "2", "3", "4", "4-slot-abi", "5", "6") |
621 |
|
622 |
|
623 |
-def eapi_has_use_aliases(eapi: str) -> bool: |
624 |
- return False |
625 |
- |
626 |
- |
627 |
-def eapi_has_automatic_unpack_dependencies(eapi: str) -> bool: |
628 |
- return False |
629 |
- |
630 |
- |
631 |
def eapi_allows_package_provided(eapi: str) -> bool: |
632 |
return _get_eapi_attrs(eapi).allows_package_provided |
633 |
|
634 |
@@ -171,8 +151,6 @@ _eapi_attrs = collections.namedtuple( |
635 |
"allows_package_provided", |
636 |
"bdepend", |
637 |
"broot", |
638 |
- "dots_in_PN", |
639 |
- "dots_in_use_flags", |
640 |
"exports_AA", |
641 |
"exports_EBUILD_PHASE_FUNC", |
642 |
"exports_ECLASSDIR", |
643 |
@@ -247,8 +225,6 @@ def _get_eapi_attrs(eapi_str: Optional[str]) -> _eapi_attrs: |
644 |
allows_package_provided=True, |
645 |
bdepend=False, |
646 |
broot=True, |
647 |
- dots_in_PN=True, |
648 |
- dots_in_use_flags=True, |
649 |
empty_groups_always_true=False, |
650 |
exports_AA=False, |
651 |
exports_EBUILD_PHASE_FUNC=True, |
652 |
@@ -282,8 +258,6 @@ def _get_eapi_attrs(eapi_str: Optional[str]) -> _eapi_attrs: |
653 |
allows_package_provided=eapi <= Eapi("6"), |
654 |
bdepend=eapi >= Eapi("7"), |
655 |
broot=eapi >= Eapi("7"), |
656 |
- dots_in_PN=False, |
657 |
- dots_in_use_flags=False, |
658 |
empty_groups_always_true=eapi <= Eapi("6"), |
659 |
exports_AA=eapi <= Eapi("3"), |
660 |
exports_EBUILD_PHASE_FUNC=eapi >= Eapi("5"), |
661 |
|
662 |
diff --git a/lib/portage/package/ebuild/_config/UseManager.py b/lib/portage/package/ebuild/_config/UseManager.py |
663 |
index a0fb0254a..ea5ba1b42 100644 |
664 |
--- a/lib/portage/package/ebuild/_config/UseManager.py |
665 |
+++ b/lib/portage/package/ebuild/_config/UseManager.py |
666 |
@@ -15,7 +15,6 @@ from portage.dep import ( |
667 |
_repo_separator, |
668 |
) |
669 |
from portage.eapi import ( |
670 |
- eapi_has_use_aliases, |
671 |
eapi_supports_stable_use_forcing_and_masking, |
672 |
) |
673 |
from portage.exception import InvalidAtom |
674 |
@@ -651,7 +650,7 @@ class UseManager: |
675 |
return frozenset(stack_lists(useforce, incremental=True)) |
676 |
|
677 |
def getUseAliases(self, pkg): |
678 |
- if hasattr(pkg, "eapi") and not eapi_has_use_aliases(pkg.eapi): |
679 |
+ if hasattr(pkg, "eapi"): |
680 |
return {} |
681 |
|
682 |
cp = getattr(pkg, "cp", None) |
683 |
|
684 |
diff --git a/lib/portage/package/ebuild/_config/unpack_dependencies.py b/lib/portage/package/ebuild/_config/unpack_dependencies.py |
685 |
deleted file mode 100644 |
686 |
index 58b2fb16e..000000000 |
687 |
--- a/lib/portage/package/ebuild/_config/unpack_dependencies.py |
688 |
+++ /dev/null |
689 |
@@ -1,55 +0,0 @@ |
690 |
-# Copyright 2012 Gentoo Foundation |
691 |
-# Distributed under the terms of the GNU General Public License v2 |
692 |
- |
693 |
-from portage import os, _supported_eapis |
694 |
-from portage.dep import use_reduce |
695 |
-from portage.eapi import eapi_has_automatic_unpack_dependencies |
696 |
-from portage.exception import InvalidDependString |
697 |
-from portage.localization import _ |
698 |
-from portage.util import grabfile, writemsg |
699 |
- |
700 |
- |
701 |
-def load_unpack_dependencies_configuration(repositories): |
702 |
- repo_dict = {} |
703 |
- for repo in repositories.repos_with_profiles(): |
704 |
- for eapi in _supported_eapis: |
705 |
- if eapi_has_automatic_unpack_dependencies(eapi): |
706 |
- file_name = os.path.join( |
707 |
- repo.location, "profiles", "unpack_dependencies", eapi |
708 |
- ) |
709 |
- lines = grabfile(file_name, recursive=True) |
710 |
- for line in lines: |
711 |
- elements = line.split() |
712 |
- suffix = elements[0].lower() |
713 |
- if len(elements) == 1: |
714 |
- writemsg( |
715 |
- _( |
716 |
- "--- Missing unpack dependencies for '%s' suffix in '%s'\n" |
717 |
- ) |
718 |
- % (suffix, file_name) |
719 |
- ) |
720 |
- depend = " ".join(elements[1:]) |
721 |
- try: |
722 |
- use_reduce(depend, eapi=eapi) |
723 |
- except InvalidDependString as e: |
724 |
- writemsg( |
725 |
- _( |
726 |
- "--- Invalid unpack dependencies for '%s' suffix in '%s': '%s'\n" |
727 |
- % (suffix, file_name, e) |
728 |
- ) |
729 |
- ) |
730 |
- else: |
731 |
- repo_dict.setdefault(repo.name, {}).setdefault(eapi, {})[ |
732 |
- suffix |
733 |
- ] = depend |
734 |
- |
735 |
- ret = {} |
736 |
- for repo in repositories.repos_with_profiles(): |
737 |
- for repo_name in [x.name for x in repo.masters] + [repo.name]: |
738 |
- for eapi in repo_dict.get(repo_name, {}): |
739 |
- for suffix, depend in ( |
740 |
- repo_dict.get(repo_name, {}).get(eapi, {}).items() |
741 |
- ): |
742 |
- ret.setdefault(repo.name, {}).setdefault(eapi, {})[suffix] = depend |
743 |
- |
744 |
- return ret |
745 |
|
746 |
diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py |
747 |
index 99fd2c31e..5d9d5ce48 100644 |
748 |
--- a/lib/portage/package/ebuild/config.py |
749 |
+++ b/lib/portage/package/ebuild/config.py |
750 |
@@ -105,9 +105,6 @@ from portage.package.ebuild._config.helper import ( |
751 |
ordered_by_atom_specificity, |
752 |
prune_incremental, |
753 |
) |
754 |
-from portage.package.ebuild._config.unpack_dependencies import ( |
755 |
- load_unpack_dependencies_configuration, |
756 |
-) |
757 |
|
758 |
|
759 |
_feature_flags_cache = {} |
760 |
@@ -335,7 +332,6 @@ class config: |
761 |
self.profiles = clone.profiles |
762 |
self.packages = clone.packages |
763 |
self.repositories = clone.repositories |
764 |
- self.unpack_dependencies = clone.unpack_dependencies |
765 |
self._default_features_use = clone._default_features_use |
766 |
self._iuse_effective = clone._iuse_effective |
767 |
self._iuse_implicit_match = clone._iuse_implicit_match |
768 |
@@ -730,10 +726,6 @@ class config: |
769 |
x = Atom(x.lstrip("*")) |
770 |
self.prevmaskdict.setdefault(x.cp, []).append(x) |
771 |
|
772 |
- self.unpack_dependencies = load_unpack_dependencies_configuration( |
773 |
- self.repositories |
774 |
- ) |
775 |
- |
776 |
mygcfg = {} |
777 |
if profiles_complex: |
778 |
mygcfg_dlists = [] |
779 |
|
780 |
diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py |
781 |
index eb719b1ea..2251cdb8d 100644 |
782 |
--- a/lib/portage/package/ebuild/doebuild.py |
783 |
+++ b/lib/portage/package/ebuild/doebuild.py |
784 |
@@ -81,7 +81,6 @@ from portage.eapi import ( |
785 |
eapi_exports_KV, |
786 |
eapi_exports_merge_type, |
787 |
eapi_exports_replace_vars, |
788 |
- eapi_exports_REPOSITORY, |
789 |
eapi_has_required_use, |
790 |
eapi_has_src_prepare_and_src_configure, |
791 |
eapi_has_pkg_pretend, |
792 |
@@ -539,14 +538,6 @@ def doebuild_environment( |
793 |
if not eapi_is_supported(eapi): |
794 |
raise UnsupportedAPIException(mycpv, eapi) |
795 |
|
796 |
- if ( |
797 |
- eapi_exports_REPOSITORY(eapi) |
798 |
- and "PORTAGE_REPO_NAME" in mysettings.configdict["pkg"] |
799 |
- ): |
800 |
- mysettings.configdict["pkg"]["REPOSITORY"] = mysettings.configdict["pkg"][ |
801 |
- "PORTAGE_REPO_NAME" |
802 |
- ] |
803 |
- |
804 |
if mydo != "depend": |
805 |
if hasattr(mydbapi, "getFetchMap") and ( |
806 |
"A" not in mysettings.configdict["pkg"] |
807 |
|
808 |
diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py |
809 |
index 6805ca601..7852d0aaf 100644 |
810 |
--- a/lib/portage/tests/resolver/ResolverPlayground.py |
811 |
+++ b/lib/portage/tests/resolver/ResolverPlayground.py |
812 |
@@ -69,7 +69,6 @@ class ResolverPlayground: |
813 |
"package.use.stable.force", |
814 |
"package.use.stable.mask", |
815 |
"soname.provided", |
816 |
- "unpack_dependencies", |
817 |
"use.aliases", |
818 |
"use.force", |
819 |
"use.mask", |
820 |
|
821 |
diff --git a/lib/portage/versions.py b/lib/portage/versions.py |
822 |
index 086ada555..3d8694a0e 100644 |
823 |
--- a/lib/portage/versions.py |
824 |
+++ b/lib/portage/versions.py |
825 |
@@ -47,48 +47,17 @@ _cat = r"[\w+][\w+.-]*" |
826 |
# 2.1.2 A package name may contain any of the characters [A-Za-z0-9+_-]. |
827 |
# It must not begin with a hyphen, |
828 |
# and must not end in a hyphen followed by one or more digits. |
829 |
-_pkg = { |
830 |
- "dots_disallowed_in_PN": r"[\w+][\w+-]*?", |
831 |
- "dots_allowed_in_PN": r"[\w+][\w+.-]*?", |
832 |
-} |
833 |
+_pkg = r"[\w+][\w+-]*?" |
834 |
|
835 |
_v = r"(\d+)((\.\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\d*)*)" |
836 |
_rev = r"\d+" |
837 |
_vr = _v + "(-r(" + _rev + "))?" |
838 |
|
839 |
-_cp = { |
840 |
- "dots_disallowed_in_PN": "(" |
841 |
- + _cat |
842 |
- + "/" |
843 |
- + _pkg["dots_disallowed_in_PN"] |
844 |
- + "(-" |
845 |
- + _vr |
846 |
- + ")?)", |
847 |
- "dots_allowed_in_PN": "(" |
848 |
- + _cat |
849 |
- + "/" |
850 |
- + _pkg["dots_allowed_in_PN"] |
851 |
- + "(-" |
852 |
- + _vr |
853 |
- + ")?)", |
854 |
-} |
855 |
-_cpv = { |
856 |
- "dots_disallowed_in_PN": "(" + _cp["dots_disallowed_in_PN"] + "-" + _vr + ")", |
857 |
- "dots_allowed_in_PN": "(" + _cp["dots_allowed_in_PN"] + "-" + _vr + ")", |
858 |
-} |
859 |
-_pv = { |
860 |
- "dots_disallowed_in_PN": "(?P<pn>" |
861 |
- + _pkg["dots_disallowed_in_PN"] |
862 |
- + "(?P<pn_inval>-" |
863 |
- + _vr |
864 |
- + ")?)" |
865 |
- + "-(?P<ver>" |
866 |
- + _v |
867 |
- + ")(-r(?P<rev>" |
868 |
- + _rev |
869 |
- + "))?", |
870 |
- "dots_allowed_in_PN": "(?P<pn>" |
871 |
- + _pkg["dots_allowed_in_PN"] |
872 |
+_cp = "(" + _cat + "/" + _pkg + "(-" + _vr + ")?)" |
873 |
+_cpv = "(" + _cp + "-" + _vr + ")" |
874 |
+_pv = ( |
875 |
+ "(?P<pn>" |
876 |
+ + _pkg |
877 |
+ "(?P<pn_inval>-" |
878 |
+ _vr |
879 |
+ ")?)" |
880 |
@@ -96,8 +65,8 @@ _pv = { |
881 |
+ _v |
882 |
+ ")(-r(?P<rev>" |
883 |
+ _rev |
884 |
- + "))?", |
885 |
-} |
886 |
+ + "))?" |
887 |
+) |
888 |
|
889 |
ver_regexp = re.compile("^" + _vr + "$") |
890 |
suffix_regexp = re.compile("^(alpha|beta|rc|pre|p)(\\d*)$") |
891 |
@@ -124,24 +93,17 @@ def _get_slot_re(eapi_attrs): |
892 |
return slot_re |
893 |
|
894 |
|
895 |
-_pv_re_cache = {} |
896 |
+_pv_re = None |
897 |
|
898 |
|
899 |
def _get_pv_re(eapi_attrs): |
900 |
- cache_key = eapi_attrs.dots_in_PN |
901 |
- pv_re = _pv_re_cache.get(cache_key) |
902 |
- if pv_re is not None: |
903 |
- return pv_re |
904 |
- |
905 |
- if eapi_attrs.dots_in_PN: |
906 |
- pv_re = _pv["dots_allowed_in_PN"] |
907 |
- else: |
908 |
- pv_re = _pv["dots_disallowed_in_PN"] |
909 |
+ global _pv_re |
910 |
+ if _pv_re is not None: |
911 |
+ return _pv_re |
912 |
|
913 |
- pv_re = re.compile(r"^" + pv_re + r"$", re.VERBOSE | re.UNICODE) |
914 |
+ _pv_re = re.compile(r"^" + _pv + r"$", re.VERBOSE | re.UNICODE) |
915 |
|
916 |
- _pv_re_cache[cache_key] = pv_re |
917 |
- return pv_re |
918 |
+ return _pv_re |
919 |
|
920 |
|
921 |
def ververify(myver, silent=1): |