1 |
commit: 93caaa92a33f3b199e53077d7066d75fb27ac0e3 |
2 |
Author: Tom Wijsman <tomwij <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jun 4 13:40:35 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Wed Oct 1 23:45:34 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=93caaa92 |
7 |
|
8 |
repoman/main.py: Split "Live" checks to checks/ebuilds/eclass/live.py |
9 |
|
10 |
--- |
11 |
pym/repoman/checks/ebuilds/eclasses/live.py | 39 +++++++++++++++++++++++++ |
12 |
pym/repoman/main.py | 45 ++++++++++++----------------- |
13 |
2 files changed, 57 insertions(+), 27 deletions(-) |
14 |
|
15 |
diff --git a/pym/repoman/checks/ebuilds/eclasses/live.py b/pym/repoman/checks/ebuilds/eclasses/live.py |
16 |
new file mode 100644 |
17 |
index 0000000..20c573e |
18 |
--- /dev/null |
19 |
+++ b/pym/repoman/checks/ebuilds/eclasses/live.py |
20 |
@@ -0,0 +1,39 @@ |
21 |
+ |
22 |
+'''live.py |
23 |
+Performs Live eclass checks |
24 |
+''' |
25 |
+ |
26 |
+from repoman.repos import has_global_mask |
27 |
+ |
28 |
+ |
29 |
+class LiveEclassChecks(object): |
30 |
+ '''Performs checks for the usage of Live eclasses in ebuilds''' |
31 |
+ |
32 |
+ def __init__(self, qatracker): |
33 |
+ ''' |
34 |
+ @param qatracker: QATracker instance |
35 |
+ ''' |
36 |
+ self.qatracker = qatracker |
37 |
+ |
38 |
+ def check(self, pkg, package, ebuild, y_ebuild, keywords, global_pmaskdict): |
39 |
+ '''Ebuilds that inherit a "Live" eclass (darcs, subversion, git, cvs, |
40 |
+ etc..) should not be allowed to be marked stable |
41 |
+ |
42 |
+ @param pkg: Package in which we check (object). |
43 |
+ @param package: Package in which we check (string). |
44 |
+ @param ebuild: Ebuild which we check (object). |
45 |
+ @param y_ebuild: Ebuild which we check (string). |
46 |
+ @param keywords: The keywords of the ebuild. |
47 |
+ @param global_pmaskdict: A global dictionary of all the masks. |
48 |
+ ''' |
49 |
+ is_stable = lambda kw: not kw.startswith("~") and not kw.startswith("-") |
50 |
+ bad_stable_keywords = list(filter(is_stable, keywords)) |
51 |
+ |
52 |
+ if bad_stable_keywords: |
53 |
+ self.qatracker.add_error( |
54 |
+ "LIVEVCS.stable", "%s/%s.ebuild with stable keywords:%s " % ( |
55 |
+ package, y_ebuild, bad_stable_keywords)) |
56 |
+ |
57 |
+ good_keywords_exist = len(bad_stable_keywords) < len(keywords) |
58 |
+ if good_keywords_exist and not has_global_mask(pkg, global_pmaskdict): |
59 |
+ self.qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path) |
60 |
\ No newline at end of file |
61 |
|
62 |
diff --git a/pym/repoman/main.py b/pym/repoman/main.py |
63 |
index 05d9a14..2cd89b2 100755 |
64 |
--- a/pym/repoman/main.py |
65 |
+++ b/pym/repoman/main.py |
66 |
@@ -48,6 +48,7 @@ from portage.package.ebuild.digestgen import digestgen |
67 |
from repoman.argparser import parse_args |
68 |
from repoman.checks.directories.files import FileChecks |
69 |
from repoman.checks.ebuilds.checks import run_checks, checks_init |
70 |
+from repoman.checks.ebuilds.eclasses.live import LiveEclassChecks |
71 |
from repoman.checks.ebuilds.fetches import FetchChecks |
72 |
from repoman.checks.ebuilds.keywords import KeywordChecks |
73 |
from repoman.checks.ebuilds.isebuild import IsEbuild |
74 |
@@ -60,16 +61,17 @@ from repoman.ebuild import Ebuild |
75 |
from repoman.errors import err |
76 |
from repoman.modules.commit import repochecks |
77 |
from repoman.profile import check_profiles, dev_keywords, setup_profile |
78 |
-from repoman.qa_data import (format_qa_output, format_qa_output_column, qahelp, |
79 |
+from repoman.qa_data import ( |
80 |
+ format_qa_output, format_qa_output_column, qahelp, |
81 |
qawarnings, qacats, max_desc_len, missingvars, |
82 |
ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict) |
83 |
from repoman.qa_tracker import QATracker |
84 |
-from repoman.repos import has_global_mask, RepoSettings, repo_metadata |
85 |
+from repoman.repos import RepoSettings, repo_metadata |
86 |
from repoman.scan import Changes, scan |
87 |
from repoman._subprocess import repoman_popen, repoman_getstatusoutput |
88 |
from repoman import utilities |
89 |
-from repoman.vcs.vcs import (git_supports_gpg_sign, vcs_files_to_cps, |
90 |
- VCSSettings) |
91 |
+from repoman.vcs.vcs import ( |
92 |
+ git_supports_gpg_sign, vcs_files_to_cps, VCSSettings) |
93 |
from repoman.vcs.vcsstatus import VCSStatus |
94 |
|
95 |
|
96 |
@@ -271,18 +273,21 @@ if options.if_modified == "y": |
97 |
chain(changed.changed, changed.new, changed.removed), |
98 |
repolevel, reposplit, categories)) |
99 |
|
100 |
-####### initialize our checks classes here before the big xpkg loop |
101 |
+###################### |
102 |
+# initialize our checks classes here before the big xpkg loop |
103 |
manifester = Manifests(options, qatracker, repoman_settings) |
104 |
is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker) |
105 |
-filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb, |
106 |
- vcs_settings) |
107 |
+filescheck = FileChecks( |
108 |
+ qatracker, repoman_settings, repo_settings, portdb, vcs_settings) |
109 |
status_check = VCSStatus(vcs_settings, qatracker) |
110 |
-fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb, |
111 |
- vcs_settings) |
112 |
+fetchcheck = FetchChecks( |
113 |
+ qatracker, repoman_settings, repo_settings, portdb, vcs_settings) |
114 |
pkgmeta = PkgMetadata(options, qatracker, repoman_settings) |
115 |
thirdparty = ThirdPartyMirrors(repoman_settings, qatracker) |
116 |
use_flag_checks = USEFlagChecks(qatracker, uselist) |
117 |
keywordcheck = KeywordChecks(qatracker) |
118 |
+liveeclasscheck = LiveEclassChecks(qatracker) |
119 |
+###################### |
120 |
|
121 |
for xpkg in effective_scanlist: |
122 |
# ebuilds and digests added to cvs respectively. |
123 |
@@ -451,25 +456,11 @@ for xpkg in effective_scanlist: |
124 |
qatracker.add_error("KEYWORDS.stupid", |
125 |
xpkg + "/" + y_ebuild + ".ebuild") |
126 |
|
127 |
- """ |
128 |
- Ebuilds that inherit a "Live" eclass (darcs,subversion,git,cvs,etc..) should |
129 |
- not be allowed to be marked stable |
130 |
- """ |
131 |
if live_ebuild and repo_settings.repo_config.name == "gentoo": |
132 |
- bad_stable_keywords = [] |
133 |
- for keyword in keywords: |
134 |
- if not keyword.startswith("~") and \ |
135 |
- not keyword.startswith("-"): |
136 |
- bad_stable_keywords.append(keyword) |
137 |
- del keyword |
138 |
- if bad_stable_keywords: |
139 |
- qatracker.add_error("LIVEVCS.stable", |
140 |
- "%s/%s.ebuild with stable keywords:%s " % |
141 |
- (xpkg, y_ebuild, bad_stable_keywords)) |
142 |
- del bad_stable_keywords |
143 |
- |
144 |
- if keywords and not has_global_mask(pkg, global_pmaskdict): |
145 |
- qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path) |
146 |
+ ####################### |
147 |
+ liveeclasscheck.check( |
148 |
+ pkg, xpkg, ebuild, y_ebuild, keywords, global_pmaskdict) |
149 |
+ ####################### |
150 |
|
151 |
if options.ignore_arches: |
152 |
arches = [[ |