1 |
diff -Nur plague-0.4.4.1-orig/server/Builder.py plague-0.4.4.1/server/Builder.py |
2 |
--- plague-0.4.4.1-orig/server/Builder.py 2006-02-19 07:26:19.000000000 +0100 |
3 |
+++ plague-0.4.4.1/server/Builder.py 2008-01-09 04:00:08.000000000 +0100 |
4 |
@@ -103,6 +103,10 @@ |
5 |
(self._alive, target_list) = self._ping_builder() |
6 |
if self._alive: |
7 |
self._init_builder(target_list) |
8 |
+ else: |
9 |
+ # Treat the builder as timed out and ping it periodically |
10 |
+ self._ping_timeout = time.time() |
11 |
+ self._suspend_reason = SUSPEND_TIMEOUT |
12 |
|
13 |
def _init_builder(self, target_list): |
14 |
self._target_list = target_list |
15 |
diff -Nur plague-0.4.4.1-orig/server/BuildMaster.py plague-0.4.4.1/server/BuildMaster.py |
16 |
--- plague-0.4.4.1-orig/server/BuildMaster.py 2005-11-29 07:16:52.000000000 +0100 |
17 |
+++ plague-0.4.4.1/server/BuildMaster.py 2008-01-09 04:00:08.000000000 +0100 |
18 |
@@ -72,6 +72,9 @@ |
19 |
threading.Thread.__init__(self) |
20 |
self.setName("BuildMaster") |
21 |
|
22 |
+ def _cleanup(self): |
23 |
+ del self._cursor, self._dbcx |
24 |
+ |
25 |
def _requeue_interrupted_jobs(self): |
26 |
""" Restart interrupted jobs from our db. """ |
27 |
self._cursor.execute("SELECT uid FROM jobs WHERE (status!='needsign' AND status!='failed' AND status!='finished') ORDER BY uid") |
28 |
@@ -416,3 +419,4 @@ |
29 |
while not self._have_work() and time.time() <= last_time + 5: |
30 |
time.sleep(0.25) |
31 |
|
32 |
+ self._cleanup() |
33 |
diff -Nur plague-0.4.4.1-orig/server/DBManager.py plague-0.4.4.1/server/DBManager.py |
34 |
--- plague-0.4.4.1-orig/server/DBManager.py 2005-10-24 17:32:21.000000000 +0200 |
35 |
+++ plague-0.4.4.1/server/DBManager.py 2008-01-09 04:00:08.000000000 +0100 |
36 |
@@ -198,6 +198,10 @@ |
37 |
|
38 |
return dbcx |
39 |
|
40 |
+ def __del__(self): |
41 |
+ self._dbcx.close() |
42 |
+ del self._dbcx |
43 |
+ |
44 |
|
45 |
class mysqlEngineClass(BaseDBEngineClass): |
46 |
|
47 |
@@ -247,6 +251,10 @@ |
48 |
|
49 |
return dbcx |
50 |
|
51 |
+ def __del__(self): |
52 |
+ self._dbcx.close() |
53 |
+ del self._dbcx |
54 |
+ |
55 |
|
56 |
db_engines = { |
57 |
'sqlite': sqliteEngineClass, |
58 |
diff -Nur plague-0.4.4.1-orig/server/PackageJob.py plague-0.4.4.1/server/PackageJob.py |
59 |
--- plague-0.4.4.1-orig/server/PackageJob.py 2006-03-13 05:10:49.000000000 +0100 |
60 |
+++ plague-0.4.4.1/server/PackageJob.py 2008-01-09 04:00:08.000000000 +0100 |
61 |
@@ -462,6 +462,9 @@ |
62 |
""" Called by the BuilderManager when it's started a new arch job for us """ |
63 |
self._archjobs_lock.acquire() |
64 |
jobarch = job.arch() |
65 |
+ if not self.archjobs.has_key(jobarch): |
66 |
+ log(("%s (%s/%s): Didn't have key for '%s', added it." % (self.uid, self.package, jobarch, jobarch))) |
67 |
+ self.archjobs[jobarch] = None |
68 |
if self.archjobs[jobarch] != None: |
69 |
log("%s (%s/%s): Already have archjob for this arch (%s). New job UID is %s." % (self.uid, \ |
70 |
self.package, jobarch, self.archjobs[jobarch].jobid, job.jobid)) |
71 |
@@ -653,7 +656,10 @@ |
72 |
# the original SRPM. |
73 |
if not os.path.exists(srpm_file): |
74 |
shutil.copy(src_file, srpm_file) |
75 |
- os.remove(src_file) |
76 |
+ try: |
77 |
+ os.remove(src_file) |
78 |
+ except OSError, e: |
79 |
+ debugprint("%d: Error cleaning up job files - '%s'" % (self.uid, e)) |
80 |
|
81 |
# If there were no builder-built SRPMs, keep the original around |
82 |
if not os.path.exists(srpm_file): |
83 |
diff -Nur plague-0.4.4.1-orig/server/Repo.py plague-0.4.4.1/server/Repo.py |
84 |
--- plague-0.4.4.1-orig/server/Repo.py 2005-11-29 07:17:07.000000000 +0100 |
85 |
+++ plague-0.4.4.1/server/Repo.py 2008-01-09 04:00:08.000000000 +0100 |
86 |
@@ -120,7 +120,9 @@ |
87 |
|
88 |
(s, o) = commands.getstatusoutput('/usr/bin/createrepo -q -c %s -x "*.src.rpm" -x "*.debuginfo.rpm" %s' % (self._repo_cache_dir, self._repodir)) |
89 |
if s != 0: |
90 |
- print "Error: createrepo failed with exit status %d! Output: '%s'" % (s, o) |
91 |
+ print "Repo Error (%s): createrepo failed with exit status %d! Output: '%s'" % (target_string, s, o) |
92 |
+ |
93 |
+ del target_string |
94 |
|
95 |
def _run_repo_script(self): |
96 |
target_str = self._target_cfg.target_string() |
97 |
diff -Nur plague-0.4.4.1-orig/server/UserInterface.py plague-0.4.4.1/server/UserInterface.py |
98 |
--- plague-0.4.4.1-orig/server/UserInterface.py 2005-11-28 18:46:21.000000000 +0100 |
99 |
+++ plague-0.4.4.1/server/UserInterface.py 2008-01-09 04:00:08.000000000 +0100 |
100 |
@@ -181,6 +181,7 @@ |
101 |
dbcx = self._db_manager.dbcx() |
102 |
curs = dbcx.cursor() |
103 |
except StandardError, e: |
104 |
+ del curs, dbcx |
105 |
return (-1, "Unable to access job database: '%s'" % e) |
106 |
curs.execute(sql) |
107 |
job = dbcx.fetchone(curs) |
108 |
@@ -193,8 +194,7 @@ |
109 |
self._bm.requeue_job(uid) |
110 |
result = (0, "Success: Job %d has been requeued." % uid) |
111 |
|
112 |
- del curs |
113 |
- del dbcx |
114 |
+ del curs, dbcx |
115 |
return result |
116 |
|
117 |
def _kill_job(self, email, job, jobid): |
118 |
@@ -315,6 +315,7 @@ |
119 |
dbcx = self._db_manager.dbcx() |
120 |
curs = dbcx.cursor() |
121 |
except StandardError, e: |
122 |
+ del curs, dbcx |
123 |
return (-1, "Unable to access job database: '%s'" % e, []) |
124 |
curs.execute(sql) |
125 |
data = dbcx.fetchall(curs) |
126 |
@@ -363,8 +364,7 @@ |
127 |
if job['uid'] == ajrec['parent_uid']: |
128 |
job['archjobs'].append(copy.deepcopy(ajrec)) |
129 |
|
130 |
- del curs |
131 |
- del dbcx |
132 |
+ del curs, dbcx |
133 |
return (0, "Success.", jobs) |
134 |
|
135 |
|
136 |
@@ -388,8 +388,7 @@ |
137 |
curs.execute(sql) |
138 |
job = dbcx.fetchone(curs) |
139 |
if not job: |
140 |
- del curs |
141 |
- del dbcx |
142 |
+ del curs, dbcx |
143 |
return (-1, "Error: Invalid job UID.", {}) |
144 |
jobrec = {} |
145 |
jobrec['uid'] = job['uid'] |
146 |
@@ -436,8 +435,7 @@ |
147 |
|
148 |
ret_job = copy.deepcopy(jobrec) |
149 |
|
150 |
- del curs |
151 |
- del dbcx |
152 |
+ del curs, dbcx |
153 |
return (0, "Success.", ret_job) |
154 |
|
155 |
|
156 |
@@ -473,6 +471,13 @@ |
157 |
return self._bm.is_paused() |
158 |
|
159 |
def finish(self, uid_list): |
160 |
+ try: |
161 |
+ dbcx = self._db_manager.dbcx() |
162 |
+ curs = dbcx.cursor() |
163 |
+ except StandardError, e: |
164 |
+ del curs, dbcx |
165 |
+ return (-1, "Unable to access job database: '%s'" % e) |
166 |
+ |
167 |
uids = '' |
168 |
for uid in uid_list: |
169 |
uid = validate_uid(uid) |
170 |
@@ -486,16 +491,10 @@ |
171 |
if len(uids): |
172 |
sql = "UPDATE jobs SET status='finished' WHERE %s" % uids |
173 |
|
174 |
- try: |
175 |
- dbcx = self._db_manager.dbcx() |
176 |
- curs = dbcx.cursor() |
177 |
- except StandardError, e: |
178 |
- return (-1, "Unable to access job database: '%s'" % e) |
179 |
curs.execute(sql) |
180 |
dbcx.commit() |
181 |
- del curs |
182 |
- del dbcx |
183 |
|
184 |
+ del curs, dbcx |
185 |
return (0, "Success.") |
186 |
|
187 |
def srpm_upload_dir(self, target_alias): |
188 |
@@ -538,6 +537,7 @@ |
189 |
dbcx = self._db_manager.dbcx() |
190 |
curs = dbcx.cursor() |
191 |
except StandardError, e: |
192 |
+ del curs, dbcx |
193 |
return (-1, "Unable to access job database: '%s'" % e) |
194 |
|
195 |
curs.execute(sql) |
196 |
@@ -551,8 +551,7 @@ |
197 |
else: |
198 |
result = UserInterface.requeue(self, uid) |
199 |
|
200 |
- del curs |
201 |
- del dbcx |
202 |
+ del curs, dbcx |
203 |
return result |
204 |
|
205 |
def kill_job(self, email, jobid): |
206 |
@@ -627,6 +626,7 @@ |
207 |
dbcx = self._db_manager.dbcx() |
208 |
curs = dbcx.cursor() |
209 |
except StandardError, e: |
210 |
+ del curs, dbcx |
211 |
return (-1, "Unable to access job database: '%s'" % e) |
212 |
|
213 |
curs.execute(sql) |
214 |
@@ -656,8 +656,7 @@ |
215 |
|
216 |
final_uid_list.append(uid) |
217 |
|
218 |
- del curs |
219 |
- del dbcx |
220 |
+ del curs, dbcx |
221 |
|
222 |
if error: |
223 |
return error |
224 |
diff -Nur plague-0.4.4.1-orig/server/User.py plague-0.4.4.1/server/User.py |
225 |
--- plague-0.4.4.1-orig/server/User.py 2005-08-15 05:18:20.000000000 +0200 |
226 |
+++ plague-0.4.4.1/server/User.py 2008-01-09 04:00:08.000000000 +0100 |
227 |
@@ -68,6 +68,7 @@ |
228 |
'user_admin BOOLEAN, ' \ |
229 |
'server_admin BOOLEAN)') |
230 |
dbcx.commit() |
231 |
+ del curs, dbcx |
232 |
|
233 |
|
234 |
def new_authed_user(self, email, client_address): |
235 |
@@ -88,5 +89,6 @@ |
236 |
else: |
237 |
if self._cfg.get_bool("UI", "guest_allowed"): |
238 |
user = User('guest@guest', True) |
239 |
+ del curs, dbcx |
240 |
return user |
241 |
|
242 |
diff -Nur plague-0.4.4.1-orig/www/job.psp plague-0.4.4.1/www/job.psp |
243 |
--- plague-0.4.4.1-orig/www/job.psp 2005-09-01 20:28:32.000000000 +0200 |
244 |
+++ plague-0.4.4.1/www/job.psp 2008-01-09 04:01:06.000000000 +0100 |
245 |
@@ -74,9 +74,11 @@ |
246 |
if job.has_key('result_msg') and job['result_msg'] and len(job['result_msg']): |
247 |
import urllib |
248 |
result_msg = urllib.unquote(str(job['result_msg'])) |
249 |
+ if result_msg[-1] != '\n': |
250 |
+ result_msg += '\n' |
251 |
result_msg = "<p class='result'>"+result_msg.replace("\n", "</p><p class='result'>")+"</p>" |
252 |
%> |
253 |
- <tr><td class="jobdetail-tag"><font class="jobdetail-tag">Result:</font></td><td class="jobdetail-text">"<%=result_msg%>"</td></tr> |
254 |
+ <tr><td class="jobdetail-tag"><font class="jobdetail-tag">Result:</font></td><td class="jobdetail-text"><%=result_msg%></td></tr> |
255 |
<% |
256 |
# endif |
257 |
%> |