Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/modules/scan/keywords/, ...
Date: Thu, 28 Apr 2016 15:05:50
Message-Id: 1461855042.c65d9bc746b4c6774eb71332ab851ec3dc6f3675.dolsen@gentoo
1 commit: c65d9bc746b4c6774eb71332ab851ec3dc6f3675
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 28 05:11:57 2016 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 28 14:50:42 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c65d9bc7
7
8 repoman: Move the LiveEclasses.is_live() to the Ebuild class
9
10 This removes another dynaic_data variable.
11 It also belongs with the ebuild eclass as a primary source for that type of data.
12
13 pym/repoman/modules/scan/ebuild/ebuild.py | 9 +++++++++
14 pym/repoman/modules/scan/eclasses/__init__.py | 1 -
15 pym/repoman/modules/scan/eclasses/live.py | 22 +++-------------------
16 pym/repoman/modules/scan/keywords/__init__.py | 1 -
17 pym/repoman/modules/scan/keywords/keywords.py | 8 +++-----
18 pym/repoman/modules/scan/metadata/__init__.py | 1 -
19 .../modules/scan/metadata/ebuild_metadata.py | 3 +--
20 7 files changed, 16 insertions(+), 29 deletions(-)
21
22 diff --git a/pym/repoman/modules/scan/ebuild/ebuild.py b/pym/repoman/modules/scan/ebuild/ebuild.py
23 index c247a7f..0277aa9 100644
24 --- a/pym/repoman/modules/scan/ebuild/ebuild.py
25 +++ b/pym/repoman/modules/scan/ebuild/ebuild.py
26 @@ -13,6 +13,7 @@ from repoman.qa_data import no_exec, allvars
27 # import our initialized portage instance
28 from repoman._portage import portage
29 from portage import os
30 +from portage.const import LIVE_ECLASSES
31
32 pv_toolong_re = re.compile(r'[0-9]{19,}')
33
34 @@ -220,6 +221,14 @@ class Ebuild(ScanBase):
35 return self.continue_
36
37 @property
38 + def is_live(self):
39 + '''Test if the ebuild inherits a live eclass
40 +
41 + @returns: boolean
42 + '''
43 + return set(LIVE_ECLASSES.intersection(self.inherited))
44 +
45 + @property
46 def runInPkgs(self):
47 '''Package level scans'''
48 return (True, [self.check_isebuild])
49
50 diff --git a/pym/repoman/modules/scan/eclasses/__init__.py b/pym/repoman/modules/scan/eclasses/__init__.py
51 index 63bb86f..78d46e4 100644
52 --- a/pym/repoman/modules/scan/eclasses/__init__.py
53 +++ b/pym/repoman/modules/scan/eclasses/__init__.py
54 @@ -22,7 +22,6 @@ module_spec = {
55 ],
56 'func_kwargs': {
57 'ebuild': (None, None),
58 - 'live_ebuild': ('Future', 'UNSET'),
59 'pkg': (None, None),
60 'xpkg': (None, None),
61 'y_ebuild': (None, None),
62
63 diff --git a/pym/repoman/modules/scan/eclasses/live.py b/pym/repoman/modules/scan/eclasses/live.py
64 index 842cbab..1ce33c0 100644
65 --- a/pym/repoman/modules/scan/eclasses/live.py
66 +++ b/pym/repoman/modules/scan/eclasses/live.py
67 @@ -6,8 +6,6 @@ Performs Live eclass checks
68 from repoman._portage import portage
69 from repoman.modules.scan.scanbase import ScanBase
70
71 -from portage.const import LIVE_ECLASSES
72 -
73
74 class LiveEclassChecks(ScanBase):
75 '''Performs checks for the usage of Live eclasses in ebuilds'''
76 @@ -20,27 +18,14 @@ class LiveEclassChecks(ScanBase):
77 self.pmaskdict = kwargs.get('repo_metadata')['pmaskdict']
78 self.repo_settings = kwargs.get('repo_settings')
79
80 - def is_live(self, **kwargs):
81 - '''Test if the ebuild inherits a live eclass
82 -
83 - @returns: dictionary, including {live_ebuild}
84 - '''
85 - ebuild = kwargs.get('ebuild').get()
86 - # update the dynamic data
87 - dyn_live = kwargs.get('live_ebuild')
88 - dyn_live.set(LIVE_ECLASSES.intersection(ebuild.inherited))
89 - return False
90 -
91 def check(self, **kwargs):
92 '''Ebuilds that inherit a "Live" eclass (darcs, subversion, git, cvs,
93 etc..) should not be allowed to be marked stable
94
95 @param pkg: Package in which we check (object).
96 - @param package: Package in which we check (string).
97 + @param xpkg: Package in which we check (string).
98 @param ebuild: Ebuild which we check (object).
99 @param y_ebuild: Ebuild which we check (string).
100 - @param keywords: The keywords of the ebuild.
101 - @param global_pmaskdict: A global dictionary of all the masks.
102 @returns: dictionary
103 '''
104 pkg = kwargs.get("pkg").result()
105 @@ -48,9 +33,8 @@ class LiveEclassChecks(ScanBase):
106 ebuild = kwargs.get('ebuild').get()
107 y_ebuild = kwargs.get('y_ebuild')
108 keywords = ebuild.keywords
109 - live_ebuild = kwargs.get('live_ebuild').get()
110
111 - if not live_ebuild and self.repo_settings.repo_config.name == "gentoo":
112 + if not ebuild.is_live and self.repo_settings.repo_config.name == "gentoo":
113 return False
114
115 is_stable = lambda kw: not kw.startswith("~") and not kw.startswith("-")
116 @@ -79,4 +63,4 @@ class LiveEclassChecks(ScanBase):
117 @property
118 def runInEbuilds(self):
119 '''Ebuild level scans'''
120 - return (True, [self.is_live, self.check])
121 + return (True, [self.check])
122
123 diff --git a/pym/repoman/modules/scan/keywords/__init__.py b/pym/repoman/modules/scan/keywords/__init__.py
124 index 1c424ca..2223927 100644
125 --- a/pym/repoman/modules/scan/keywords/__init__.py
126 +++ b/pym/repoman/modules/scan/keywords/__init__.py
127 @@ -23,7 +23,6 @@ module_spec = {
128 'func_kwargs': {
129 'changed': (None, None),
130 'ebuild': ('Future', 'UNSET'),
131 - 'live_ebuild': ('Future', 'UNSET'),
132 'pkg': ('Future', 'UNSET'),
133 'xpkg': None,
134 'y_ebuild': (None, None),
135
136 diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
137 index af94c6f..c3c8058 100644
138 --- a/pym/repoman/modules/scan/keywords/keywords.py
139 +++ b/pym/repoman/modules/scan/keywords/keywords.py
140 @@ -37,7 +37,6 @@ class KeywordChecks(ScanBase):
141 @param y_ebuild: Ebuild which we check (string).
142 @param ebuild_archs: Just the architectures (no prefixes) of the ebuild.
143 @param changed: Changes instance
144 - @param live_ebuild: A boolean that determines if this is a live ebuild.
145 @returns: dictionary
146 '''
147 pkg = kwargs.get('pkg').get()
148 @@ -45,12 +44,11 @@ class KeywordChecks(ScanBase):
149 ebuild = kwargs.get('ebuild').get()
150 y_ebuild = kwargs.get('y_ebuild')
151 changed = kwargs.get('changed')
152 - live_ebuild = kwargs.get('live_ebuild').get()
153 if not self.options.straight_to_stable:
154 self._checkAddedWithStableKeywords(
155 xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
156
157 - self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
158 + self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs)
159
160 self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
161
162 @@ -77,11 +75,11 @@ class KeywordChecks(ScanBase):
163 (package, y_ebuild, " ".join(stable_keywords)))
164
165 def _checkForDroppedKeywords(
166 - self, pkg, ebuild, ebuild_archs, live_ebuild):
167 + self, pkg, ebuild, ebuild_archs):
168 previous_keywords = self.slot_keywords.get(pkg.slot)
169 if previous_keywords is None:
170 self.slot_keywords[pkg.slot] = set()
171 - elif ebuild_archs and "*" not in ebuild_archs and not live_ebuild:
172 + elif ebuild_archs and "*" not in ebuild_archs and not ebuild.is_live:
173 dropped_keywords = previous_keywords.difference(ebuild_archs)
174 if dropped_keywords:
175 self.qatracker.add_error(
176
177 diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
178 index b090d6b..b656d7a 100644
179 --- a/pym/repoman/modules/scan/metadata/__init__.py
180 +++ b/pym/repoman/modules/scan/metadata/__init__.py
181 @@ -45,7 +45,6 @@ module_spec = {
182 'func_kwargs': {
183 'catdir': (None, None),
184 'ebuild': (None, None),
185 - 'live_ebuild': (None, None),
186 'xpkg': (None, None),
187 'y_ebuild': (None, None),
188 },
189
190 diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
191 index e239b47..bbccedf 100644
192 --- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
193 +++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
194 @@ -35,13 +35,12 @@ class EbuildMetadata(ScanBase):
195
196 def missing(self, **kwargs):
197 ebuild = kwargs.get('ebuild').get()
198 - live_ebuild = kwargs.get('live_ebuild').get()
199 for pos, missing_var in enumerate(missingvars):
200 if not ebuild.metadata.get(missing_var):
201 if kwargs.get('catdir') == "virtual" and \
202 missing_var in ("HOMEPAGE", "LICENSE"):
203 continue
204 - if live_ebuild and missing_var == "KEYWORDS":
205 + if ebuild.is_live and missing_var == "KEYWORDS":
206 continue
207 myqakey = missingvars[pos] + ".missing"
208 self.qatracker.add_error(myqakey, '%s/%s.ebuild'