1 |
commit: 7104a90cb2d37d74540ea026884bed3b2f2f6932 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Mar 7 21:04:01 2016 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 8 02:54:48 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7104a90c |
7 |
|
8 |
repoman: Add docstrings to the final vcs and scan modules |
9 |
|
10 |
pym/repoman/modules/scan/arches/arches.py | 13 ++++ |
11 |
pym/repoman/modules/scan/depend/depend.py | 13 ++++ |
12 |
pym/repoman/modules/scan/depend/profile.py | 27 +++++++ |
13 |
pym/repoman/modules/scan/depend/unknown.py | 13 ++++ |
14 |
pym/repoman/modules/scan/directories/files.py | 1 + |
15 |
pym/repoman/modules/scan/directories/mtime.py | 8 ++ |
16 |
pym/repoman/modules/scan/eapi/eapi.py | 2 + |
17 |
pym/repoman/modules/scan/ebuild/ebuild.py | 22 +++++- |
18 |
pym/repoman/modules/scan/ebuild/isebuild.py | 3 +- |
19 |
pym/repoman/modules/scan/ebuild/multicheck.py | 16 ++++ |
20 |
pym/repoman/modules/scan/eclasses/live.py | 6 ++ |
21 |
pym/repoman/modules/scan/eclasses/ruby.py | 8 +- |
22 |
pym/repoman/modules/scan/fetch/fetches.py | 1 + |
23 |
pym/repoman/modules/scan/keywords/keywords.py | 1 + |
24 |
pym/repoman/modules/scan/manifest/manifests.py | 25 ++++++ |
25 |
pym/repoman/modules/scan/metadata/pkgmetadata.py | 1 + |
26 |
.../modules/scan/mirrors/thirdpartymirrors.py | 1 + |
27 |
pym/repoman/modules/scan/options/options.py | 9 +++ |
28 |
pym/repoman/modules/scan/status/vcsstatus.py | 1 + |
29 |
pym/repoman/modules/scan/use/use_flags.py | 1 + |
30 |
pym/repoman/modules/vcs/None/changes.py | 15 +++- |
31 |
pym/repoman/modules/vcs/bzr/changes.py | 13 +++- |
32 |
pym/repoman/modules/vcs/bzr/status.py | 2 +- |
33 |
pym/repoman/modules/vcs/changes.py | 90 +++++++++++++++------- |
34 |
pym/repoman/modules/vcs/cvs/changes.py | 54 +++++++++---- |
35 |
pym/repoman/modules/vcs/cvs/status.py | 2 +- |
36 |
pym/repoman/modules/vcs/git/changes.py | 24 +++++- |
37 |
pym/repoman/modules/vcs/git/status.py | 5 ++ |
38 |
pym/repoman/modules/vcs/hg/changes.py | 21 ++++- |
39 |
pym/repoman/modules/vcs/hg/status.py | 2 +- |
40 |
pym/repoman/modules/vcs/settings.py | 13 ++++ |
41 |
pym/repoman/modules/vcs/svn/changes.py | 42 ++++++---- |
42 |
pym/repoman/modules/vcs/svn/status.py | 2 +- |
43 |
pym/repoman/modules/vcs/vcs.py | 13 +++- |
44 |
34 files changed, 397 insertions(+), 73 deletions(-) |
45 |
|
46 |
diff --git a/pym/repoman/modules/scan/arches/arches.py b/pym/repoman/modules/scan/arches/arches.py |
47 |
index 5a58d15..bb9e204 100644 |
48 |
--- a/pym/repoman/modules/scan/arches/arches.py |
49 |
+++ b/pym/repoman/modules/scan/arches/arches.py |
50 |
@@ -2,13 +2,25 @@ |
51 |
|
52 |
|
53 |
class ArchChecks(object): |
54 |
+ '''Perform arch keyword checks''' |
55 |
|
56 |
def __init__(self, **kwargs): |
57 |
+ '''Class init |
58 |
+ |
59 |
+ @param options: the run time cli options |
60 |
+ @param repo_settings: repository settings instance |
61 |
+ @param profiles: dictionary |
62 |
+ ''' |
63 |
self.options = kwargs.get('options') |
64 |
self.repo_settings = kwargs.get('repo_settings') |
65 |
self.profiles = kwargs.get('profiles') |
66 |
|
67 |
def check(self, **kwargs): |
68 |
+ '''Determines the arches for the ebuild following the profile rules |
69 |
+ |
70 |
+ @param ebuild: Ebuild which we check (object). |
71 |
+ @returns: dictionary, including arches set |
72 |
+ ''' |
73 |
ebuild = kwargs.get('ebuild') |
74 |
if self.options.ignore_arches: |
75 |
arches = [[ |
76 |
@@ -57,4 +69,5 @@ class ArchChecks(object): |
77 |
|
78 |
@property |
79 |
def runInEbuilds(self): |
80 |
+ '''Ebuild level scans''' |
81 |
return (True, [self.check]) |
82 |
|
83 |
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py |
84 |
index 2f90eee..72438e9 100644 |
85 |
--- a/pym/repoman/modules/scan/depend/depend.py |
86 |
+++ b/pym/repoman/modules/scan/depend/depend.py |
87 |
@@ -10,12 +10,24 @@ from repoman.qa_data import suspect_virtual, suspect_rdepend |
88 |
|
89 |
|
90 |
class DependChecks(object): |
91 |
+ '''Perform dependency checks''' |
92 |
|
93 |
def __init__(self, **kwargs): |
94 |
+ ''' |
95 |
+ @param portdb: portdb instance |
96 |
+ @param qatracker: QATracker instance |
97 |
+ ''' |
98 |
self.qatracker = kwargs.get('qatracker') |
99 |
self.portdb = kwargs.get('portdb') |
100 |
|
101 |
def check(self, **kwargs): |
102 |
+ '''Checks the ebuild dependencies for errors |
103 |
+ |
104 |
+ @param pkg: Package in which we check (object). |
105 |
+ @param ebuild: Ebuild which we check (object). |
106 |
+ @returns: dictionary including {unknown_pkgs, type_list, |
107 |
+ badlicsyntax, baddepsyntax} |
108 |
+ ''' |
109 |
ebuild = kwargs.get('ebuild') |
110 |
pkg = kwargs.get('pkg') |
111 |
|
112 |
@@ -136,4 +148,5 @@ class DependChecks(object): |
113 |
|
114 |
@property |
115 |
def runInEbuilds(self): |
116 |
+ '''Ebuild level scans''' |
117 |
return (True, [self.check]) |
118 |
|
119 |
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py |
120 |
index db63b1c..c202377 100644 |
121 |
--- a/pym/repoman/modules/scan/depend/profile.py |
122 |
+++ b/pym/repoman/modules/scan/depend/profile.py |
123 |
@@ -16,8 +16,25 @@ def sort_key(item): |
124 |
|
125 |
|
126 |
class ProfileDependsChecks(object): |
127 |
+ '''Perform dependency checks for the different profiles''' |
128 |
|
129 |
def __init__(self, **kwargs): |
130 |
+ '''Class init |
131 |
+ |
132 |
+ @param qatracker: QATracker instance |
133 |
+ @param repo_settings: repository settings instance |
134 |
+ @param vcs_settings: VCSSettings instance |
135 |
+ @param changed: changes dictionary |
136 |
+ @param checks: checks dictionary |
137 |
+ @param portdb: portdb instance |
138 |
+ @param profiles: dictionary |
139 |
+ @param include_arches: set |
140 |
+ @param caches: dictionary of our caches |
141 |
+ @param repoman_incrementals: tuple |
142 |
+ @param env: the environment |
143 |
+ @param have: dictionary instance |
144 |
+ @param dev_keywords: developer profile keywords |
145 |
+ ''' |
146 |
self.qatracker = kwargs.get('qatracker') |
147 |
self.portdb = kwargs.get('portdb') |
148 |
self.profiles = kwargs.get('profiles') |
149 |
@@ -31,6 +48,15 @@ class ProfileDependsChecks(object): |
150 |
self.dev_keywords = kwargs.get('dev_keywords') |
151 |
|
152 |
def check(self, **kwargs): |
153 |
+ '''Perform profile dependant dependancy checks |
154 |
+ |
155 |
+ @param arches: |
156 |
+ @param pkg: Package in which we check (object). |
157 |
+ @param ebuild: Ebuild which we check (object). |
158 |
+ @param baddepsyntax: boolean |
159 |
+ @param unknown_pkgs: set of tuples (type, atom.unevaluated_atom) |
160 |
+ @returns: dictionary |
161 |
+ ''' |
162 |
arches = kwargs.get('arches') |
163 |
ebuild = kwargs.get('ebuild') |
164 |
pkg = kwargs.get('pkg') |
165 |
@@ -204,4 +230,5 @@ class ProfileDependsChecks(object): |
166 |
|
167 |
@property |
168 |
def runInEbuilds(self): |
169 |
+ '''Ebuild level scans''' |
170 |
return (True, [self.check]) |
171 |
|
172 |
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py |
173 |
index b61a6e2..88927ad 100644 |
174 |
--- a/pym/repoman/modules/scan/depend/unknown.py |
175 |
+++ b/pym/repoman/modules/scan/depend/unknown.py |
176 |
@@ -2,11 +2,23 @@ |
177 |
|
178 |
|
179 |
class DependUnknown(object): |
180 |
+ '''Perform checks to determine unknown dependencies''' |
181 |
|
182 |
def __init__(self, **kwargs): |
183 |
+ '''Class init |
184 |
+ |
185 |
+ @param qatracker: QATracker instance |
186 |
+ ''' |
187 |
self.qatracker = kwargs.get('qatracker') |
188 |
|
189 |
def check(self, **kwargs): |
190 |
+ '''Perform unknown dependancy checks |
191 |
+ |
192 |
+ @param ebuild: Ebuild which we check (object). |
193 |
+ @param baddepsyntax: boolean |
194 |
+ @param unknown_pkgs: set of tuples (type, atom.unevaluated_atom) |
195 |
+ @returns: dictionary |
196 |
+ ''' |
197 |
ebuild = kwargs.get('ebuild') |
198 |
baddepsyntax = kwargs.get('baddepsyntax') |
199 |
unknown_pkgs = kwargs.get('unknown_pkgs') |
200 |
@@ -23,4 +35,5 @@ class DependUnknown(object): |
201 |
|
202 |
@property |
203 |
def runInEbuilds(self): |
204 |
+ '''Ebuild level scans''' |
205 |
return (True, [self.check]) |
206 |
|
207 |
diff --git a/pym/repoman/modules/scan/directories/files.py b/pym/repoman/modules/scan/directories/files.py |
208 |
index 8f23528..a394658 100644 |
209 |
--- a/pym/repoman/modules/scan/directories/files.py |
210 |
+++ b/pym/repoman/modules/scan/directories/files.py |
211 |
@@ -36,6 +36,7 @@ class FileChecks(ScanBase): |
212 |
@param checkdir: string, directory path |
213 |
@param checkdir_relative: repolevel determined path |
214 |
@param changed: dictionary instance |
215 |
+ @returns: dictionary |
216 |
''' |
217 |
checkdir = kwargs.get('checkdir') |
218 |
checkdirlist = kwargs.get('checkdirlist') |
219 |
|
220 |
diff --git a/pym/repoman/modules/scan/directories/mtime.py b/pym/repoman/modules/scan/directories/mtime.py |
221 |
index e25b553..c5ddbb3 100644 |
222 |
--- a/pym/repoman/modules/scan/directories/mtime.py |
223 |
+++ b/pym/repoman/modules/scan/directories/mtime.py |
224 |
@@ -6,6 +6,13 @@ class MtimeChecks(object): |
225 |
self.vcs_settings = kwargs.get('vcs_settings') |
226 |
|
227 |
def check(self, **kwargs): |
228 |
+ '''Perform a changelog and untracked checks on the ebuild |
229 |
+ |
230 |
+ @param pkg: Package in which we check (object). |
231 |
+ @param ebuild: Ebuild which we check (object). |
232 |
+ @param changed: dictionary instance |
233 |
+ @returns: dictionary |
234 |
+ ''' |
235 |
ebuild = kwargs.get('ebuild') |
236 |
changed = kwargs.get('changed') |
237 |
pkg = kwargs.get('pkg') |
238 |
@@ -17,4 +24,5 @@ class MtimeChecks(object): |
239 |
|
240 |
@property |
241 |
def runInEbuilds(self): |
242 |
+ '''Ebuild level scans''' |
243 |
return (True, [self.check]) |
244 |
|
245 |
diff --git a/pym/repoman/modules/scan/eapi/eapi.py b/pym/repoman/modules/scan/eapi/eapi.py |
246 |
index 1d0ab23..603e1f5 100644 |
247 |
--- a/pym/repoman/modules/scan/eapi/eapi.py |
248 |
+++ b/pym/repoman/modules/scan/eapi/eapi.py |
249 |
@@ -19,6 +19,7 @@ class EAPIChecks(object): |
250 |
''' |
251 |
@param pkg: Package in which we check (object). |
252 |
@param ebuild: Ebuild which we check (object). |
253 |
+ @returns: dictionary |
254 |
''' |
255 |
ebuild = kwargs.get('ebuild') |
256 |
|
257 |
@@ -42,4 +43,5 @@ class EAPIChecks(object): |
258 |
|
259 |
@property |
260 |
def runInEbuilds(self): |
261 |
+ '''Ebuild level scans''' |
262 |
return (True, [self.check]) |
263 |
|
264 |
diff --git a/pym/repoman/modules/scan/ebuild/ebuild.py b/pym/repoman/modules/scan/ebuild/ebuild.py |
265 |
index 2414028..0ae416b 100644 |
266 |
--- a/pym/repoman/modules/scan/ebuild/ebuild.py |
267 |
+++ b/pym/repoman/modules/scan/ebuild/ebuild.py |
268 |
@@ -16,7 +16,8 @@ class Ebuild(ScanBase): |
269 |
'''Class to run primary checks on ebuilds''' |
270 |
|
271 |
def __init__(self, **kwargs): |
272 |
- ''' |
273 |
+ '''Class init |
274 |
+ |
275 |
@param qatracker: QATracker instance |
276 |
@param repo_settings: repository settings instance |
277 |
@param vcs_settings: VCSSettings instance |
278 |
@@ -36,7 +37,6 @@ class Ebuild(ScanBase): |
279 |
self.eapi = None |
280 |
self.inherited = None |
281 |
self.keywords = None |
282 |
- self.archs = None |
283 |
|
284 |
def _set_paths(self, **kwargs): |
285 |
repolevel = kwargs.get('repolevel') |
286 |
@@ -51,6 +51,7 @@ class Ebuild(ScanBase): |
287 |
|
288 |
@property |
289 |
def untracked(self): |
290 |
+ '''Determines and returns if the ebuild is not tracked by the vcs''' |
291 |
do_check = self.vcs_settings.vcs in ("cvs", "svn", "bzr") |
292 |
really_notadded = (self.checks['ebuild_notadded'] and |
293 |
self.y_ebuild not in self.vcs_settings.eadded) |
294 |
@@ -60,6 +61,16 @@ class Ebuild(ScanBase): |
295 |
return False |
296 |
|
297 |
def check(self, **kwargs): |
298 |
+ '''Perform a changelog and untracked checks on the ebuild |
299 |
+ |
300 |
+ @param xpkg: Package in which we check (object). |
301 |
+ @param y_ebuild: Ebuild which we check (string). |
302 |
+ @param changed: dictionary instance |
303 |
+ @param repolevel: The depth within the repository |
304 |
+ @param catdir: The category directiory |
305 |
+ @param pkgdir: the package directory |
306 |
+ @returns: dictionary, including {ebuild object} |
307 |
+ ''' |
308 |
self.xpkg = kwargs.get('xpkg') |
309 |
self.y_ebuild = kwargs.get('y_ebuild') |
310 |
self.changed = kwargs.get('changed') |
311 |
@@ -76,6 +87,11 @@ class Ebuild(ScanBase): |
312 |
return {'continue': False, 'ebuild': self} |
313 |
|
314 |
def set_pkg_data(self, **kwargs): |
315 |
+ '''Sets some classwide data needed for some of the checks |
316 |
+ |
317 |
+ @param pkgs: the dynamic list of ebuilds |
318 |
+ @returns: dictionary |
319 |
+ ''' |
320 |
self.pkg = kwargs.get('pkgs')[self.y_ebuild] |
321 |
self.metadata = self.pkg._metadata |
322 |
self.eapi = self.metadata["EAPI"] |
323 |
@@ -88,6 +104,7 @@ class Ebuild(ScanBase): |
324 |
'''Checks for bad category/package splits. |
325 |
|
326 |
@param pkgdir: string: path |
327 |
+ @returns: dictionary |
328 |
''' |
329 |
pkgdir = kwargs.get('pkgdir') |
330 |
myesplit = portage.pkgsplit(self.y_ebuild) |
331 |
@@ -109,6 +126,7 @@ class Ebuild(ScanBase): |
332 |
def pkg_invalid(self, **kwargs): |
333 |
'''Sets some pkg info and checks for invalid packages |
334 |
|
335 |
+ @returns: dictionary, including {pkg object, allvalid} |
336 |
''' |
337 |
if self.pkg.invalid: |
338 |
for k, msgs in self.pkg.invalid.items(): |
339 |
|
340 |
diff --git a/pym/repoman/modules/scan/ebuild/isebuild.py b/pym/repoman/modules/scan/ebuild/isebuild.py |
341 |
index 56e0268..1dffc6a 100644 |
342 |
--- a/pym/repoman/modules/scan/ebuild/isebuild.py |
343 |
+++ b/pym/repoman/modules/scan/ebuild/isebuild.py |
344 |
@@ -32,9 +32,10 @@ class IsEbuild(ScanBase): |
345 |
def check(self, **kwargs): |
346 |
'''Test the file for qualifications that is is an ebuild |
347 |
|
348 |
- @param checkdirlist: list of files in teh current package directory |
349 |
+ @param checkdirlist: list of files in the current package directory |
350 |
@param checkdir: current package directory path |
351 |
@param xpkg: current package directory being checked |
352 |
+ @returns: dictionary, including {pkgs, allvalid, can_force} |
353 |
''' |
354 |
checkdirlist = kwargs.get('checkdirlist') |
355 |
checkdir = kwargs.get('checkdir') |
356 |
|
357 |
diff --git a/pym/repoman/modules/scan/ebuild/multicheck.py b/pym/repoman/modules/scan/ebuild/multicheck.py |
358 |
index 8b85abf..a9d85f0 100644 |
359 |
--- a/pym/repoman/modules/scan/ebuild/multicheck.py |
360 |
+++ b/pym/repoman/modules/scan/ebuild/multicheck.py |
361 |
@@ -1,4 +1,8 @@ |
362 |
|
363 |
+'''multicheck.py |
364 |
+Perform multiple different checks on an ebuild |
365 |
+''' |
366 |
+ |
367 |
import io |
368 |
|
369 |
from portage import _encodings, _unicode_encode |
370 |
@@ -10,11 +14,22 @@ class MultiCheck(object): |
371 |
'''Class to run multiple different checks on an ebuild''' |
372 |
|
373 |
def __init__(self, **kwargs): |
374 |
+ '''Class init |
375 |
+ |
376 |
+ @param qatracker: QATracker instance |
377 |
+ @param options: the run time cli options |
378 |
+ ''' |
379 |
self.qatracker = kwargs.get('qatracker') |
380 |
self.options = kwargs.get('options') |
381 |
checks_init(self.options.experimental_inherit == 'y') |
382 |
|
383 |
def check(self, **kwargs): |
384 |
+ '''Check the ebuild for utf-8 encoding |
385 |
+ |
386 |
+ @param pkg: Package in which we check (object). |
387 |
+ @param ebuild: Ebuild which we check (object). |
388 |
+ @returns: dictionary |
389 |
+ ''' |
390 |
ebuild = kwargs.get('ebuild') |
391 |
pkg = kwargs.get('pkg') |
392 |
try: |
393 |
@@ -36,4 +51,5 @@ class MultiCheck(object): |
394 |
|
395 |
@property |
396 |
def runInEbuilds(self): |
397 |
+ '''Ebuild level scans''' |
398 |
return (True, [self.check]) |
399 |
|
400 |
diff --git a/pym/repoman/modules/scan/eclasses/live.py b/pym/repoman/modules/scan/eclasses/live.py |
401 |
index 4a870df..cb43bc0 100644 |
402 |
--- a/pym/repoman/modules/scan/eclasses/live.py |
403 |
+++ b/pym/repoman/modules/scan/eclasses/live.py |
404 |
@@ -18,6 +18,10 @@ class LiveEclassChecks(object): |
405 |
self.repo_settings = kwargs.get('repo_settings') |
406 |
|
407 |
def is_live(self, **kwargs): |
408 |
+ '''Test if the ebuild inherits a live eclass |
409 |
+ |
410 |
+ @returns: dictionary, including {live_ebuild} |
411 |
+ ''' |
412 |
return {'continue': False, |
413 |
'live_ebuild': LIVE_ECLASSES.intersection( |
414 |
kwargs.get('ebuild').inherited)} |
415 |
@@ -32,6 +36,7 @@ class LiveEclassChecks(object): |
416 |
@param y_ebuild: Ebuild which we check (string). |
417 |
@param keywords: The keywords of the ebuild. |
418 |
@param global_pmaskdict: A global dictionary of all the masks. |
419 |
+ @returns: dictionary |
420 |
''' |
421 |
pkg = kwargs.get("pkg") |
422 |
package = kwargs.get('xpkg') |
423 |
@@ -68,4 +73,5 @@ class LiveEclassChecks(object): |
424 |
|
425 |
@property |
426 |
def runInEbuilds(self): |
427 |
+ '''Ebuild level scans''' |
428 |
return (True, [self.is_live, self.check]) |
429 |
|
430 |
diff --git a/pym/repoman/modules/scan/eclasses/ruby.py b/pym/repoman/modules/scan/eclasses/ruby.py |
431 |
index 4dc5d62..aa2232a 100644 |
432 |
--- a/pym/repoman/modules/scan/eclasses/ruby.py |
433 |
+++ b/pym/repoman/modules/scan/eclasses/ruby.py |
434 |
@@ -1,5 +1,5 @@ |
435 |
|
436 |
-'''live.py |
437 |
+'''ruby.py |
438 |
Performs Ruby eclass checks |
439 |
''' |
440 |
|
441 |
@@ -19,6 +19,12 @@ class RubyEclassChecks(ScanBase): |
442 |
self.old_ruby_eclasses = ["ruby-ng", "ruby-fakegem", "ruby"] |
443 |
|
444 |
def check(self, **kwargs): |
445 |
+ '''Check ebuilds that inherit the ruby eclasses |
446 |
+ |
447 |
+ @param pkg: Package in which we check (object). |
448 |
+ @param ebuild: Ebuild which we check (object). |
449 |
+ @returns: dictionary |
450 |
+ ''' |
451 |
pkg = kwargs.get('pkg') |
452 |
ebuild = kwargs.get('ebuild') |
453 |
is_inherited = lambda eclass: eclass in pkg.inherited |
454 |
|
455 |
diff --git a/pym/repoman/modules/scan/fetch/fetches.py b/pym/repoman/modules/scan/fetch/fetches.py |
456 |
index 63677d0..6bdcf23 100644 |
457 |
--- a/pym/repoman/modules/scan/fetch/fetches.py |
458 |
+++ b/pym/repoman/modules/scan/fetch/fetches.py |
459 |
@@ -38,6 +38,7 @@ class FetchChecks(ScanBase): |
460 |
@param xpkg: the pacakge being checked |
461 |
@param checkdir: string, directory path |
462 |
@param checkdir_relative: repolevel determined path |
463 |
+ @returns: dictionary, including {src_uri_error} |
464 |
''' |
465 |
xpkg = kwargs.get('xpkg') |
466 |
checkdir = kwargs.get('checkdir') |
467 |
|
468 |
diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py |
469 |
index e34c891..196feb4 100644 |
470 |
--- a/pym/repoman/modules/scan/keywords/keywords.py |
471 |
+++ b/pym/repoman/modules/scan/keywords/keywords.py |
472 |
@@ -38,6 +38,7 @@ class KeywordChecks(ScanBase): |
473 |
@param ebuild_archs: Just the architectures (no prefixes) of the ebuild. |
474 |
@param changed: Changes instance |
475 |
@param live_ebuild: A boolean that determines if this is a live ebuild. |
476 |
+ @returns: dictionary |
477 |
''' |
478 |
pkg = kwargs.get('pkg') |
479 |
xpkg =kwargs.get('xpkg') |
480 |
|
481 |
diff --git a/pym/repoman/modules/scan/manifest/manifests.py b/pym/repoman/modules/scan/manifest/manifests.py |
482 |
index a19d566..2262e3f 100644 |
483 |
--- a/pym/repoman/modules/scan/manifest/manifests.py |
484 |
+++ b/pym/repoman/modules/scan/manifest/manifests.py |
485 |
@@ -12,8 +12,16 @@ from portage.util import writemsg_level |
486 |
|
487 |
|
488 |
class Manifests(object): |
489 |
+ '''Creates as well as checks pkg Manifest entries/files''' |
490 |
|
491 |
def __init__(self, **kwargs): |
492 |
+ '''Class init |
493 |
+ |
494 |
+ @param options: the run time cli options |
495 |
+ @param portdb: portdb instance |
496 |
+ @param qatracker: QATracker instance |
497 |
+ @param repo_settings: repository settings instance |
498 |
+ ''' |
499 |
self.options = kwargs.get('options') |
500 |
self.portdb = kwargs.get('portdb') |
501 |
self.qatracker = kwargs.get('qatracker') |
502 |
@@ -21,6 +29,12 @@ class Manifests(object): |
503 |
self.generated_manifest = False |
504 |
|
505 |
def check(self, **kwargs): |
506 |
+ '''Perform a changelog and untracked checks on the ebuild |
507 |
+ |
508 |
+ @param xpkg: Package in which we check (object). |
509 |
+ @param checkdirlist: list of files in the current package directory |
510 |
+ @returns: dictionary |
511 |
+ ''' |
512 |
checkdir = kwargs.get('checkdir') |
513 |
xpkg = kwargs.get('xpkg') |
514 |
self.generated_manifest = False |
515 |
@@ -83,6 +97,12 @@ class Manifests(object): |
516 |
return {'continue': False} |
517 |
|
518 |
def create_manifest(self, checkdir, fetchlist_dict): |
519 |
+ '''Creates a Manifest file |
520 |
+ |
521 |
+ @param checkdir: the directory to generate the Manifest in |
522 |
+ @param fetchlist_dict: dictionary of files to fetch and/or include |
523 |
+ in the manifest |
524 |
+ ''' |
525 |
try: |
526 |
distdir = self.repoman_settings['DISTDIR'] |
527 |
mf = self.repoman_settings.repositories.get_repo_for_location( |
528 |
@@ -102,6 +122,10 @@ class Manifests(object): |
529 |
portage._doebuild_manifest_exempt_depend -= 1 |
530 |
|
531 |
def digest_check(self, xpkg, checkdir): |
532 |
+ '''Check the manifest entries, report any Q/A errors |
533 |
+ |
534 |
+ @param xpkg: the cat/pkg name to check |
535 |
+ @param checkdir: the directory path to check''' |
536 |
self.repoman_settings['O'] = checkdir |
537 |
self.repoman_settings['PORTAGE_QUIET'] = '1' |
538 |
if not portage.digestcheck([], self.repoman_settings, strict=1): |
539 |
@@ -110,4 +134,5 @@ class Manifests(object): |
540 |
|
541 |
@property |
542 |
def runInPkgs(self): |
543 |
+ '''Package level scans''' |
544 |
return (True, [self.check]) |
545 |
|
546 |
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py |
547 |
index 8e93457..030cbca 100644 |
548 |
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py |
549 |
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py |
550 |
@@ -64,6 +64,7 @@ class PkgMetadata(ScanBase): |
551 |
@param checkdir: string, directory path |
552 |
@param checkdirlist: list of checkdir's |
553 |
@param repolevel: integer |
554 |
+ @returns: dictionary, including {muselist} |
555 |
''' |
556 |
xpkg = kwargs.get('xpkg') |
557 |
checkdir = kwargs.get('checkdir') |
558 |
|
559 |
diff --git a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py |
560 |
index 9404e28..f467ea4 100644 |
561 |
--- a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py |
562 |
+++ b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py |
563 |
@@ -31,6 +31,7 @@ class ThirdPartyMirrors(ScanBase): |
564 |
|
565 |
@param ebuild: Ebuild which we check (object). |
566 |
@param src_uri_error: boolean |
567 |
+ @returns: dictionary |
568 |
''' |
569 |
ebuild = kwargs.get('ebuild') |
570 |
if kwargs.get('src_uri_error'): |
571 |
|
572 |
diff --git a/pym/repoman/modules/scan/options/options.py b/pym/repoman/modules/scan/options/options.py |
573 |
index c2546d6..327b6d8 100644 |
574 |
--- a/pym/repoman/modules/scan/options/options.py |
575 |
+++ b/pym/repoman/modules/scan/options/options.py |
576 |
@@ -3,9 +3,17 @@ |
577 |
class Options(object): |
578 |
|
579 |
def __init__(self, **kwargs): |
580 |
+ '''Class init function |
581 |
+ |
582 |
+ @param options: argparse options instance |
583 |
+ ''' |
584 |
self.options = kwargs.get('options') |
585 |
|
586 |
def is_forced(self, **kwargs): |
587 |
+ '''Simple boolean function to trigger a skip past some additional checks |
588 |
+ |
589 |
+ @returns: dictionary |
590 |
+ ''' |
591 |
if self.options.force: |
592 |
# The dep_check() calls are the most expensive QA test. If --force |
593 |
# is enabled, there's no point in wasting time on these since the |
594 |
@@ -15,4 +23,5 @@ class Options(object): |
595 |
|
596 |
@property |
597 |
def runInEbuilds(self): |
598 |
+ '''Ebuild level scans''' |
599 |
return (True, [self.is_forced]) |
600 |
|
601 |
diff --git a/pym/repoman/modules/scan/status/vcsstatus.py b/pym/repoman/modules/scan/status/vcsstatus.py |
602 |
index 1ece6c6..cf2298e 100644 |
603 |
--- a/pym/repoman/modules/scan/status/vcsstatus.py |
604 |
+++ b/pym/repoman/modules/scan/status/vcsstatus.py |
605 |
@@ -24,6 +24,7 @@ class VCSStatus(ScanBase): |
606 |
@param checkdir: string, directory path |
607 |
@param checkdir_relative: repolevel determined path |
608 |
@param xpkg: the current package being checked |
609 |
+ @returns: dictionary including {eadded} |
610 |
''' |
611 |
checkdir = kwargs.get('checkdir') |
612 |
checkdir_relative = kwargs.get('checkdir_relative') |
613 |
|
614 |
diff --git a/pym/repoman/modules/scan/use/use_flags.py b/pym/repoman/modules/scan/use/use_flags.py |
615 |
index acc7dd3..b76ed70 100644 |
616 |
--- a/pym/repoman/modules/scan/use/use_flags.py |
617 |
+++ b/pym/repoman/modules/scan/use/use_flags.py |
618 |
@@ -36,6 +36,7 @@ class USEFlagChecks(ScanBase): |
619 |
@param ebuild: Ebuild which we check (object). |
620 |
@param y_ebuild: Ebuild which we check (string). |
621 |
@param muselist: Local USE flags of the package |
622 |
+ @returns: dictionary, including {ebuild_UsedUseFlags, used_useflags} |
623 |
''' |
624 |
pkg = kwargs.get('pkg') |
625 |
package = kwargs.get('xpkg') |
626 |
|
627 |
diff --git a/pym/repoman/modules/vcs/None/changes.py b/pym/repoman/modules/vcs/None/changes.py |
628 |
index 7f46177..46c38e2 100644 |
629 |
--- a/pym/repoman/modules/vcs/None/changes.py |
630 |
+++ b/pym/repoman/modules/vcs/None/changes.py |
631 |
@@ -15,7 +15,8 @@ class Changes(ChangesBase): |
632 |
def __init__(self, options, repo_settings): |
633 |
'''Class init |
634 |
|
635 |
- @param options: commandline options |
636 |
+ @param options: the run time cli options |
637 |
+ @param repo_settings: RepoSettings instance |
638 |
''' |
639 |
super(Changes, self).__init__(options, repo_settings) |
640 |
|
641 |
@@ -23,11 +24,19 @@ class Changes(ChangesBase): |
642 |
'''VCS type scan function, looks for all detectable changes''' |
643 |
pass |
644 |
|
645 |
- def add_items(self, myautoadd): |
646 |
- '''Nothing to add them to''' |
647 |
+ def add_items(self, autoadd): |
648 |
+ '''Add files to the vcs's modified or new index |
649 |
+ |
650 |
+ @param autoadd: the files to add to the vcs modified index''' |
651 |
pass |
652 |
|
653 |
def commit(self, myfiles, commitmessagefile): |
654 |
+ '''None commit function |
655 |
+ |
656 |
+ @param commitfiles: list of files to commit |
657 |
+ @param commitmessagefile: file containing the commit message |
658 |
+ @returns: The sub-command exit value or 0 |
659 |
+ ''' |
660 |
commit_cmd = [] |
661 |
# substitute a bogus vcs value for pretend output |
662 |
commit_cmd.append("pretend") |
663 |
|
664 |
diff --git a/pym/repoman/modules/vcs/bzr/changes.py b/pym/repoman/modules/vcs/bzr/changes.py |
665 |
index e5e61ff..4d4808c 100644 |
666 |
--- a/pym/repoman/modules/vcs/bzr/changes.py |
667 |
+++ b/pym/repoman/modules/vcs/bzr/changes.py |
668 |
@@ -18,7 +18,8 @@ class Changes(ChangesBase): |
669 |
def __init__(self, options, repo_settings): |
670 |
'''Class init |
671 |
|
672 |
- @param options: commandline options |
673 |
+ @param options: the run time cli options |
674 |
+ @param repo_settings: RepoSettings instance |
675 |
''' |
676 |
super(Changes, self).__init__(options, repo_settings) |
677 |
|
678 |
@@ -52,7 +53,15 @@ class Changes(ChangesBase): |
679 |
if elem.startswith("?") or elem[0:2] == " D"] |
680 |
return self._unadded |
681 |
|
682 |
- def digest_regen(self, myupdates, myremoved, mymanifests, scanner, broken_changelog_manifests): |
683 |
+ def digest_regen(self, updates, removed, manifests, scanner, broken_changelog_manifests): |
684 |
+ '''Regenerate manifests |
685 |
+ |
686 |
+ @param updates: updated files |
687 |
+ @param removed: removed files |
688 |
+ @param manifests: Manifest files |
689 |
+ @param scanner: The repoman.scanner.Scanner instance |
690 |
+ @param broken_changelog_manifests: broken changelog manifests |
691 |
+ ''' |
692 |
if broken_changelog_manifests: |
693 |
for x in broken_changelog_manifests: |
694 |
self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x) |
695 |
|
696 |
diff --git a/pym/repoman/modules/vcs/bzr/status.py b/pym/repoman/modules/vcs/bzr/status.py |
697 |
index d5f3326..199e7f3 100644 |
698 |
--- a/pym/repoman/modules/vcs/bzr/status.py |
699 |
+++ b/pym/repoman/modules/vcs/bzr/status.py |
700 |
@@ -62,7 +62,7 @@ class Status(object): |
701 |
|
702 |
@staticmethod |
703 |
def isVcsDir(dirname): |
704 |
- '''Is the directory belong to the vcs system |
705 |
+ '''Does the directory belong to the vcs system |
706 |
|
707 |
@param dirname: string, directory name |
708 |
@returns: Boolean |
709 |
|
710 |
diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py |
711 |
index f322cb1..aa4923f 100644 |
712 |
--- a/pym/repoman/modules/vcs/changes.py |
713 |
+++ b/pym/repoman/modules/vcs/changes.py |
714 |
@@ -21,6 +21,11 @@ class ChangesBase(object): |
715 |
vcs = 'None' |
716 |
|
717 |
def __init__(self, options, repo_settings): |
718 |
+ '''Class init function |
719 |
+ |
720 |
+ @param options: the run time cli options |
721 |
+ @param repo_settings: RepoSettings instance |
722 |
+ ''' |
723 |
self.options = options |
724 |
self.repo_settings = repo_settings |
725 |
self.repoman_settings = repo_settings.repoman_settings |
726 |
@@ -28,6 +33,7 @@ class ChangesBase(object): |
727 |
self._reset() |
728 |
|
729 |
def _reset(self): |
730 |
+ '''Reset the class variables for a new run''' |
731 |
self.new_ebuilds = set() |
732 |
self.ebuilds = set() |
733 |
self.changelogs = set() |
734 |
@@ -40,6 +46,11 @@ class ChangesBase(object): |
735 |
self._unadded = None |
736 |
|
737 |
def scan(self): |
738 |
+ '''Scan the vcs for detectable changes. |
739 |
+ |
740 |
+ base method which calls the subclassing VCS module's _scan() |
741 |
+ then updates some classwide variables. |
742 |
+ ''' |
743 |
self._reset() |
744 |
|
745 |
if self.vcs: |
746 |
@@ -80,52 +91,79 @@ class ChangesBase(object): |
747 |
'''Override this function as needed''' |
748 |
return {} |
749 |
|
750 |
- def thick_manifest(self, myupdates, myheaders, no_expansion, expansion): |
751 |
- '''Create a thick manifest''' |
752 |
+ def thick_manifest(self, updates, headers, no_expansion, expansion): |
753 |
+ '''Create a thick manifest |
754 |
+ |
755 |
+ @param updates: |
756 |
+ @param headers: |
757 |
+ @param no_expansion: |
758 |
+ @param expansion: |
759 |
+ ''' |
760 |
pass |
761 |
|
762 |
- def digest_regen(self, myupdates, myremoved, mymanifests, scanner, |
763 |
+ def digest_regen(self, updates, removed, manifests, scanner, |
764 |
broken_changelog_manifests): |
765 |
- '''Regenerate manifests''' |
766 |
+ '''Regenerate manifests |
767 |
+ |
768 |
+ @param updates: updated files |
769 |
+ @param removed: removed files |
770 |
+ @param manifests: Manifest files |
771 |
+ @param scanner: The repoman.scanner.Scanner instance |
772 |
+ @param broken_changelog_manifests: broken changelog manifests |
773 |
+ ''' |
774 |
pass |
775 |
|
776 |
@staticmethod |
777 |
- def clear_attic(myheaders): |
778 |
- '''Old CVS leftover''' |
779 |
+ def clear_attic(headers): |
780 |
+ '''Old CVS leftover |
781 |
+ |
782 |
+ @param headers: file headers''' |
783 |
pass |
784 |
|
785 |
def update_index(self, mymanifests, myupdates): |
786 |
- '''Update the vcs's modified index if it is needed''' |
787 |
+ '''Update the vcs's modified index if it is needed |
788 |
+ |
789 |
+ @param mymanifests: manifest files updated |
790 |
+ @param myupdates: other files updated''' |
791 |
pass |
792 |
|
793 |
- def add_items(self, myautoadd): |
794 |
- add_cmd = [self.vcs, "add"] |
795 |
- add_cmd += myautoadd |
796 |
- if self.options.pretend: |
797 |
- portage.writemsg_stdout( |
798 |
- "(%s)\n" % " ".join(add_cmd), |
799 |
- noiselevel=-1) |
800 |
- else: |
801 |
- add_cmd = [_unicode_encode(arg) for arg in add_cmd] |
802 |
- retcode = subprocess.call(add_cmd) |
803 |
- if retcode != os.EX_OK: |
804 |
- logging.error( |
805 |
- "Exiting on %s error code: %s\n" % (self.vcs_settings.vcs, retcode)) |
806 |
- sys.exit(retcode) |
807 |
- |
808 |
- |
809 |
- def commit(self, myfiles, commitmessagefile): |
810 |
- '''Common generic commit function''' |
811 |
+ def add_items(self, autoadd): |
812 |
+ '''Add files to the vcs's modified or new index |
813 |
+ |
814 |
+ @param autoadd: the files to add to the vcs modified index''' |
815 |
+ add_cmd = [self.vcs, "add"] |
816 |
+ add_cmd += autoadd |
817 |
+ if self.options.pretend: |
818 |
+ portage.writemsg_stdout( |
819 |
+ "(%s)\n" % " ".join(add_cmd), |
820 |
+ noiselevel=-1) |
821 |
+ else: |
822 |
+ add_cmd = [_unicode_encode(arg) for arg in add_cmd] |
823 |
+ retcode = subprocess.call(add_cmd) |
824 |
+ if retcode != os.EX_OK: |
825 |
+ logging.error( |
826 |
+ "Exiting on %s error code: %s\n", self.vcs_settings.vcs, retcode) |
827 |
+ sys.exit(retcode) |
828 |
+ |
829 |
+ |
830 |
+ def commit(self, commitfiles, commitmessagefile): |
831 |
+ '''Common generic commit function |
832 |
+ |
833 |
+ @param commitfiles: list of files to commit |
834 |
+ @param commitmessagefile: file containing the commit message |
835 |
+ @returns: The sub-command exit value or 0 |
836 |
+ ''' |
837 |
commit_cmd = [] |
838 |
commit_cmd.append(self.vcs) |
839 |
commit_cmd.extend(self.vcs_settings.vcs_global_opts) |
840 |
commit_cmd.append("commit") |
841 |
commit_cmd.extend(self.vcs_settings.vcs_local_opts) |
842 |
commit_cmd.extend(["-F", commitmessagefile]) |
843 |
- commit_cmd.extend(f.lstrip("./") for f in myfiles) |
844 |
+ commit_cmd.extend(f.lstrip("./") for f in commitfiles) |
845 |
|
846 |
if self.options.pretend: |
847 |
print("(%s)" % (" ".join(commit_cmd),)) |
848 |
+ return 0 |
849 |
else: |
850 |
retval = spawn(commit_cmd, env=self.repo_settings.commit_env) |
851 |
return retval |
852 |
|
853 |
diff --git a/pym/repoman/modules/vcs/cvs/changes.py b/pym/repoman/modules/vcs/cvs/changes.py |
854 |
index f5c622b..3e2f97a 100644 |
855 |
--- a/pym/repoman/modules/vcs/cvs/changes.py |
856 |
+++ b/pym/repoman/modules/vcs/cvs/changes.py |
857 |
@@ -7,9 +7,15 @@ from itertools import chain |
858 |
|
859 |
from repoman._portage import portage |
860 |
from repoman.modules.vcs.changes import ChangesBase |
861 |
+from repoman.modules.vcs.vcs import vcs_files_to_cps |
862 |
+from repoman._subprocess import repoman_getstatusoutput |
863 |
+ |
864 |
+from portage import _encodings, _unicode_encode |
865 |
from portage import cvstree, os |
866 |
+from portage.output import green |
867 |
from portage.package.ebuild.digestgen import digestgen |
868 |
|
869 |
+ |
870 |
class Changes(ChangesBase): |
871 |
'''Class object to scan and hold the resultant data |
872 |
for all changes to process. |
873 |
@@ -20,7 +26,8 @@ class Changes(ChangesBase): |
874 |
def __init__(self, options, repo_settings): |
875 |
'''Class init |
876 |
|
877 |
- @param options: commandline options |
878 |
+ @param options: the run time cli options |
879 |
+ @param repo_settings: RepoSettings instance |
880 |
''' |
881 |
super(Changes, self).__init__(options, repo_settings) |
882 |
self._tree = None |
883 |
@@ -44,11 +51,15 @@ class Changes(ChangesBase): |
884 |
return self._unadded |
885 |
|
886 |
@staticmethod |
887 |
- def clear_attic(myheaders): |
888 |
+ def clear_attic(headers): |
889 |
+ '''Clear the attic (inactive files) |
890 |
+ |
891 |
+ @param headers: file headers |
892 |
+ ''' |
893 |
cvs_header_re = re.compile(br'^#\s*\$Header.*\$$') |
894 |
attic_str = b'/Attic/' |
895 |
attic_replace = b'/' |
896 |
- for x in myheaders: |
897 |
+ for x in headers: |
898 |
f = open( |
899 |
_unicode_encode(x, encoding=_encodings['fs'], errors='strict'), |
900 |
mode='rb') |
901 |
@@ -63,29 +74,44 @@ class Changes(ChangesBase): |
902 |
if modified: |
903 |
portage.util.write_atomic(x, b''.join(mylines), mode='wb') |
904 |
|
905 |
- def thick_manifest(self, myupdates, myheaders, no_expansion, expansion): |
906 |
+ def thick_manifest(self, updates, headers, no_expansion, expansion): |
907 |
+ '''Create a thick manifest |
908 |
+ |
909 |
+ @param updates: |
910 |
+ @param headers: |
911 |
+ @param no_expansion: |
912 |
+ @param expansion: |
913 |
+ ''' |
914 |
headerstring = "'\$(Header|Id).*\$'" |
915 |
|
916 |
- for myfile in myupdates: |
917 |
+ for _file in updates: |
918 |
|
919 |
# for CVS, no_expansion contains files that are excluded from expansion |
920 |
- if myfile in no_expansion: |
921 |
+ if _file in no_expansion: |
922 |
continue |
923 |
|
924 |
- myout = repoman_getstatusoutput( |
925 |
- "egrep -q %s %s" % (headerstring, portage._shell_quote(myfile))) |
926 |
- if myout[0] == 0: |
927 |
- myheaders.append(myfile) |
928 |
+ _out = repoman_getstatusoutput( |
929 |
+ "egrep -q %s %s" % (headerstring, portage._shell_quote(_file))) |
930 |
+ if _out[0] == 0: |
931 |
+ headers.append(_file) |
932 |
|
933 |
- print("%s have headers that will change." % green(str(len(myheaders)))) |
934 |
+ print("%s have headers that will change." % green(str(len(headers)))) |
935 |
print( |
936 |
"* Files with headers will" |
937 |
" cause the manifests to be changed and committed separately.") |
938 |
|
939 |
- def digest_regen(self, myupdates, myremoved, mymanifests, scanner, broken_changelog_manifests): |
940 |
- if myupdates or myremoved: |
941 |
+ def digest_regen(self, updates, removed, manifests, scanner, broken_changelog_manifests): |
942 |
+ '''Regenerate manifests |
943 |
+ |
944 |
+ @param updates: updated files |
945 |
+ @param removed: removed files |
946 |
+ @param manifests: Manifest files |
947 |
+ @param scanner: The repoman.scanner.Scanner instance |
948 |
+ @param broken_changelog_manifests: broken changelog manifests |
949 |
+ ''' |
950 |
+ if updates or removed: |
951 |
for x in sorted(vcs_files_to_cps( |
952 |
- chain(myupdates, myremoved, mymanifests), |
953 |
+ chain(updates, removed, manifests), |
954 |
scanner.repolevel, scanner.reposplit, scanner.categories)): |
955 |
self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x) |
956 |
digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb) |
957 |
|
958 |
diff --git a/pym/repoman/modules/vcs/cvs/status.py b/pym/repoman/modules/vcs/cvs/status.py |
959 |
index 1917bde..b936aa7 100644 |
960 |
--- a/pym/repoman/modules/vcs/cvs/status.py |
961 |
+++ b/pym/repoman/modules/vcs/cvs/status.py |
962 |
@@ -123,7 +123,7 @@ class Status(object): |
963 |
|
964 |
@staticmethod |
965 |
def isVcsDir(dirname): |
966 |
- '''Is the directory belong to the vcs system |
967 |
+ '''Does the directory belong to the vcs system |
968 |
|
969 |
@param dirname: string, directory name |
970 |
@returns: Boolean |
971 |
|
972 |
diff --git a/pym/repoman/modules/vcs/git/changes.py b/pym/repoman/modules/vcs/git/changes.py |
973 |
index a0b836e..7e9ac1e 100644 |
974 |
--- a/pym/repoman/modules/vcs/git/changes.py |
975 |
+++ b/pym/repoman/modules/vcs/git/changes.py |
976 |
@@ -24,7 +24,8 @@ class Changes(ChangesBase): |
977 |
def __init__(self, options, repo_settings): |
978 |
'''Class init |
979 |
|
980 |
- @param options: commandline options |
981 |
+ @param options: the run time cli options |
982 |
+ @param repo_settings: RepoSettings instance |
983 |
''' |
984 |
super(Changes, self).__init__(options, repo_settings) |
985 |
|
986 |
@@ -63,13 +64,25 @@ class Changes(ChangesBase): |
987 |
del unadded |
988 |
return self._unadded |
989 |
|
990 |
- def digest_regen(self, myupdates, myremoved, mymanifests, scanner, broken_changelog_manifests): |
991 |
+ def digest_regen(self, updates, removed, manifests, scanner, broken_changelog_manifests): |
992 |
+ '''Regenerate manifests |
993 |
+ |
994 |
+ @param updates: updated files |
995 |
+ @param removed: removed files |
996 |
+ @param manifests: Manifest files |
997 |
+ @param scanner: The repoman.scanner.Scanner instance |
998 |
+ @param broken_changelog_manifests: broken changelog manifests |
999 |
+ ''' |
1000 |
if broken_changelog_manifests: |
1001 |
for x in broken_changelog_manifests: |
1002 |
self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x) |
1003 |
digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb) |
1004 |
|
1005 |
def update_index(self, mymanifests, myupdates): |
1006 |
+ '''Update the vcs's modified index if it is needed |
1007 |
+ |
1008 |
+ @param mymanifests: manifest files updated |
1009 |
+ @param myupdates: other files updated''' |
1010 |
# It's not safe to use the git commit -a option since there might |
1011 |
# be some modified files elsewhere in the working tree that the |
1012 |
# user doesn't want to commit. Therefore, call git update-index |
1013 |
@@ -92,7 +105,12 @@ class Changes(ChangesBase): |
1014 |
sys.exit(retval) |
1015 |
|
1016 |
def commit(self, myfiles, commitmessagefile): |
1017 |
- '''Git commit the changes''' |
1018 |
+ '''Git commit function |
1019 |
+ |
1020 |
+ @param commitfiles: list of files to commit |
1021 |
+ @param commitmessagefile: file containing the commit message |
1022 |
+ @returns: The sub-command exit value or 0 |
1023 |
+ ''' |
1024 |
retval = super(Changes, self).commit(myfiles, commitmessagefile) |
1025 |
if retval != os.EX_OK: |
1026 |
if self.repo_settings.repo_config.sign_commit and not self.vcs_settings.status.supports_gpg_sign(): |
1027 |
|
1028 |
diff --git a/pym/repoman/modules/vcs/git/status.py b/pym/repoman/modules/vcs/git/status.py |
1029 |
index 963abf6..48a73be 100644 |
1030 |
--- a/pym/repoman/modules/vcs/git/status.py |
1031 |
+++ b/pym/repoman/modules/vcs/git/status.py |
1032 |
@@ -70,5 +70,10 @@ class Status(object): |
1033 |
|
1034 |
@staticmethod |
1035 |
def isVcsDir(dirname): |
1036 |
+ '''Does the directory belong to the vcs system |
1037 |
+ |
1038 |
+ @param dirname: string, directory name |
1039 |
+ @returns: Boolean |
1040 |
+ ''' |
1041 |
return dirname in [".git"] |
1042 |
|
1043 |
|
1044 |
diff --git a/pym/repoman/modules/vcs/hg/changes.py b/pym/repoman/modules/vcs/hg/changes.py |
1045 |
index 522981e..382eca1 100644 |
1046 |
--- a/pym/repoman/modules/vcs/hg/changes.py |
1047 |
+++ b/pym/repoman/modules/vcs/hg/changes.py |
1048 |
@@ -19,7 +19,8 @@ class Changes(ChangesBase): |
1049 |
def __init__(self, options, repo_settings): |
1050 |
'''Class init |
1051 |
|
1052 |
- @param options: commandline options |
1053 |
+ @param options: the run time cli options |
1054 |
+ @param repo_settings: RepoSettings instance |
1055 |
''' |
1056 |
super(Changes, self).__init__(options, repo_settings) |
1057 |
|
1058 |
@@ -66,14 +67,27 @@ class Changes(ChangesBase): |
1059 |
return self._deleted |
1060 |
|
1061 |
|
1062 |
- def digest_regen(self, myupdates, myremoved, mymanifests, scanner, broken_changelog_manifests): |
1063 |
+ def digest_regen(self, updates, removed, manifests, scanner, broken_changelog_manifests): |
1064 |
+ '''Regenerate manifests |
1065 |
+ |
1066 |
+ @param updates: updated files |
1067 |
+ @param removed: removed files |
1068 |
+ @param manifests: Manifest files |
1069 |
+ @param scanner: The repoman.scanner.Scanner instance |
1070 |
+ @param broken_changelog_manifests: broken changelog manifests |
1071 |
+ ''' |
1072 |
if broken_changelog_manifests: |
1073 |
for x in broken_changelog_manifests: |
1074 |
self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x) |
1075 |
digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb) |
1076 |
|
1077 |
def commit(self, myfiles, commitmessagefile): |
1078 |
- '''Hg commit the changes''' |
1079 |
+ '''Hg commit function |
1080 |
+ |
1081 |
+ @param commitfiles: list of files to commit |
1082 |
+ @param commitmessagefile: file containing the commit message |
1083 |
+ @returns: The sub-command exit value or 0 |
1084 |
+ ''' |
1085 |
commit_cmd = [] |
1086 |
commit_cmd.append(self.vcs) |
1087 |
commit_cmd.extend(self.vcs_settings.vcs_global_opts) |
1088 |
@@ -84,6 +98,7 @@ class Changes(ChangesBase): |
1089 |
|
1090 |
if self.options.pretend: |
1091 |
print("(%s)" % (" ".join(commit_cmd),)) |
1092 |
+ return 0 |
1093 |
else: |
1094 |
retval = spawn(commit_cmd, env=self.repo_settings.commit_env) |
1095 |
return retval |
1096 |
|
1097 |
diff --git a/pym/repoman/modules/vcs/hg/status.py b/pym/repoman/modules/vcs/hg/status.py |
1098 |
index a3081cb..8443554 100644 |
1099 |
--- a/pym/repoman/modules/vcs/hg/status.py |
1100 |
+++ b/pym/repoman/modules/vcs/hg/status.py |
1101 |
@@ -57,7 +57,7 @@ class Status(object): |
1102 |
|
1103 |
@staticmethod |
1104 |
def isVcsDir(dirname): |
1105 |
- '''Is the directory belong to the vcs system |
1106 |
+ '''Does the directory belong to the vcs system |
1107 |
|
1108 |
@param dirname: string, directory name |
1109 |
@returns: Boolean |
1110 |
|
1111 |
diff --git a/pym/repoman/modules/vcs/settings.py b/pym/repoman/modules/vcs/settings.py |
1112 |
index 9338a81..a8e91dd 100644 |
1113 |
--- a/pym/repoman/modules/vcs/settings.py |
1114 |
+++ b/pym/repoman/modules/vcs/settings.py |
1115 |
@@ -1,3 +1,6 @@ |
1116 |
+''' |
1117 |
+Repoman VCSSettings modules |
1118 |
+''' |
1119 |
|
1120 |
from __future__ import print_function, unicode_literals |
1121 |
|
1122 |
@@ -14,6 +17,12 @@ class VCSSettings(object): |
1123 |
'''Holds various VCS settings''' |
1124 |
|
1125 |
def __init__(self, options=None, repoman_settings=None, repo_settings=None): |
1126 |
+ '''Class init function |
1127 |
+ |
1128 |
+ @param options: the run time cli options |
1129 |
+ @param repoman_settings: portage.config settings instance |
1130 |
+ @param repo_settings: RepoSettings instance |
1131 |
+ ''' |
1132 |
self.options = options |
1133 |
self.repoman_settings = repoman_settings |
1134 |
self.repo_settings = repo_settings |
1135 |
@@ -82,6 +91,8 @@ class VCSSettings(object): |
1136 |
|
1137 |
@property |
1138 |
def status(self): |
1139 |
+ '''Initializes and returns the class instance |
1140 |
+ of the vcs's Status class''' |
1141 |
if not self._status: |
1142 |
status = self.module_controller.get_class('%s_status' % self.vcs) |
1143 |
self._status = status(self.qatracker, self.eadded) |
1144 |
@@ -89,6 +100,8 @@ class VCSSettings(object): |
1145 |
|
1146 |
@property |
1147 |
def changes(self): |
1148 |
+ '''Initializes and returns the class instance |
1149 |
+ of the vcs's Changes class''' |
1150 |
if not self._changes: |
1151 |
changes = self.module_controller.get_class('%s_changes' % self.vcs) |
1152 |
self._changes = changes(self.options, self.repo_settings) |
1153 |
|
1154 |
diff --git a/pym/repoman/modules/vcs/svn/changes.py b/pym/repoman/modules/vcs/svn/changes.py |
1155 |
index 87132f0..311e40b 100644 |
1156 |
--- a/pym/repoman/modules/vcs/svn/changes.py |
1157 |
+++ b/pym/repoman/modules/vcs/svn/changes.py |
1158 |
@@ -24,7 +24,8 @@ class Changes(ChangesBase): |
1159 |
def __init__(self, options, repo_settings): |
1160 |
'''Class init |
1161 |
|
1162 |
- @param options: commandline options |
1163 |
+ @param options: the run time cli options |
1164 |
+ @param repo_settings: RepoSettings instance |
1165 |
''' |
1166 |
super(Changes, self).__init__(options, repo_settings) |
1167 |
|
1168 |
@@ -73,7 +74,14 @@ class Changes(ChangesBase): |
1169 |
del svnstatus |
1170 |
return self._unadded |
1171 |
|
1172 |
- def thick_manifest(self, myupdates, myheaders, no_expansion, expansion): |
1173 |
+ def thick_manifest(self, updates, headers, no_expansion, expansion): |
1174 |
+ '''Create a thick manifest |
1175 |
+ |
1176 |
+ @param updates: |
1177 |
+ @param headers: |
1178 |
+ @param no_expansion: |
1179 |
+ @param expansion: |
1180 |
+ ''' |
1181 |
svn_keywords = dict((k.lower(), k) for k in [ |
1182 |
"Rev", |
1183 |
"Revision", |
1184 |
@@ -88,36 +96,44 @@ class Changes(ChangesBase): |
1185 |
"Header", |
1186 |
]) |
1187 |
|
1188 |
- for myfile in myupdates: |
1189 |
+ for _file in updates: |
1190 |
# for SVN, expansion contains files that are included in expansion |
1191 |
- if myfile not in expansion: |
1192 |
+ if _file not in expansion: |
1193 |
continue |
1194 |
|
1195 |
# Subversion keywords are case-insensitive |
1196 |
# in svn:keywords properties, |
1197 |
# but case-sensitive in contents of files. |
1198 |
enabled_keywords = [] |
1199 |
- for k in expansion[myfile]: |
1200 |
+ for k in expansion[_file]: |
1201 |
keyword = svn_keywords.get(k.lower()) |
1202 |
if keyword is not None: |
1203 |
enabled_keywords.append(keyword) |
1204 |
|
1205 |
headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords) |
1206 |
|
1207 |
- myout = repoman_getstatusoutput( |
1208 |
- "egrep -q %s %s" % (headerstring, portage._shell_quote(myfile))) |
1209 |
- if myout[0] == 0: |
1210 |
- myheaders.append(myfile) |
1211 |
+ _out = repoman_getstatusoutput( |
1212 |
+ "egrep -q %s %s" % (headerstring, portage._shell_quote(_file))) |
1213 |
+ if _out[0] == 0: |
1214 |
+ headers.append(_file) |
1215 |
|
1216 |
- print("%s have headers that will change." % green(str(len(myheaders)))) |
1217 |
+ print("%s have headers that will change." % green(str(len(headers)))) |
1218 |
print( |
1219 |
"* Files with headers will" |
1220 |
" cause the manifests to be changed and committed separately.") |
1221 |
|
1222 |
- def digest_regen(self, myupdates, myremoved, mymanifests, scanner, broken_changelog_manifests): |
1223 |
- if myupdates or myremoved: |
1224 |
+ def digest_regen(self, updates, removed, manifests, scanner, broken_changelog_manifests): |
1225 |
+ '''Regenerate manifests |
1226 |
+ |
1227 |
+ @param updates: updated files |
1228 |
+ @param removed: removed files |
1229 |
+ @param manifests: Manifest files |
1230 |
+ @param scanner: The repoman.scanner.Scanner instance |
1231 |
+ @param broken_changelog_manifests: broken changelog manifests |
1232 |
+ ''' |
1233 |
+ if updates or removed: |
1234 |
for x in sorted(vcs_files_to_cps( |
1235 |
- chain(myupdates, myremoved, mymanifests), |
1236 |
+ chain(updates, removed, manifests), |
1237 |
self.scanner.repolevel, self.scanner.reposplit, self.scanner.categories)): |
1238 |
self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x) |
1239 |
digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb) |
1240 |
|
1241 |
diff --git a/pym/repoman/modules/vcs/svn/status.py b/pym/repoman/modules/vcs/svn/status.py |
1242 |
index 3b57149..6575fe0 100644 |
1243 |
--- a/pym/repoman/modules/vcs/svn/status.py |
1244 |
+++ b/pym/repoman/modules/vcs/svn/status.py |
1245 |
@@ -142,7 +142,7 @@ class Status(object): |
1246 |
|
1247 |
@staticmethod |
1248 |
def isVcsDir(dirname): |
1249 |
- '''Is the directory belong to the vcs system |
1250 |
+ '''Does the directory belong to the vcs system |
1251 |
|
1252 |
@param dirname: string, directory name |
1253 |
@returns: Boolean |
1254 |
|
1255 |
diff --git a/pym/repoman/modules/vcs/vcs.py b/pym/repoman/modules/vcs/vcs.py |
1256 |
index 8ec7270..c8cb55d 100644 |
1257 |
--- a/pym/repoman/modules/vcs/vcs.py |
1258 |
+++ b/pym/repoman/modules/vcs/vcs.py |
1259 |
@@ -47,7 +47,11 @@ def FindVCS(cwd=None): |
1260 |
outvcs = [] |
1261 |
|
1262 |
def seek(depth=None): |
1263 |
- """ Seek for VCSes that have a top-level data directory only. """ |
1264 |
+ '''Seek for VCSes that have a top-level data directory only. |
1265 |
+ |
1266 |
+ @param depth: integer |
1267 |
+ @returns: list of strings |
1268 |
+ ''' |
1269 |
retvcs = [] |
1270 |
pathprep = cwd |
1271 |
|
1272 |
@@ -127,6 +131,13 @@ def vcs_files_to_cps(vcs_file_iter, repolevel, reposplit, categories): |
1273 |
|
1274 |
|
1275 |
def vcs_new_changed(relative_path, mychanged, mynew): |
1276 |
+ '''Check if any vcs tracked file have been modified |
1277 |
+ |
1278 |
+ @param relative_path: |
1279 |
+ @param mychanged: iterable of changed files |
1280 |
+ @param mynew: iterable of new files |
1281 |
+ @returns boolean |
1282 |
+ ''' |
1283 |
for x in chain(mychanged, mynew): |
1284 |
if x == relative_path: |
1285 |
return True |