1 |
commit: 8621aa9b29e74dabdb426363a96d12ec2e036a15 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Mar 26 16:28:36 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 28 05:49:03 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8621aa9b |
7 |
|
8 |
Disallow package.provided in EAPI 7 |
9 |
|
10 |
Bug: https://bugs.gentoo.org/568884 |
11 |
Closes: https://github.com/mgorny/portage/issues/12 |
12 |
|
13 |
pym/portage/eapi.py | 4 ++++ |
14 |
pym/portage/package/ebuild/config.py | 22 ++++++++++++++++------ |
15 |
2 files changed, 20 insertions(+), 6 deletions(-) |
16 |
|
17 |
diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py |
18 |
index 5f0017b65..d91edcce4 100644 |
19 |
--- a/pym/portage/eapi.py |
20 |
+++ b/pym/portage/eapi.py |
21 |
@@ -104,6 +104,10 @@ def eapi_has_automatic_unpack_dependencies(eapi): |
22 |
def eapi_has_hdepend(eapi): |
23 |
return eapi in ("5-hdepend",) |
24 |
|
25 |
+def eapi_allows_package_provided(eapi): |
26 |
+ return eapi in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi", |
27 |
+ "5", "5-progress", "6") |
28 |
+ |
29 |
def eapi_has_bdepend(eapi): |
30 |
return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi", |
31 |
"5", "5-progress", "6") |
32 |
|
33 |
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py |
34 |
index 9d2b34a53..ef9ec3e88 100644 |
35 |
--- a/pym/portage/package/ebuild/config.py |
36 |
+++ b/pym/portage/package/ebuild/config.py |
37 |
@@ -38,8 +38,9 @@ from portage.const import CACHE_PATH, \ |
38 |
from portage.dbapi import dbapi |
39 |
from portage.dbapi.porttree import portdbapi |
40 |
from portage.dep import Atom, isvalidatom, match_from_list, use_reduce, _repo_separator, _slot_separator |
41 |
-from portage.eapi import eapi_exports_AA, eapi_exports_merge_type, \ |
42 |
- eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs |
43 |
+from portage.eapi import (eapi_exports_AA, eapi_exports_merge_type, |
44 |
+ eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs, |
45 |
+ eapi_allows_package_provided) |
46 |
from portage.env.loaders import KeyValuePairFileLoader |
47 |
from portage.exception import InvalidDependString, IsADirectory, \ |
48 |
PortageException |
49 |
@@ -800,10 +801,19 @@ class config(object): |
50 |
archlist = sorted(stack_lists(archlist, incremental=1)) |
51 |
self.configdict["conf"]["PORTAGE_ARCHLIST"] = " ".join(archlist) |
52 |
|
53 |
- pkgprovidedlines = [grabfile( |
54 |
- os.path.join(x.location, "package.provided"), |
55 |
- recursive=x.portage1_directories) |
56 |
- for x in profiles_complex] |
57 |
+ pkgprovidedlines = [] |
58 |
+ for x in profiles_complex: |
59 |
+ provpath = os.path.join(x.location, "package.provided") |
60 |
+ if os.path.exists(provpath): |
61 |
+ if x.eapi is None or eapi_allows_package_provided(x.eapi): |
62 |
+ pkgprovidedlines.append(grabfile(provpath, |
63 |
+ recursive=x.portage1_directories)) |
64 |
+ else: |
65 |
+ # TODO: bail out? |
66 |
+ writemsg((_("!!! package.provided not allowed in EAPI %s: ") |
67 |
+ %x.eapi)+x.location+"\n", |
68 |
+ noiselevel=-1) |
69 |
+ |
70 |
pkgprovidedlines = stack_lists(pkgprovidedlines, incremental=1) |
71 |
has_invalid_data = False |
72 |
for x in range(len(pkgprovidedlines)-1, -1, -1): |