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