1 |
commit: 7f164c6fd1c47c254b1e1df101edb680492c0c12 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 24 04:43:11 2013 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 24 04:43:11 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7f164c6f |
7 |
|
8 |
repoman: check for deprecated EAPIs, bug #470670 |
9 |
|
10 |
This adds support for repo.eapi.banned (fatal) and repo.eapi.deprecated |
11 |
(warning) checks which are controlled by eapis-banned and |
12 |
eapis-deprecated settings in a repository's metadata/layout.conf. |
13 |
|
14 |
--- |
15 |
bin/repoman | 13 +++++++++++++ |
16 |
man/portage.5 | 8 +++++++- |
17 |
man/repoman.1 | 10 +++++++++- |
18 |
pym/portage/repository/config.py | 15 ++++++++++++++- |
19 |
4 files changed, 43 insertions(+), 3 deletions(-) |
20 |
|
21 |
diff --git a/bin/repoman b/bin/repoman |
22 |
index 20832ec..c4a5a22 100755 |
23 |
--- a/bin/repoman |
24 |
+++ b/bin/repoman |
25 |
@@ -380,6 +380,8 @@ qahelp = { |
26 |
"metadata.bad": "Bad metadata.xml files", |
27 |
"metadata.warning": "Warnings in metadata.xml files", |
28 |
"portage.internal": "The ebuild uses an internal Portage function or variable", |
29 |
+ "repo.eapi.banned": "The ebuild uses an EAPI which is banned by the repository's metadata/layout.conf settings", |
30 |
+ "repo.eapi.deprecated": "The ebuild uses an EAPI which is deprecated by the repository's metadata/layout.conf settings", |
31 |
"virtual.oldstyle": "The ebuild PROVIDEs an old-style virtual (see GLEP 37)", |
32 |
"virtual.suspect": "Ebuild contains a package that usually should be pulled via virtual/, not directly.", |
33 |
"usage.obsolete": "The ebuild makes use of an obsolete construct", |
34 |
@@ -424,6 +426,7 @@ qawarnings = set(( |
35 |
"wxwidgets.eclassnotused", |
36 |
"metadata.warning", |
37 |
"portage.internal", |
38 |
+"repo.eapi.deprecated", |
39 |
"usage.obsolete", |
40 |
"upstream.workaround", |
41 |
"LIVEVCS.stable", |
42 |
@@ -1815,6 +1818,16 @@ for x in effective_scanlist: |
43 |
inherited = pkg.inherited |
44 |
live_ebuild = live_eclasses.intersection(inherited) |
45 |
|
46 |
+ if repo_config.eapi_is_banned(eapi): |
47 |
+ stats["repo.eapi.banned"] += 1 |
48 |
+ fails["repo.eapi.banned"].append( |
49 |
+ "%s: %s" % (relative_path, eapi)) |
50 |
+ |
51 |
+ elif repo_config.eapi_is_deprecated(eapi): |
52 |
+ stats["repo.eapi.deprecated"] += 1 |
53 |
+ fails["repo.eapi.deprecated"].append( |
54 |
+ "%s: %s" % (relative_path, eapi)) |
55 |
+ |
56 |
for k, v in myaux.items(): |
57 |
if not isinstance(v, basestring): |
58 |
continue |
59 |
|
60 |
diff --git a/man/portage.5 b/man/portage.5 |
61 |
index 46a64f1..e462266 100644 |
62 |
--- a/man/portage.5 |
63 |
+++ b/man/portage.5 |
64 |
@@ -1,4 +1,4 @@ |
65 |
-.TH "PORTAGE" "5" "Nov 2012" "Portage VERSION" "Portage" |
66 |
+.TH "PORTAGE" "5" "May 2013" "Portage VERSION" "Portage" |
67 |
.SH NAME |
68 |
portage \- the heart of Gentoo |
69 |
.SH "DESCRIPTION" |
70 |
@@ -875,6 +875,12 @@ masters = gentoo java-overlay |
71 |
# indicate that this repo can be used as a substitute for foo-overlay |
72 |
aliases = foo-overlay |
73 |
|
74 |
+# indicate that ebuilds with the specified EAPIs are banned |
75 |
+eapis\-banned = 0 1 |
76 |
+ |
77 |
+# indicate that ebuilds with the specified EAPIs are deprecated |
78 |
+eapis\-deprecated = 2 3 |
79 |
+ |
80 |
# sign commits in this repo, which requires Git >=1.7.9, and |
81 |
# key configured by `git config user.signingkey key_id` |
82 |
sign\-commits = true |
83 |
|
84 |
diff --git a/man/repoman.1 b/man/repoman.1 |
85 |
index 912ba65..bf498d4 100644 |
86 |
--- a/man/repoman.1 |
87 |
+++ b/man/repoman.1 |
88 |
@@ -1,4 +1,4 @@ |
89 |
-.TH "REPOMAN" "1" "Oct 2012" "Portage VERSION" "Portage" |
90 |
+.TH "REPOMAN" "1" "May 2013" "Portage VERSION" "Portage" |
91 |
.SH NAME |
92 |
repoman \- Gentoo's program to enforce a minimal level of quality assurance in packages added to the portage tree |
93 |
.SH SYNOPSIS |
94 |
@@ -326,6 +326,14 @@ Missing metadata.xml files |
95 |
.B metadata.warning |
96 |
Warnings in metadata.xml files |
97 |
.TP |
98 |
+.B repo.eapi.banned |
99 |
+The ebuild uses an EAPI which is banned by the repository's |
100 |
+metadata/layout.conf settings. |
101 |
+.TP |
102 |
+.B repo.eapi.deprecated |
103 |
+The ebuild uses an EAPI which is deprecated by the repository's |
104 |
+metadata/layout.conf settings. |
105 |
+.TP |
106 |
.B portage.internal |
107 |
The ebuild uses an internal Portage function or variable |
108 |
.TP |
109 |
|
110 |
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py |
111 |
index 969fce4..da8c365 100644 |
112 |
--- a/pym/portage/repository/config.py |
113 |
+++ b/pym/portage/repository/config.py |
114 |
@@ -80,7 +80,8 @@ class RepoConfig(object): |
115 |
'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name', |
116 |
'name', 'portage1_profiles', 'portage1_profiles_compat', 'priority', |
117 |
'profile_formats', 'sign_commit', 'sign_manifest', 'sync', |
118 |
- 'thin_manifest', 'update_changelog', 'user_location') |
119 |
+ 'thin_manifest', 'update_changelog', 'user_location', |
120 |
+ '_eapis_banned', '_eapis_deprecated') |
121 |
|
122 |
def __init__(self, name, repo_opts): |
123 |
"""Build a RepoConfig with options in repo_opts |
124 |
@@ -198,6 +199,15 @@ class RepoConfig(object): |
125 |
self.portage1_profiles_compat = not eapi_allows_directories_on_profile_level_and_repository_level(eapi) and \ |
126 |
layout_data['profile-formats'] == ('portage-1-compat',) |
127 |
|
128 |
+ self._eapis_banned = frozenset(layout_data['eapis-banned']) |
129 |
+ self._eapis_deprecated = frozenset(layout_data['eapis-deprecated']) |
130 |
+ |
131 |
+ def eapi_is_banned(self, eapi): |
132 |
+ return eapi in self._eapis_banned |
133 |
+ |
134 |
+ def eapi_is_deprecated(self, eapi): |
135 |
+ return eapi in self._eapis_deprecated |
136 |
+ |
137 |
def iter_pregenerated_caches(self, auxdbkeys, readonly=True, force=False): |
138 |
""" |
139 |
Reads layout.conf cache-formats from left to right and yields cache |
140 |
@@ -745,6 +755,9 @@ def parse_layout_conf(repo_location, repo_name=None): |
141 |
data['allow-provide-virtual'] = \ |
142 |
layout_data.get('allow-provide-virtuals', 'false').lower() == 'true' |
143 |
|
144 |
+ data['eapis-banned'] = tuple(layout_data.get('eapis-banned', '').split()) |
145 |
+ data['eapis-deprecated'] = tuple(layout_data.get('eapis-deprecated', '').split()) |
146 |
+ |
147 |
data['sign-commit'] = layout_data.get('sign-commits', 'false').lower() \ |
148 |
== 'true' |