1 |
commit: 598024be9e966eabc42e27ec32bdcbc630035290 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jun 3 18:42:37 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Wed Oct 1 22:58:13 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=598024be |
7 |
|
8 |
Repoman: Refactor VCSStatus to pass non consistent data to the check() |
9 |
|
10 |
This will facilitae for the initialization of the class before the big xpkg loop. |
11 |
|
12 |
--- |
13 |
pym/repoman/main.py | 4 ++-- |
14 |
pym/repoman/vcs/vcsstatus.py | 39 ++++++++++++++++++--------------------- |
15 |
2 files changed, 20 insertions(+), 23 deletions(-) |
16 |
|
17 |
diff --git a/pym/repoman/main.py b/pym/repoman/main.py |
18 |
index c19bf94..8197400 100755 |
19 |
--- a/pym/repoman/main.py |
20 |
+++ b/pym/repoman/main.py |
21 |
@@ -322,8 +322,8 @@ for xpkg in effective_scanlist: |
22 |
filescheck.check(checkdir, checkdirlist, checkdir_relative, |
23 |
changed.changed, changed.new) |
24 |
####################### |
25 |
- status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker) |
26 |
- status_check.check(check_ebuild_notadded) |
27 |
+ status_check = VCSStatus(vcs_settings, qatracker) |
28 |
+ status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg) |
29 |
eadded.extend(status_check.eadded) |
30 |
|
31 |
################# |
32 |
|
33 |
diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py |
34 |
index 6a81b1b..0517c04 100644 |
35 |
--- a/pym/repoman/vcs/vcsstatus.py |
36 |
+++ b/pym/repoman/vcs/vcsstatus.py |
37 |
@@ -13,52 +13,49 @@ class VCSStatus(object): |
38 |
'''Determines the status of the vcs repositories |
39 |
to determine if files are not added''' |
40 |
|
41 |
- def __init__(self, vcs_settings, checkdir, checkdir_relative, xpkg, qatracker): |
42 |
+ def __init__(self, vcs_settings, qatracker): |
43 |
self.vcs_settings = vcs_settings |
44 |
self.vcs = vcs_settings.vcs |
45 |
self.eadded = [] |
46 |
- self.checkdir = checkdir |
47 |
- self.checkdir_relative = checkdir_relative |
48 |
- self.xpkg = xpkg |
49 |
self.qatracker = qatracker |
50 |
|
51 |
|
52 |
- def check(self, check_not_added): |
53 |
+ def check(self, check_not_added, checkdir, checkdir_relative, xpkg): |
54 |
if self.vcs and check_not_added: |
55 |
vcscheck = getattr(self, 'check_%s' % self.vcs) |
56 |
- vcscheck() |
57 |
+ vcscheck(checkdir, checkdir_relative, xpkg) |
58 |
|
59 |
|
60 |
- def post_git_hg(self, myf): |
61 |
+ def post_git_hg(self, myf, xpkg): |
62 |
for l in myf: |
63 |
if l[:-1][-7:] == ".ebuild": |
64 |
self.qatracker.add_error("ebuild.notadded", |
65 |
- os.path.join(self.xpkg, os.path.basename(l[:-1]))) |
66 |
+ os.path.join(xpkg, os.path.basename(l[:-1]))) |
67 |
myf.close() |
68 |
|
69 |
|
70 |
- def check_git(self): |
71 |
+ def check_git(self, checkdir, checkdir_relative, xpkg): |
72 |
myf = repoman_popen( |
73 |
"git ls-files --others %s" % |
74 |
- (portage._shell_quote(self.checkdir_relative),)) |
75 |
- self.post_git_hg(myf) |
76 |
+ (portage._shell_quote(checkdir_relative),)) |
77 |
+ self.post_git_hg(myf, xpkg) |
78 |
|
79 |
|
80 |
- def check_hg(self): |
81 |
+ def check_hg(self, checkdir, checkdir_relative, xpkg): |
82 |
myf = repoman_popen( |
83 |
"hg status --no-status --unknown %s" % |
84 |
- (portage._shell_quote(self.checkdir_relative),)) |
85 |
- self.post_git_hg(myf) |
86 |
+ (portage._shell_quote(checkdir_relative),)) |
87 |
+ self.post_git_hg(myf, xpkg) |
88 |
|
89 |
|
90 |
- def check_cvs(self): |
91 |
+ def check_cvs(self, checkdir, checkdir_relative, xpkg): |
92 |
try: |
93 |
- myf = open(self.checkdir + "/CVS/Entries", "r") |
94 |
+ myf = open(checkdir + "/CVS/Entries", "r") |
95 |
myl = myf.readlines() |
96 |
myf.close() |
97 |
except IOError: |
98 |
self.qatracker.add_error("CVS/Entries.IO_error", |
99 |
- self.checkdir + "/CVS/Entries") |
100 |
+ checkdir + "/CVS/Entries") |
101 |
return True |
102 |
for l in myl: |
103 |
if l[0] != "/": |
104 |
@@ -71,7 +68,7 @@ class VCSStatus(object): |
105 |
return True |
106 |
|
107 |
|
108 |
- def check_svn(self): |
109 |
+ def check_svn(self, checkdir, checkdir_relative, xpkg): |
110 |
try: |
111 |
myf = repoman_popen( |
112 |
"svn status --depth=files --verbose " + |
113 |
@@ -92,7 +89,7 @@ class VCSStatus(object): |
114 |
try: |
115 |
myf = repoman_popen( |
116 |
"svn status " + |
117 |
- portage._shell_quote(self.checkdir)) |
118 |
+ portage._shell_quote(checkdir)) |
119 |
myl = myf.readlines() |
120 |
myf.close() |
121 |
except IOError: |
122 |
@@ -105,11 +102,11 @@ class VCSStatus(object): |
123 |
return True |
124 |
|
125 |
|
126 |
- def check_bzr(self): |
127 |
+ def check_bzr(self, checkdir, checkdir_relative, xpkg): |
128 |
try: |
129 |
myf = repoman_popen( |
130 |
"bzr ls -v --kind=file " + |
131 |
- portage._shell_quote(self.checkdir)) |
132 |
+ portage._shell_quote(checkdir)) |
133 |
myl = myf.readlines() |
134 |
myf.close() |
135 |
except IOError: |