Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/repoman/modules/scan/arches/, pym/repoman/, pym/repoman/modules/scan/depend/
Date: Fri, 29 Apr 2016 17:24:58
Message-Id: 1461598133.80cfdec3df20d1a29d1e9eccc7f2ed666a72e1ea.dolsen@gentoo
1 commit: 80cfdec3df20d1a29d1e9eccc7f2ed666a72e1ea
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon Apr 25 03:57:03 2016 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Mon Apr 25 15:28:53 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=80cfdec3
7
8 ProfileDependsChecks: convert ArchChecks to function
9
10 pym/repoman/modules/scan/arches/__init__.py | 30 ----------
11 pym/repoman/modules/scan/arches/arches.py | 78 --------------------------
12 pym/repoman/modules/scan/depend/__init__.py | 1 -
13 pym/repoman/modules/scan/depend/_gen_arches.py | 57 +++++++++++++++++++
14 pym/repoman/modules/scan/depend/profile.py | 5 +-
15 pym/repoman/scanner.py | 2 +-
16 6 files changed, 61 insertions(+), 112 deletions(-)
17
18 diff --git a/pym/repoman/modules/scan/arches/__init__.py b/pym/repoman/modules/scan/arches/__init__.py
19 deleted file mode 100644
20 index d66be1e..0000000
21 --- a/pym/repoman/modules/scan/arches/__init__.py
22 +++ /dev/null
23 @@ -1,30 +0,0 @@
24 -# Copyright 2015-2016 Gentoo Foundation
25 -# Distributed under the terms of the GNU General Public License v2
26 -
27 -doc = """Arches plug-in module for repoman.
28 -Performs archs checks on ebuilds."""
29 -__doc__ = doc[:]
30 -
31 -
32 -module_spec = {
33 - 'name': 'arches',
34 - 'description': doc,
35 - 'provides':{
36 - 'archs-module': {
37 - 'name': "arches",
38 - 'sourcefile': "arches",
39 - 'class': "ArchChecks",
40 - 'description': doc,
41 - 'functions': ['check'],
42 - 'func_desc': {
43 - },
44 - 'mod_kwargs': ['options', 'repo_settings', 'profiles'
45 - ],
46 - 'func_kwargs': {
47 - 'arches': ('Future', 'set'),
48 - 'ebuild': (None, None),
49 - },
50 - },
51 - }
52 -}
53 -
54
55 diff --git a/pym/repoman/modules/scan/arches/arches.py b/pym/repoman/modules/scan/arches/arches.py
56 deleted file mode 100644
57 index b86848d..0000000
58 --- a/pym/repoman/modules/scan/arches/arches.py
59 +++ /dev/null
60 @@ -1,78 +0,0 @@
61 -# -*- coding:utf-8 -*-
62 -
63 -from repoman.modules.scan.scanbase import ScanBase
64 -
65 -
66 -class ArchChecks(ScanBase):
67 - '''Perform arch keyword checks'''
68 -
69 - def __init__(self, **kwargs):
70 - '''Class init
71 -
72 - @param options: the run time cli options
73 - @param repo_settings: repository settings instance
74 - @param profiles: dictionary
75 - '''
76 - self.options = kwargs.get('options')
77 - self.repo_settings = kwargs.get('repo_settings')
78 - self.profiles = kwargs.get('profiles')
79 -
80 - def check(self, **kwargs):
81 - '''Determines the arches for the ebuild following the profile rules
82 -
83 - @param ebuild: Ebuild which we check (object).
84 - @returns: dictionary, including arches set
85 - '''
86 - ebuild = kwargs.get('ebuild').get()
87 - if self.options.ignore_arches:
88 - arches = [[
89 - self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"],
90 - self.repo_settings.repoman_settings["ACCEPT_KEYWORDS"].split()]]
91 - else:
92 - arches = set()
93 - for keyword in ebuild.keywords:
94 - if keyword[0] == "-":
95 - continue
96 - elif keyword[0] == "~":
97 - arch = keyword[1:]
98 - if arch == "*":
99 - for expanded_arch in self.profiles:
100 - if expanded_arch == "**":
101 - continue
102 - arches.add(
103 - (keyword, expanded_arch, (
104 - expanded_arch, "~" + expanded_arch)))
105 - else:
106 - arches.add((keyword, arch, (arch, keyword)))
107 - else:
108 - # For ebuilds with stable keywords, check if the
109 - # dependencies are satisfiable for unstable
110 - # configurations, since use.stable.mask is not
111 - # applied for unstable configurations (see bug
112 - # 563546).
113 - if keyword == "*":
114 - for expanded_arch in self.profiles:
115 - if expanded_arch == "**":
116 - continue
117 - arches.add(
118 - (keyword, expanded_arch, (expanded_arch,)))
119 - arches.add(
120 - (keyword, expanded_arch,
121 - (expanded_arch, "~" + expanded_arch)))
122 - else:
123 - arches.add((keyword, keyword, (keyword,)))
124 - arches.add((keyword, keyword,
125 - (keyword, "~" + keyword)))
126 - if not arches:
127 - # Use an empty profile for checking dependencies of
128 - # packages that have empty KEYWORDS.
129 - arches.add(('**', '**', ('**',)))
130 - # update the dynamic data
131 - dyn_arches = kwargs.get('arches')
132 - dyn_arches.set(arches)
133 - return False
134 -
135 - @property
136 - def runInEbuilds(self):
137 - '''Ebuild level scans'''
138 - return (True, [self.check])
139
140 diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
141 index 27c803d..01bd116 100644
142 --- a/pym/repoman/modules/scan/depend/__init__.py
143 +++ b/pym/repoman/modules/scan/depend/__init__.py
144 @@ -41,7 +41,6 @@ module_spec = {
145 'repoman_incrementals', 'env', 'have', 'dev_keywords'
146 ],
147 'func_kwargs': {
148 - 'arches': (None, None),
149 'baddepsyntax': (None, None),
150 'ebuild': (None, None),
151 'pkg': (None, None),
152
153 diff --git a/pym/repoman/modules/scan/depend/_gen_arches.py b/pym/repoman/modules/scan/depend/_gen_arches.py
154 new file mode 100644
155 index 0000000..16b8dac
156 --- /dev/null
157 +++ b/pym/repoman/modules/scan/depend/_gen_arches.py
158 @@ -0,0 +1,57 @@
159 +# -*- coding:utf-8 -*-
160 +
161 +
162 +def _gen_arches(ebuild, options, repo_settings, profiles):
163 + '''Determines the arches for the ebuild following the profile rules
164 +
165 + @param ebuild: Ebuild which we check (object).
166 + @param profiles: dictionary
167 + @param options: cli options
168 + @param repo_settings: repository settings instance
169 + @returns: dictionary, including arches set
170 + '''
171 + if options.ignore_arches:
172 + arches = [[
173 + repo_settings.repoman_settings["ARCH"], repo_settings.repoman_settings["ARCH"],
174 + repo_settings.repoman_settings["ACCEPT_KEYWORDS"].split()]]
175 + else:
176 + arches = set()
177 + for keyword in ebuild.keywords:
178 + if keyword[0] == "-":
179 + continue
180 + elif keyword[0] == "~":
181 + arch = keyword[1:]
182 + if arch == "*":
183 + for expanded_arch in profiles:
184 + if expanded_arch == "**":
185 + continue
186 + arches.add(
187 + (keyword, expanded_arch, (
188 + expanded_arch, "~" + expanded_arch)))
189 + else:
190 + arches.add((keyword, arch, (arch, keyword)))
191 + else:
192 + # For ebuilds with stable keywords, check if the
193 + # dependencies are satisfiable for unstable
194 + # configurations, since use.stable.mask is not
195 + # applied for unstable configurations (see bug
196 + # 563546).
197 + if keyword == "*":
198 + for expanded_arch in profiles:
199 + if expanded_arch == "**":
200 + continue
201 + arches.add(
202 + (keyword, expanded_arch, (expanded_arch,)))
203 + arches.add(
204 + (keyword, expanded_arch,
205 + (expanded_arch, "~" + expanded_arch)))
206 + else:
207 + arches.add((keyword, keyword, (keyword,)))
208 + arches.add((keyword, keyword,
209 + (keyword, "~" + keyword)))
210 + if not arches:
211 + # Use an empty profile for checking dependencies of
212 + # packages that have empty KEYWORDS.
213 + arches.add(('**', '**', ('**',)))
214 +
215 + return arches
216
217 diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
218 index 8fc7721..0388374 100644
219 --- a/pym/repoman/modules/scan/depend/profile.py
220 +++ b/pym/repoman/modules/scan/depend/profile.py
221 @@ -9,6 +9,7 @@ from _emerge.Package import Package
222 # import our initialized portage instance
223 from repoman._portage import portage
224 from repoman.modules.scan.scanbase import ScanBase
225 +from repoman.modules.scan.depend._gen_arches import _gen_arches
226 from portage.dep import Atom
227
228
229 @@ -56,14 +57,14 @@ class ProfileDependsChecks(ScanBase):
230 @param unknown_pkgs: set of tuples (type, atom.unevaluated_atom)
231 @returns: dictionary
232 '''
233 - arches = kwargs.get('arches').get()
234 ebuild = kwargs.get('ebuild').get()
235 pkg = kwargs.get('pkg').get()
236 baddepsyntax = kwargs.get('baddepsyntax').get()
237 unknown_pkgs = kwargs.get('unknown_pkgs').get()
238
239 relevant_profiles = []
240 - for keyword, arch, groups in arches:
241 + for keyword, arch, groups in _gen_arches(ebuild, self.options,
242 + self.repo_settings, self.profiles):
243 if arch not in self.profiles:
244 # A missing profile will create an error further down
245 # during the KEYWORDS verification.
246
247 diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
248 index c9b76a4..74bb7e3 100644
249 --- a/pym/repoman/scanner.py
250 +++ b/pym/repoman/scanner.py
251 @@ -378,7 +378,7 @@ class Scanner(object):
252 ('thirdpartymirrors', 'ThirdPartyMirrors'),
253 ('description', 'DescriptionChecks'),
254 ('keywords', 'KeywordChecks'),
255 - ('arches', 'ArchChecks'), ('depend', 'DependChecks'),
256 + ('depend', 'DependChecks'),
257 ('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
258 ('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
259 ('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),